View Javadoc

1   package pt.digitalis.dif.controller.interfaces;
2   
3   import java.util.Map;
4   
5   import pt.digitalis.dif.controller.objects.ClientDescriptor;
6   import pt.digitalis.dif.controller.objects.RESTAction;
7   import pt.digitalis.dif.dem.interfaces.IStage;
8   
9   /**
10   * Defines the expected behavior for a DIF request.
11   * 
12   * @author Luis Pinto <a href="mailto:lpinto@digitalis.pt">lpinto@digitalis.pt</a>
13   * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a>
14   */
15  public interface IDIFRequest {
16  
17      /** The id where requests indicates that the chal client validations should or shouldn't be made */
18      final static public String CLIENT_VALIDATIONS_ATTRIBUTE_ID = "clientValidationsAttributeId";
19  
20      /** The id where requests indicates that want's download the server log */
21      final static public String LOG_PARAMETER_ID = "_log";
22  
23      /** The id where requests indicates that want's to login */
24      final static public String LOGIN_PARAMETER_ID = "loginparam";
25  
26      /** The id where requests indicates that want's to logout */
27      final static public String LOGOUT_PARAMETER_ID = "logoutparam";
28  
29      /** The id where users pass the user password to authenticate */
30      final static public String PASSWORD_PARAMETER_ID = "_pass";
31  
32      /** The exceptional redirect to parameter */
33      final static public String REDIRECT_TO_URL = "redirectToUrl";
34  
35      /** The id where users pass the user id to authenticate */
36      final static public String USER_PARAMETER_ID = "_user";
37  
38      /**
39       * Adds a new attribute to the DIFRequest collection.
40       * 
41       * @param attributeName
42       *            attribute identifier
43       * @param attributeValue
44       *            attribute value
45       */
46      public void addAttribute(String attributeName, Object attributeValue);
47  
48      /**
49       * Adds a new parameter to the DIFRequest collection.
50       * 
51       * @param parameterName
52       *            parameter identifier
53       * @param parameterValue
54       *            parameter value
55       */
56      public void addParameter(String parameterName, Object parameterValue);
57  
58      /**
59       * Retrieves an attribute from the attribute collection
60       * 
61       * @param name
62       *            the name of the attribute to retrieve
63       * @return on Object with the attribute value
64       */
65      public Object getAttribute(String name);
66  
67      /**
68       * Inspector for the request parameters.
69       * 
70       * @return the request attributes
71       */
72      public Map<String, Object> getAttributes();
73  
74      /**
75       * Inspector for the client descriptor.
76       * 
77       * @return the client descriptor
78       */
79      public ClientDescriptor getClient();
80  
81      /**
82       * Format inspector.
83       * 
84       * @return the format
85       */
86      public String getFormat();
87  
88      /**
89       * Retrieves a parameter from the parameter collection
90       * 
91       * @param name
92       *            the name of the parameter to retrieve
93       * @return on Object with the parameter value
94       */
95      public Object getParameter(String name);
96  
97      /**
98       * Inspector for the request parameters.
99       * 
100      * @return the request parameters
101      */
102     public Map<String, Object> getParameters();
103 
104     /**
105      * @return the REST action executed, if specified.
106      */
107     public RESTAction getRestAction();
108 
109     /**
110      * Inspector for the session.
111      * 
112      * @return the session
113      */
114     public IDIFSession getSession();
115 
116     /**
117      * Stage inspector.
118      * 
119      * @return the stage
120      */
121     public String getStage();
122 
123     /**
124      * Stage inspector.
125      * 
126      * @return the stage proxy
127      */
128     public IStage getStageProxy();
129 
130     /**
131      * @return T if current stage has been requested in ajax mode
132      */
133     public boolean isAjaxMode();
134 
135     /**
136      * @return T if current stage has been requested in component mode
137      */
138     public boolean isComponentMode();
139 
140     /**
141      * @return T if current stage has been requested in help mode
142      */
143     public boolean isHelpMode();
144 
145     /**
146      * @return T if current stage has been requested in popup mode
147      */
148     public boolean isPopupMode();
149 
150     /**
151      * @return T if current stage has been requested in REST mode
152      */
153     public boolean isRestCall();
154 
155     /**
156      * @return T if current stage has been requested in template mode
157      */
158     public boolean isTemplateMode();
159 
160     /**
161      * Modifier for the request attributes.
162      * 
163      * @param attributes
164      *            the attributes to set
165      */
166     public void setAttributes(Map<String, Object> attributes);
167 
168     /**
169      * @param client
170      *            the client to set
171      */
172     public void setClient(ClientDescriptor client);
173 
174     /**
175      * @param componentMode
176      *            the componentMode to set
177      */
178     public void setComponentMode(boolean componentMode);
179 
180     /**
181      * Format modifier.
182      * 
183      * @param format
184      *            the format to set
185      */
186     public void setFormat(String format);
187 
188     /**
189      * @param helpMode
190      *            the helpMode to set
191      */
192     public void setHelpMode(boolean helpMode);
193 
194     /**
195      * Modifier for the request parameters.
196      * 
197      * @param parameters
198      *            the parameters to set
199      */
200     public void setParameters(Map<String, Object> parameters);
201 
202     /**
203      * @param popupMode
204      *            the popupMode to set
205      */
206     public void setPopupMode(boolean popupMode);
207 
208     /**
209      * @param restAction
210      *            sets the RES action executed.
211      */
212     public void setRestAction(RESTAction restAction);
213 
214     /**
215      * Modifier for the session
216      * 
217      * @param session
218      *            the session to set
219      */
220     public void setSession(IDIFSession session);
221 
222     /**
223      * Stage modifier.
224      * 
225      * @param newStage
226      *            the stage to set
227      */
228     public void setStage(String newStage);
229 
230     /**
231      * @param templateMode
232      *            the templateMode to set
233      */
234     public void setTemplateMode(boolean templateMode);
235 }