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