4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
WebSession.java
Go to the documentation of this file.
1 /*
2  * Project: Server for annotations sharing
3  * Author: Ing. Jaroslav Dytrych idytrych@fit.vutbr.cz
4  * File: WebSession.java
5  * Description: Class for handling session variables in the web
6  */
7 
8 /**
9  * @file WebSession.java
10  *
11  * @brief Class for handling session variables in the web
12  */
13 
14 package cz.vutbr.fit.knot.annotations.web;
15 
29 import java.util.Iterator;
30 
31 /**
32  * Class for handling session variables in the web
33  *
34  * @brief Class for handling session variables in the web
35  * @author idytrych
36  */
37 public class WebSession {
38  /**
39  * Logged in user
40  */
41  private User loggedUser = null;
42 
43  /**
44  * Edited user group
45  */
46  private UserGroup editedUG = null;
47  /**
48  * Edited user
49  */
50  private User editedUser = null;
51  /**
52  * Edited type of annotation
53  */
54  private AnnotType editedAT = null;
55  /**
56  * Edited attribute of type of annotation
57  */
58  private AnnotTypeAttr editedATA = null;
59  /**
60  * Edited attribute from ontology
61  */
62  private TypeAttrOnto editedTAO = null;
63  /**
64  * Selected type of annotation
65  */
66  private AnnotType selectedAT = null;
67  /**
68  * Selected user group
69  */
70  private UserGroup selectedUG = null;
71  /**
72  * Backup of form data
73  */
74  private Object formBackup = null;
75  /**
76  * Backup of second level form data
77  */
78  private Object secondFormBackup = null;
79  /**
80  * Identification of page from which user came
81  */
82  String cameFrom = null;
83  /**
84  * Edited Story Space
85  */
86  private StoryScope editedStoryScope = null;
87  /**
88  * Edited Subscription
89  */
91  /**
92  * Annotation type address
93  */
94  private String annotationTypeAddress = null;
95  /**
96  * Come from
97  */
98  private String comeFrom = null;
99  /**
100  * Save user login
101  */
102  private String saveUserLogin = null;
103  /**
104  * Save source URI
105  */
106  private String saveSourceUri = null;
107  /**
108  * Save subscription type
109  */
110  private Integer saveSubscriptionType = null;
111 
112  /**
113  * Edited user setting
114  */
115  private Settings editedSetting = null;
116 
117  /**
118  * Edited default setting for user
119  */
121 
122  /**
123  * Saved value of user settings
124  */
125  private String savedValue = null;
126 
127  /**
128  * Saved name of user settings
129  */
130  private String savedName = null;
131 
132  /**
133  * New value of annotation type for user settings
134  */
135  private String newAnnotType = null;
136 
137  /**
138  * Saved document cloner approved server
139  */
141 
142  /**
143  * Saved document drupal authorization approved server
144  */
146 
147  /**
148  * Edited setting for server
149  */
151 
152  /**
153  * Constructor
154  */
155  public WebSession() {
156  }
157 
158  /**
159  * Returns whether user is logged in
160  *
161  * @return If user is logged in, returns true, false otherwise
162  */
163  public boolean isLoggedIn() {
164  return loggedUser != null;
165  }
166 
167  /**
168  * Returns whether user is an administrator
169  *
170  * @return If user is administrator, returns true, false otherwise
171  */
172  public boolean isAdmin() {
173  boolean adm = false;
174  for (Iterator<UserGroup> gIT = loggedUser.getGroups().iterator(); gIT.hasNext();) {
175  UserGroup ug = gIT.next();
176  if (ug.getName().equalsIgnoreCase(Constants.ADMIN_GROUP)) {
177  adm = true;
178  break;
179  }
180  }
181  return adm;
182  } // isAdmin()
183 
184  /**
185  * Sets that user is not logged in
186  */
187  public void setNotLoggedIn() {
188  this.loggedUser = null;
189  }
190 
191  /** Gets logged in user
192  *
193  * @return Returns logged in user
194  */
195  public User getLoggedUser() {
196  return loggedUser;
197  }
198 
199  /**
200  * Sets logged in user
201  *
202  * @param loggedUser Logged in user
203  */
205  this.loggedUser = loggedUser;
206  }
207 
208 
209  /**
210  * Gets edited user group
211  *
212  * @return Returns edited user group
213  */
215  return editedUG;
216  }
217 
218  /**
219  * Sets edited user group
220  *
221  * @param editedUG Edited user group
222  */
224  this.editedUG = editedUG;
225  }
226 
227  /**
228  * Gets edited user
229  *
230  * @return Returns edited user
231  */
232  public User getEditedUser() {
233  return editedUser;
234  }
235 
236  /**
237  * Sets edited user
238  *
239  * @param editedUser Edited user
240  */
242  this.editedUser = editedUser;
243  }
244 
245  /**
246  * Gets edited type of annotation
247  *
248  * @return Returns edited type of annotation
249  */
251  return editedAT;
252  }
253 
254  /**
255  * Sets edited type of annotation
256  *
257  * @param editedAT Edited type of annotation
258  */
260  this.editedAT = editedAT;
261  }
262 
263  /**
264  * Gets attribute of edited type of annotation
265  *
266  * @return Returns edited attribute of type of annotation
267  */
269  return editedATA;
270  }
271 
272  /**
273  * Sets edited attribute of type of annotation
274  *
275  * @param editedATA Edited attribute of type of annotation
276  */
278  this.editedATA = editedATA;
279  }
280 
281  /**
282  * Gets edited attribute from ontology
283  *
284  * @return Returns edited attribute from ontology
285  */
287  return editedTAO;
288  }
289 
290  /**
291  * Sets edited attribute from ontology
292  *
293  * @param editedTAO Edited attribute from ontology
294  */
296  this.editedTAO = editedTAO;
297  }
298 
299  /**
300  * Gets identification of page from which user came
301  *
302  * @return Returns identification of page from which user came
303  */
304  public String getCameFrom() {
305  return cameFrom;
306  }
307 
308  /**
309  * Sets identification of page from which user came
310  *
311  * @param cameFrom Identification of page from which user came
312  */
313  public void setCameFrom(String cameFrom) {
314  this.cameFrom = cameFrom;
315  }
316 
317  /**
318  * Gets selected type of annotation
319  *
320  * @return Returns selected type of annotation
321  */
323  return selectedAT;
324  }
325 
326  /**
327  * Sets selected type of annotation
328  *
329  * @param selectedAT Selected type of annotation
330  */
332  this.selectedAT = selectedAT;
333  }
334 
335  /**
336  * Gets selected user group
337  *
338  * @return Returns selected user group
339  */
341  return selectedUG;
342  }
343 
344  /**
345  * Sets selected user group
346  *
347  * @param selectedUG Selected user group
348  */
350  this.selectedUG = selectedUG;
351  }
352 
353  /**
354  * Gets backup of form data
355  *
356  * @return Returns backup of form data
357  */
358  public Object getFormBackup() {
359  return formBackup;
360  }
361 
362  /**
363  * Sets backup of form data
364  *
365  * @param formBackup Backup of form data
366  */
367  public void setFormBackup(Object formBackup) {
368  this.formBackup = formBackup;
369  }
370 
371  /**
372  * Gets backup of second level form data
373  *
374  * @return Returns backup of second level form data
375  */
376  public Object getSecondFormBackup() {
377  return secondFormBackup;
378  }
379 
380  /**
381  * Sets backup of second level form data
382  *
383  * @param secondFormBackup Backup of second level form data
384  */
385  public void setSecondFormBackup(Object secondFormBackup) {
386  this.secondFormBackup = secondFormBackup;
387  }
388 
389  /**
390  * Gets edited StoryScope
391  *
392  * @return Returns edited StoryScope
393  */
395  return editedStoryScope;
396  }
397 
398  /**
399  * Set edited StoryScope
400  *
401  * @param editedStoryScope Edited StoryScope
402  */
404  this.editedStoryScope = editedStoryScope;
405  }
406 
407  /**
408  * Gets edited subscription
409  *
410  * @return Return edited subscription
411  */
413  return editedSubscription;
414  }
415 
416  /**
417  * Sets edited subscription
418  *
419  * @param editedSubscription Edited subscription
420  */
422  this.editedSubscription = editedSubscription;
423  }
424 
425  /**
426  * Gets annotation type address
427  *
428  * @return Annotation type address
429  */
430  public String getAnnotationTypeAddress() {
431  return annotationTypeAddress;
432  }
433 
434  /**
435  * Sets annotation type address
436  *
437  * @param annotationTypeAddress Annotation type address
438  */
440  this.annotationTypeAddress = annotationTypeAddress;
441  }
442 
443  /**
444  * Gets come from
445  *
446  * @return Come from
447  */
448  public String getComeFrom() {
449  return comeFrom;
450  }
451 
452  /**
453  * Sets ome from
454  *
455  * @param comeFrom Come from
456  */
457  public void setComeFrom(String comeFrom) {
458  this.comeFrom = comeFrom;
459  }
460 
461  /**
462  * Gets save source URI
463  *
464  * @return Save source URI
465  */
466  public String getSaveSourceUri() {
467  return saveSourceUri;
468  }
469 
470  /**
471  * Sets save source URI
472  *
473  * @param saveSourceUri Save source URI
474  */
475  public void setSaveSourceUri(String saveSourceUri) {
476  this.saveSourceUri = saveSourceUri;
477  }
478 
479  /**
480  * Gets save subscription type
481  *
482  * @return Save subscription type
483  */
484  public Integer getSaveSubscriptionType() {
485  return saveSubscriptionType;
486  }
487 
488  /**
489  * Sets save subscription type
490  *
491  * @param saveSubscriptionType Save subscription type
492  */
494  this.saveSubscriptionType = saveSubscriptionType;
495  }
496 
497  /**
498  * Gets save user login
499  *
500  * @return Save user login
501  */
502  public String getSaveUserLogin() {
503  return saveUserLogin;
504  }
505 
506  /**
507  * Sets save user login
508  *
509  * @param saveUserLogin Save user login
510  */
511  public void setSaveUserLogin(String saveUserLogin) {
512  this.saveUserLogin = saveUserLogin;
513  }
514 
515  /**
516  * Gets edited user setting
517  *
518  * @return Returns edited user setting
519  */
521  return editedSetting;
522  }
523 
524  /**
525  * Sets edited user setting
526  *
527  * @param editedSetting Edited user setting
528  */
530  this.editedSetting = editedSetting;
531  }
532 
533  /**
534  * Gets edited default setting for user
535  *
536  * @return Returns edited default setting for user
537  */
539  return editedDefaultSetting;
540  }
541 
542  /**
543  * Sets edited default setting for user
544  *
545  * @param editedDefaultSetting Edited default setting for user
546  */
548  this.editedDefaultSetting = editedDefaultSetting;
549  }
550 
551  /**
552  * Gets saved value of user settings
553  *
554  * @return Returns saved value of user settings
555  */
556  public String getSavedValue() {
557  return savedValue;
558  }
559 
560  /**
561  * Sets value of user settings for save
562  *
563  * @param savedValue value of user settings for save
564  */
565  public void setSavedValue(String savedValue) {
566  this.savedValue = savedValue;
567  }
568 
569  /**
570  * Gets saved name of user settings
571  *
572  * @return Returns saved name of user settings
573  */
574  public String getSavedName() {
575  return savedName;
576  }
577 
578  /**
579  * Sets name of user settings for save
580  *
581  * @param savedName name of user settings for save
582  */
583  public void setSavedName(String savedName) {
584  this.savedName = savedName;
585  }
586 
587  /**
588  * Gets new value of annotation type for user settings
589  *
590  * @return Returns new value of annotation type for user settings
591  */
592  public String getNewAnnotType() {
593  return newAnnotType;
594  }
595 
596  /**
597  * Sets new value of annotation type for user settings
598  *
599  * @param newAnnotType new value of annotation type for user settings
600  */
601  public void setNewAnnotType(String newAnnotType) {
602  this.newAnnotType = newAnnotType;
603  }
604 
605  /**
606  * Gets actual document cloner approved server
607  *
608  * @return value of actual document cloner approved server
609  */
611  return actualClonerServer;
612  }
613 
614  /**
615  * Sets actual document cloner approved server
616  *
617  * @param actualClonerServer new value of actual document cloner approved server
618  */
620  this.actualClonerServer = actualClonerServer;
621  }
622 
623  /**
624  * Gets actual drupal authorization approved server
625  *
626  * @return value of actual drupal authorization approved server
627  */
629  return actualDrupAuthServer;
630  }
631 
632  /**
633  * Sets actual drupal authorization approved server
634  *
635  * @param actualDrupAuthServer new value of actual drupal authorization approved server
636  */
638  this.actualDrupAuthServer = actualDrupAuthServer;
639  }
640 
641  /**
642  * Gets actual edited setting for server
643  *
644  * @return value of actual edited setting for server
645  */
647  return actualServerSetting;
648  }
649 
650  /**
651  * Sets actual edited setting for server
652  *
653  * @param actualServerSetting new value of actual edited setting for server
654  */
656  this.actualServerSetting = actualServerSetting;
657  }
658 
659 } // public class WebSession
void setEditedDefaultSetting(DefaultSettings editedDefaultSetting)
Class representing attribute of unknown type of annotation.
Class representing parameter of server settings.
void setEditedSubscription(SubscribedItem editedSubscription)
void setEditedATA(AnnotTypeAttr editedATA)
Class representing attribute of type of annotation.
Class for handling session variables in the web.
Definition: WebSession.java:37
void setSaveSubscriptionType(Integer saveSubscriptionType)
Class representing StoryScope for needs of SEC Interface.
Definition: StoryScope.java:48
Class representing approved drupal authentization server.
void setActualServerSetting(ServerSetting actualServerSetting)
void setEditedTAO(TypeAttrOnto editedTAO)
Class representing user group.
Definition: UserGroup.java:47
Class representing parameter of user settings.
Definition: Settings.java:45
void setActualDrupAuthServer(DrupAuthServer actualDrupAuthServer)
void setSecondFormBackup(Object secondFormBackup)
Class representing approved document clone server.
void setSaveUserLogin(String saveUserLogin)
void setActualClonerServer(DocClonerServer actualClonerServer)
Class representing type of annotation.
Definition: AnnotType.java:58
Class representing item of subscripted or unsubscripted sources list.
Class representing user.
Definition: User.java:51
Class representing parameter of default user settings.
void setNewAnnotType(String newAnnotType)
void setEditedStoryScope(StoryScope editedStoryScope)
void setAnnotationTypeAddress(String annotationTypeAddress)
void setSelectedUG(UserGroup selectedUG)
void setSelectedAT(AnnotType selectedAT)
void setEditedSetting(Settings editedSetting)
void setSaveSourceUri(String saveSourceUri)