View Javadoc

1   package de.tivsource.page.admin.actions.others.message;
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.message.MessageDaoLocal;
15  import de.tivsource.page.entity.message.Message;
16  
17  /**
18   * 
19   * @author Marc Michele
20   *
21   */
22  @TilesDefinitions({
23    @TilesDefinition(name="messageDeleteForm",  extend = "adminTemplate", putAttributes = {
24      @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/others.jsp"),
25      @TilesPutAttribute(name = "content",    value = "/WEB-INF/tiles/active/view/message/delete_form.jsp")
26    })
27  })
28  public class FormAction extends EmptyAction {
29  
30  	/**
31  	 * Serial Version UID.
32  	 */
33      private static final long serialVersionUID = 4505856166481245798L;
34  
35      /**
36       * Statischer Logger der Klasse.
37       */
38      private static final Logger LOGGER = LogManager.getLogger(FormAction.class);
39  
40      @InjectEJB(name="MessageDao")
41      private MessageDaoLocal messageDaoLocal;
42  
43  	private Message message;
44  
45  	private String uncheckMessage;
46  
47  	public Message getMessage() {
48          return message;
49      }
50  
51  	public void setMessage(String uncheckMessage) {
52          this.uncheckMessage = uncheckMessage;
53      }
54  
55      @Override
56      @Actions({
57          @Action(
58          		value = "deleteForm", 
59          		results = { @Result(name = "success", type="tiles", location = "messageDeleteForm") }
60          )
61      })
62      public String execute() throws Exception {
63      	LOGGER.info("execute() aufgerufen.");
64      	LOGGER.info("Message UUID: " + uncheckMessage);
65      	this.loadPageParameter();
66      	return SUCCESS;
67      }// Ende execute()
68  
69  	private void loadPageParameter() {
70  
71  		if( uncheckMessage != null && uncheckMessage != "" && uncheckMessage.length() > 0) {
72  		    message = messageDaoLocal.findByUuid(uncheckMessage);
73  		} 
74  
75  	}// Ende loadPageParameter()
76  	
77  }// Ende class