1 package de.tivsource.page.admin.actions.others.linkentry;
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.common.menuentry.LinkEntry;
15 import de.tivsource.page.dao.linkentry.LinkEntryDaoLocal;
16 import de.tivsource.page.dao.property.PropertyDaoLocal;
17
18
19
20
21
22
23 @TilesDefinitions({
24 @TilesDefinition(name="linkEntryAddForm", extend = "adminTemplate", putAttributes = {
25 @TilesPutAttribute(name = "meta", value = "/WEB-INF/tiles/active/meta/chosen.jsp"),
26 @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/others.jsp"),
27 @TilesPutAttribute(name = "content", value = "/WEB-INF/tiles/active/view/linkentry/add_form.jsp")
28 }),
29 @TilesDefinition(name="linkEntryEditForm", extend = "adminTemplate", putAttributes = {
30 @TilesPutAttribute(name = "meta", value = "/WEB-INF/tiles/active/meta/chosen.jsp"),
31 @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/others.jsp"),
32 @TilesPutAttribute(name = "content", value = "/WEB-INF/tiles/active/view/linkentry/edit_form.jsp")
33 }),
34 @TilesDefinition(name="linkEntryDeleteForm", extend = "adminTemplate", putAttributes = {
35 @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/others.jsp"),
36 @TilesPutAttribute(name = "content", value = "/WEB-INF/tiles/active/view/linkentry/delete_form.jsp")
37 })
38 })
39 public class FormAction extends EmptyAction {
40
41
42
43
44
45 private static final long serialVersionUID = -3199328382352615959L;
46
47
48
49
50 private static final Logger LOGGER = LogManager.getLogger(FormAction.class);
51
52 @InjectEJB(name="LinkEntryDao")
53 private LinkEntryDaoLocal linkEntryDaoLocal;
54
55 @InjectEJB(name="PropertyDao")
56 private PropertyDaoLocal propertyDaoLocal;
57
58 private LinkEntry linkEntry;
59
60 private String uncheckLinkEntry;
61
62 public LinkEntry getLinkEntry() {
63 return linkEntry;
64 }
65
66 public void setLinkEntry(String uncheckLinkEntry) {
67 this.uncheckLinkEntry = uncheckLinkEntry;
68 }
69
70 @Override
71 @Actions({
72 @Action(
73 value = "editForm",
74 results = { @Result(name = "success", type="tiles", location = "linkEntryEditForm") }
75 ),
76 @Action(
77 value = "addForm",
78 results = { @Result(name = "success", type="tiles", location = "linkEntryAddForm") }
79 ),
80 @Action(
81 value = "deleteForm",
82 results = { @Result(name = "success", type="tiles", location = "linkEntryDeleteForm") }
83 )
84 })
85 public String execute() throws Exception {
86 LOGGER.info("execute() aufgerufen.");
87
88 this.loadPageParameter();
89 return SUCCESS;
90 }
91
92 private void loadPageParameter() {
93
94 if( uncheckLinkEntry != null && uncheckLinkEntry != "" && uncheckLinkEntry.length() > 0) {
95 linkEntry = linkEntryDaoLocal.findByUuid(uncheckLinkEntry);
96 } else {
97 linkEntry = new LinkEntry();
98 }
99
100 }
101
102 }