4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
UserGroups.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: UserGroups.java
5  * Description: Backbean for page with administration of user groups
6  */
7 
8 /**
9  * @file UserGroups.java
10  *
11  * @brief Backbean for page with administration of user groups
12  */
13 
14 package cz.vutbr.fit.knot.annotations.web;
15 
18 import java.io.Serializable;
19 import java.util.List;
20 import javax.faces.bean.ManagedBean;
21 import javax.faces.bean.SessionScoped;
22 import javax.faces.component.html.HtmlDataTable;
23 
24 /**
25  * Backbean for page with administration of user groups
26  *
27  * @brief Backbean for administration of user groups
28  * @author idytrych
29  */
30 @ManagedBean
31 @SessionScoped
32 public class UserGroups implements Serializable {
33  /**
34  * Table with user groups
35  */
36  private HtmlDataTable listTable;
37  /**
38  * User group selected in the table
39  */
41 
42  /**
43  * Constructor
44  */
45  public UserGroups() {
46  this.userGroup = new UserGroup();
47  }
48 
49  /**
50  * Gets user group selected in the table
51  *
52  * @return Returns user group selected in the table
53  */
55  return userGroup;
56  }
57 
58  /**
59  * Sets user group selected in the table
60  *
61  * @param userGroup
62  */
64  this.userGroup = userGroup;
65  }
66 
67  /**
68  * Gets table with user groups
69  *
70  * @return Returns table with user groups
71  */
72  public HtmlDataTable getListTable() {
73  return listTable;
74  }
75 
76  /**
77  * Sets table with user groups
78  *
79  * @param listTable Table with user groups
80  */
81  public void setListTable(HtmlDataTable listTable) {
82  this.listTable = listTable;
83  }
84 
85  /**
86  * Gets list of all existing user groups
87  *
88  * @return Returns list of all existing user groups
89  */
90  public List<UserGroup> getUserGroupsList() {
91  @SuppressWarnings("unchecked")
92  List<UserGroup> retList = AppBean.getPersistenceManager().getEntitiesByName("UserGroup");
93 
94  return retList;
95  }
96 
97  /**
98  * Action listener for edit links in table
99  *
100  * @return Returns page outcome to go to editing page
101  */
102  public String actionEdit() {
103  // get selected row from table
104  userGroup = (UserGroup) listTable.getRowData();
105  // pass selected user group through the session
106  SessionManager.getSession().setEditedUG(userGroup);
107  SessionManager.getSession().setFormBackup(null);
108  return "editUG";
109  }
110 
111  /**
112  * Action listener for delete links in table
113  *
114  * @return Returns page outcome to go to deleting page
115  */
116  public String actionDelete() {
117  userGroup = (UserGroup) listTable.getRowData();
118  SessionManager.getSession().setEditedUG(userGroup);
119  return "deleteUG";
120  }
121 } // public class UserGroups
122 
void setListTable(HtmlDataTable listTable)
Definition: UserGroups.java:81
void setUserGroup(UserGroup userGroup)
Definition: UserGroups.java:63
Singleton for storing global variables.
Definition: AppBean.java:47
Class representing user group.
Definition: UserGroup.java:47
Backbean for administration of user groups.
Definition: UserGroups.java:32