View Javadoc

1   /**
2    * - Digitalis Internal Framework v2.0 - (C) 2007, Digitalis Informatica. Distribuicao e Gestao de Informatica, Lda.
3    * Estrada de Paco de Arcos num.9 - Piso -1 2780-666 Paco de Arcos Telefone: (351) 21 4408990 Fax: (351) 21 4408999
4    * http://www.digitalis.pt
5    */
6   package pt.digitalis.dif.controller.interfaces;
7   
8   import java.util.Map;
9   
10  import pt.digitalis.dif.controller.objects.ResultMessage;
11  import pt.digitalis.dif.dem.managers.IUsageIssuesManager;
12  import pt.digitalis.dif.dem.objects.ViewObject;
13  import pt.digitalis.dif.dem.objects.issues.IssueType;
14  import pt.digitalis.dif.dem.objects.issues.UsageIssue;
15  
16  /**
17   * This interface hides some DIFContext details from the Stage. There are public setters on the DIFContext class that
18   * would be accessible to the Stage.
19   * 
20   * @author Rodrigo Gonçalves <a href="mailto:rgoncalves@digitalis.pt">rgoncalves@digitalis.pt</a>
21   * @created 2007/04/20
22   */
23  public interface IDIFContext {
24  
25      /**
26       * Adds a result message to the stage result
27       * 
28       * @param type
29       *            the message type
30       * @param title
31       *            the title of the message
32       * @param description
33       *            the description of the message
34       */
35      public void addResultMessage(String type, String title, String description);
36  
37      /**
38       * Adds a result message to the stage result
39       * 
40       * @param type
41       *            the message type
42       * @param title
43       *            the title of the message
44       * @param description
45       *            the description of the message
46       * @param popupMode
47       *            if the message should be showed in popup mode (in a dialog)
48       */
49      public void addResultMessage(String type, String title, String description, boolean popupMode);
50  
51      /**
52       * Adds a result message to the stage result.
53       * 
54       * @param type
55       *            the message type
56       * @param title
57       *            the title of the message
58       * @param description
59       *            the description of the message
60       * @param mode
61       *            the mode
62       */
63      public void addResultMessage(String type, String title, String description, String mode);
64  
65      /**
66       * Add a new result to the stage results.
67       * 
68       * @param resultName
69       *            the name of the result
70       * @param resultValue
71       *            the result value
72       */
73      public void addStageResult(String resultName, Object resultValue);
74  
75      /**
76       * @return the language of the current context
77       */
78      public String getLanguage();
79  
80      /**
81       * Inspector for the DIFRequest object
82       * 
83       * @return the IDIFRequest
84       */
85      public IDIFRequest getRequest();
86  
87      /**
88       * Inspector for the 'resultMessage' attribute.
89       * 
90       * @return the resultMessage value
91       */
92      public ResultMessage getResultMessage();
93  
94      /**
95       * Inspector for the session object.
96       * 
97       * @return the session
98       */
99      public IDIFSession getSession();
100 
101     /**
102      * Inspector for the current stage
103      * 
104      * @return the current stage
105      */
106     public String getStage();
107 
108     /**
109      * Inspector for the stage results.
110      * 
111      * @return the stage results map
112      */
113     public Map<String, Object> getStageResults();
114 
115     /**
116      * Inspector for the 'temporaryAttributes' attribute.
117      * 
118      * @return the temporaryAttributes value
119      */
120     public Map<String, Object> getTemporaryAttributes();
121 
122     /**
123      * Inspector for the view.
124      * 
125      * @return the ViewObject.
126      */
127     public ViewObject getView();
128 
129     /**
130      * Handles the redirection.
131      */
132     public void handleRedirection();
133 
134     /**
135      * Inspector for the redirection flag.
136      * 
137      * @return T if redirection is scheduled, F otherwise
138      */
139     public boolean hasRedirection();
140 
141     /**
142      * Sets the redirection stage.
143      * 
144      * @param newStage
145      *            the stage to redirect to
146      */
147     public void redirectTo(String newStage);
148 
149     /**
150      * Sets the redirection stage.
151      * 
152      * @param newStage
153      *            the stage to redirect to
154      * @param allowRedirectToSameStage
155      *            if T allows redirect to same stage to be set
156      */
157     public void redirectTo(String newStage, boolean allowRedirectToSameStage);
158 
159     /**
160      * Sets the redirection stage.
161      * 
162      * @param newStage
163      *            the stage to redirect to
164      * @param redirectionParameters
165      *            the redirection parameters
166      */
167     public void redirectTo(String newStage, Map<String, Object> redirectionParameters);
168 
169     /**
170      * Sets the redirection stage.
171      * 
172      * @param allowRedirectToSameStage
173      *            if T allows redirect to same stage to be set
174      * @param newStage
175      *            the stage to redirect to
176      * @param redirectionParameters
177      *            the redirection parameters
178      */
179     public void redirectTo(String newStage, Map<String, Object> redirectionParameters, boolean allowRedirectToSameStage);
180 
181     /**
182      * Sets the redirection stage.
183      * 
184      * @param newStage
185      *            the stage to redirect to
186      * @param redirectionParameters
187      *            the redirection parameters
188      */
189     public void redirectTo(String newStage, String redirectionParameters);
190 
191     /**
192      * Sets the redirection stage.
193      * 
194      * @param allowRedirectToSameStage
195      *            if T allows redirect to same stage to be set
196      * @param newStage
197      *            the stage to redirect to
198      * @param redirectionParameters
199      *            the redirection parameters
200      */
201     public void redirectTo(String newStage, String redirectionParameters, boolean allowRedirectToSameStage);
202 
203     /**
204      * Report an issue to the {@link IUsageIssuesManager}
205      * 
206      * @param uID
207      *            the unique identifier for this contribution. for recurring errors not to be added repeatedly
208      * @param type
209      *            the issue type
210      * @param issueDescription
211      */
212     public void reportIssue(String uID, IssueType type, String issueDescription);
213 
214     /**
215      * Report an issue to the {@link IUsageIssuesManager}
216      * 
217      * @param uID
218      *            the unique identifier for this contribution. for recurring errors not to be added repeatedly
219      * @param type
220      *            the issue type
221      * @param issueDescription
222      * @param exception
223      *            the raised exception
224      */
225     public void reportIssue(String uID, IssueType type, String issueDescription, Exception exception);
226 
227     /**
228      * Report an issue to the {@link IUsageIssuesManager}
229      * 
230      * @param uID
231      *            the unique identifier for this contribution. for recurring errors not to be added repeatedly
232      * @param type
233      *            the issue type
234      * @param issueDescription
235      * @param exception
236      *            the raised exception
237      * @param showStackTrace
238      *            if the stack trace should be generated and attached to the issue description
239      */
240     public void reportIssue(String uID, IssueType type, String issueDescription, Exception exception,
241             boolean showStackTrace);
242 
243     /**
244      * Report an issue to the {@link IUsageIssuesManager}
245      * 
246      * @param issue
247      *            the issue descriptor
248      */
249     public void reportIssue(UsageIssue issue);
250 
251     /**
252      * Modifier for the DIFRequest Object
253      * 
254      * @param difRequest
255      *            the Original DifRequest
256      */
257     /* VALIDATE: Luis: Check if this setter should exist. */
258     public void setRequest(IDIFRequest difRequest);
259 
260     /**
261      * Modifier for the session object.
262      * 
263      * @param session
264      *            the session to set
265      */
266     public void setSession(IDIFSession session);
267 
268     /**
269      * Modifier for the current stage
270      * 
271      * @param stage
272      *            the stage to set
273      */
274     public void setStage(String stage);
275 
276     /**
277      * Modifier for the stage results.
278      * 
279      * @param results
280      *            the results to set
281      */
282     public void setStageResults(Map<String, Object> results);
283 
284     /**
285      * Modifier for the 'temporaryAttributes' attribute.
286      * 
287      * @param temporaryAttributes
288      *            the new temporaryAttributes value to set
289      */
290     public void setTemporaryAttributes(Map<String, Object> temporaryAttributes);
291 
292     /**
293      * Modifier for the view.
294      * 
295      * @param view
296      *            the ViewObject to set
297      */
298     public void setView(ViewObject view);
299 
300 }