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   
9   import de.tivsource.ejb3plugin.InjectEJB;
10  import de.tivsource.page.admin.actions.EmptyAction;
11  import de.tivsource.page.dao.feedback.FeedbackOptionDaoLocal;
12  import de.tivsource.page.entity.feedback.FeedbackOption;
13  
14  /**
15   * 
16   * @author Marc Michele
17   *
18   */
19  public class DeleteAction extends EmptyAction {
20  
21  	/**
22  	 * Serial Version UID.
23  	 */
24      private static final long serialVersionUID = 904888186996610235L;
25  
26      /**
27       * Statischer Logger der Klasse.
28       */
29      private static final Logger LOGGER = LogManager.getLogger(DeleteAction.class);
30  
31      @InjectEJB(name="FeedbackOptionDao")
32      private FeedbackOptionDaoLocal feedbackOptionDaoLocal;
33  
34      private FeedbackOption feedbackOption;
35  
36      /**
37       * @return the feedbackOption
38       */
39      public FeedbackOption getFeedbackOption() {
40          return feedbackOption;
41      }
42  
43      /**
44       * @param feedbackOption the feedbackOption to set
45       */
46      public void setFeedbackOption(FeedbackOption feedbackOption) {
47          this.feedbackOption = feedbackOption;
48      }
49  
50      @Override
51      @Actions({
52          @Action(
53          		value = "delete", 
54          		results = { 
55          				@Result(name = "success", type = "redirectAction", location = "index.html"),
56          				@Result(name = "input", type="tiles", location = "feedbackOptionDeleteForm"),
57          				@Result(name = "error", type="tiles", location = "feedbackOptionDeleteError")
58          				}
59          )
60      })
61      public String execute() throws Exception {
62      	LOGGER.info("execute() aufgerufen.");
63  
64      	if(feedbackOption != null) {
65      	    FeedbackOption dbFeedbackOption = feedbackOptionDaoLocal.findByUuid(feedbackOption.getUuid());
66      	    feedbackOptionDaoLocal.delete(dbFeedbackOption);
67              return SUCCESS;
68      	}
69      	else {
70      		return ERROR;
71      	}
72      	
73      	
74      }// Ende execute()
75  	
76  }// Ende class