1 | // Module : $RCSfile: PHPEventType.java,v $ |
---|
2 | // Version : $Revision: 0.0 $ $Author: sherbold $ $Date: Aug 16, 2012 $ |
---|
3 | // Project : quest-ui-core |
---|
4 | // Creation : 2012 by sherbold |
---|
5 | // Copyright : Patrick Harms, 2012 |
---|
6 | |
---|
7 | package de.ugoe.cs.quest.plugin.php.eventcore; |
---|
8 | |
---|
9 | import java.util.List; |
---|
10 | |
---|
11 | import de.ugoe.cs.quest.eventcore.IEventType; |
---|
12 | |
---|
13 | /** |
---|
14 | * <p> |
---|
15 | * Event type for PHP web requests. |
---|
16 | * </p> |
---|
17 | * |
---|
18 | * @version $Revision: $ $Date: Aug 16, 2012$ |
---|
19 | * @author 2012, last modified by $Author: sherbold$ |
---|
20 | */ |
---|
21 | public class PHPEventType implements IEventType { |
---|
22 | |
---|
23 | /** |
---|
24 | * <p> |
---|
25 | * Id for object serialization. |
---|
26 | * </p> |
---|
27 | */ |
---|
28 | private static final long serialVersionUID = 1L; |
---|
29 | |
---|
30 | /** |
---|
31 | * <p> |
---|
32 | * Path of the web request. |
---|
33 | * </p> |
---|
34 | */ |
---|
35 | private String path; |
---|
36 | |
---|
37 | /** |
---|
38 | * <p> |
---|
39 | * List of post variable names posted with the request. |
---|
40 | * </p> |
---|
41 | */ |
---|
42 | private List<String> postVars; |
---|
43 | |
---|
44 | /** |
---|
45 | * <p> |
---|
46 | * List of get variable names posted with the request. |
---|
47 | * </p> |
---|
48 | */ |
---|
49 | private List<String> getVars; |
---|
50 | |
---|
51 | /** |
---|
52 | * <p> |
---|
53 | * Constructor. Creates a new PHPEventType from a given path, a list of post variables, and a |
---|
54 | * list of get variables. |
---|
55 | * </p> |
---|
56 | * |
---|
57 | * @param path |
---|
58 | * path of the URI of the event |
---|
59 | * @param postVars |
---|
60 | * POST variables send with the event |
---|
61 | * @param getVars |
---|
62 | * GET variables send with the event |
---|
63 | */ |
---|
64 | public PHPEventType(String path, List<String> postVars, List<String> getVars) { |
---|
65 | this.path = path; |
---|
66 | this.postVars = postVars; |
---|
67 | this.getVars = getVars; |
---|
68 | } |
---|
69 | |
---|
70 | /* |
---|
71 | * (non-Javadoc) |
---|
72 | * |
---|
73 | * @see de.ugoe.cs.quest.eventcore.IEventType#getName() |
---|
74 | */ |
---|
75 | @Override |
---|
76 | public String getName() { |
---|
77 | return "PHPEventType"; |
---|
78 | } |
---|
79 | |
---|
80 | /* |
---|
81 | * (non-Javadoc) |
---|
82 | * |
---|
83 | * @see java.lang.Object#toString() |
---|
84 | */ |
---|
85 | @Override |
---|
86 | public String toString() { |
---|
87 | String str = path; |
---|
88 | if (getVars != null && !getVars.isEmpty()) { |
---|
89 | str += "+GET" + getVars.toString().replace(" ", ""); |
---|
90 | } |
---|
91 | if (postVars != null && !postVars.isEmpty()) { |
---|
92 | str += "+POST" + postVars.toString().replace(" ", ""); |
---|
93 | } |
---|
94 | return str; |
---|
95 | } |
---|
96 | |
---|
97 | } |
---|