View Javadoc

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