View Javadoc

1   package de.tivsource.page.admin.actions.locations.feedbackoption;
2   
3   import org.apache.logging.log4j.LogManager;
4   import org.apache.logging.log4j.Logger;
5   import org.apache.struts2.convention.annotation.Action;
6   import org.apache.struts2.convention.annotation.Actions;
7   import org.apache.struts2.convention.annotation.Result;
8   import org.apache.struts2.tiles.annotation.TilesDefinition;
9   import org.apache.struts2.tiles.annotation.TilesDefinitions;
10  import org.apache.struts2.tiles.annotation.TilesPutAttribute;
11  
12  import de.tivsource.ejb3plugin.InjectEJB;
13  import de.tivsource.page.admin.actions.EmptyAction;
14  import de.tivsource.page.dao.feedback.FeedbackOptionDaoLocal;
15  import de.tivsource.page.entity.feedback.FeedbackOption;
16  
17  /**
18   * 
19   * @author Marc Michele
20   *
21   */
22  @TilesDefinitions({
23    @TilesDefinition(name="feedbackOptionAddForm",  extend = "adminTemplate", putAttributes = {
24      @TilesPutAttribute(name = "meta",       value = "/WEB-INF/tiles/active/meta/chosen.jsp"),
25      @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/locations.jsp"),
26      @TilesPutAttribute(name = "content",    value = "/WEB-INF/tiles/active/view/feedbackoption/add_form.jsp")
27    }),
28    @TilesDefinition(name="feedbackOptionEditForm", extend = "adminTemplate", putAttributes = {
29      @TilesPutAttribute(name = "meta",       value = "/WEB-INF/tiles/active/meta/chosen.jsp"),
30      @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/locations.jsp"),
31      @TilesPutAttribute(name = "content",    value = "/WEB-INF/tiles/active/view/feedbackoption/edit_form.jsp")
32    }),
33    @TilesDefinition(name="feedbackOptionDeleteForm", extend = "adminTemplate", putAttributes = {
34      @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/locations.jsp"),
35      @TilesPutAttribute(name = "content",    value = "/WEB-INF/tiles/active/view/feedbackoption/delete_form.jsp")
36    })
37  })
38  public class FormAction extends EmptyAction {
39  
40  	/**
41  	 * Serial Version UID.
42  	 */
43      private static final long serialVersionUID = -1238481002093007282L;
44  
45      /**
46       * Statischer Logger der Klasse.
47       */
48      private static final Logger LOGGER = LogManager.getLogger(FormAction.class);
49  
50  	@InjectEJB(name="FeedbackOptionDao")
51      private FeedbackOptionDaoLocal feedbackOptionDaoLocal;
52  
53  	private FeedbackOption feedbackOption;
54  
55  	private String uncheckFeedbackOption;
56  
57  	private String lang;
58  
59  	public FeedbackOption getFeedbackOption() {
60          return feedbackOption;
61      }
62  
63  	public void setFeedbackOption(String uncheckFeedbackOption) {
64          this.uncheckFeedbackOption = uncheckFeedbackOption;
65      }
66  
67      public String getLang() {
68          return lang;
69      }
70  
71      public void setLang(String lang) {
72          this.lang = lang;
73      }
74  
75      @Override
76      @Actions({
77          @Action(
78          		value = "editForm", 
79          		results = { @Result(name = "success", type="tiles", location = "feedbackOptionEditForm") }
80          ),
81          @Action(
82          		value = "addForm", 
83          		results = { @Result(name = "success", type="tiles", location = "feedbackOptionAddForm") }
84          ),
85          @Action(
86          		value = "deleteForm", 
87          		results = { @Result(name = "success", type="tiles", location = "feedbackOptionDeleteForm") }
88          )
89      })
90      public String execute() throws Exception {
91      	LOGGER.info("execute() aufgerufen.");
92      	
93      	this.loadPageParameter();
94      	return SUCCESS;
95      }// Ende execute()
96  
97  	private void loadPageParameter() {
98  
99  		if( uncheckFeedbackOption != null && uncheckFeedbackOption != "" && uncheckFeedbackOption.length() > 0) {
100 			feedbackOption = feedbackOptionDaoLocal.findByUuid(uncheckFeedbackOption);
101 		} else {
102 			feedbackOption = new FeedbackOption();
103 		}
104 
105 	}// Ende loadPageParameter()
106 
107 }// Ende class