4A Server -  2.0
 All Classes Namespaces Files Functions Variables Enumerator
StoryscopesMain.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: StoryscopesMain.java
5  * Description: Backbean for page with administration of StoryScopes
6  */
7 
8 /**
9  * @file StoryscopesMain.java
10  *
11  * @brief Backbean for page with administration of StoryScopes
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 StoryScopes
26  *
27  * @brief Backbean for page with administration of StoryScopes
28  * @author Martin Petr (xpetrm05)
29  */
30 @ManagedBean
31 @SessionScoped
32 public class StoryscopesMain implements Serializable {
33  /**
34  * Table with StoryScopes
35  */
36  private HtmlDataTable listTable;
37  /**
38  * StoryScope from table
39  */
40  private StoryScope storyScope = null;
41 
42 
43  /**
44  * Constructor
45  */
46  public StoryscopesMain(){
47  storyScope = new StoryScope();
48  }
49 
50  /**
51  * Gets actual StoryScope selected in table
52  *
53  * @return Returns actual StoryScope
54  */
56  return storyScope;
57  }
58 
59  /**
60  * Sets actual StoryScope selected in table
61  *
62  * @param storySapce Actual StoryScope
63  */
64  public void setStoryScope(StoryScope storySapce){
65  this.storyScope = storySapce;
66  }
67 
68  /**
69  * Gets table with StoryScopes
70  *
71  * @return Returns table with StoryScopes
72  */
73  public HtmlDataTable getListTable(){
74  return listTable;
75  }
76 
77  /**
78  * Sets table with StoryScopes
79  *
80  * @param listTable Table with StoryScopes
81  */
82  public void setListTable(HtmlDataTable listTable){
83  this.listTable = listTable;
84  }
85 
86  /**
87  * Gets list of all existing StoryScopes
88  *
89  * @return Returns list of all existing StoryScopes
90  */
91  public List<StoryScope> getStoryScopes(){
92  @SuppressWarnings("unchecked")
93  List<StoryScope> retList = AppBean.getPersistenceManager().getEntitiesByName("StoryScope");
94 
95  return retList;
96  }
97 
98  /**
99  * Action listener for edit links in table
100  *
101  * @return Returns page outcome to go to editing page
102  */
103  public String actionEdit() {
104  // get selected row from table
105  storyScope = (StoryScope) listTable.getRowData();
106  // pass selected user through the session
107  SessionManager.getSession().setEditedStoryScope(storyScope);
108  SessionManager.getSession().setFormBackup(null);
109  return "editStoryScope";
110  }
111 
112  /**
113  * Action listener for delete links in table
114  *
115  * @return Returns page outcome to go to deleting page
116  */
117  public String actionDelete() {
118  // get selected row from table
119  storyScope = (StoryScope) listTable.getRowData();
120  SessionManager.getSession().setEditedStoryScope(storyScope);
121  return "deleteStoryScope";
122  }
123 
124  /**
125  * Action listener that show all subscriptions fot actual StoryScope
126  *
127  * @return Returns page outcome to go to subscription page
128  */
129  public String actionShowSubscribed() {
130  storyScope = (StoryScope) listTable.getRowData();
131  SessionManager.getSession().setEditedStoryScope(storyScope);
132  return "subscribed";
133  }
134 }
Backbean for page with administration of StoryScopes.
Class representing StoryScope for needs of SEC Interface.
Definition: StoryScope.java:48
Singleton for storing global variables.
Definition: AppBean.java:47