1 package de.tivsource.page.reservation.actions;
2
3 import java.util.List;
4
5 import org.apache.logging.log4j.LogManager;
6 import org.apache.logging.log4j.Logger;
7 import org.apache.struts2.convention.annotation.Action;
8 import org.apache.struts2.convention.annotation.Actions;
9 import org.apache.struts2.convention.annotation.Result;
10
11 import de.tivsource.ejb3plugin.InjectEJB;
12 import de.tivsource.page.dao.location.LocationDaoLocal;
13 import de.tivsource.page.dao.page.PageDaoLocal;
14 import de.tivsource.page.dao.property.PropertyDaoLocal;
15 import de.tivsource.page.entity.location.Location;
16 import de.tivsource.page.entity.page.Page;
17
18
19
20
21
22
23 public class IndexAction extends EmptyAction {
24
25
26
27
28 private static final long serialVersionUID = -3953411070248396460L;
29
30
31
32
33 private static final Logger LOGGER = LogManager.getLogger(IndexAction.class);
34
35 @InjectEJB(name="PageDao")
36 private PageDaoLocal pageDaoLocal;
37
38 @InjectEJB(name="PropertyDao")
39 private PropertyDaoLocal propertyDaoLocal;
40
41 @InjectEJB(name="LocationDao")
42 private LocationDaoLocal locationDaoLocal;
43
44 private Page page;
45
46 @Override
47 @Actions({
48 @Action(
49 value = "index",
50 results = {
51 @Result(name = "success", type="tiles", location = "index"),
52 @Result(name = "error", type = "redirectAction", location = "index.html", params={"namespace", "/"})
53 }
54 )
55 })
56 public String execute() throws Exception {
57 LOGGER.info("execute() aufgerufen.");
58
59
60 this.getLanguageFromActionContext();
61
62 page = pageDaoLocal.findByTechnical("reservation");
63
64 boolean contactPageEnabled = propertyDaoLocal.findByKey("reservation.page.enabled").getValue().equals("true") ? true : false;
65
66 if(contactPageEnabled) {
67 return SUCCESS;
68 } else {
69 return ERROR;
70 }
71
72 }
73
74 public Page getPage() {
75 return page;
76 }
77
78 public List<Location> getList() {
79 return locationDaoLocal.findAllEventLocation();
80 }
81
82 }