1 package de.tivsource.page.admin.actions.locations.location;
2
3
4 import org.apache.logging.log4j.LogManager;
5 import org.apache.logging.log4j.Logger;
6 import org.apache.struts2.convention.annotation.Action;
7 import org.apache.struts2.convention.annotation.Actions;
8 import org.apache.struts2.convention.annotation.Result;
9 import org.apache.struts2.tiles.annotation.TilesDefinition;
10 import org.apache.struts2.tiles.annotation.TilesDefinitions;
11 import org.apache.struts2.tiles.annotation.TilesPutAttribute;
12
13 import de.tivsource.ejb3plugin.InjectEJB;
14 import de.tivsource.page.admin.actions.EmptyAction;
15 import de.tivsource.page.dao.location.LocationDaoLocal;
16 import de.tivsource.page.entity.location.Location;
17
18
19
20
21
22
23 @TilesDefinitions({
24 @TilesDefinition(name="locationOverview", extend = "adminTemplate", putAttributes = {
25 @TilesPutAttribute(name = "meta", value = "/WEB-INF/tiles/active/meta/default.jsp"),
26 @TilesPutAttribute(name = "navigation", value = "/WEB-INF/tiles/active/navigation/locations.jsp"),
27 @TilesPutAttribute(name = "content", value = "/WEB-INF/tiles/active/view/location/location_overview.jsp")
28 })
29 })
30 public class OverviewAction extends EmptyAction {
31
32
33
34
35 private static final long serialVersionUID = -4634589509791943416L;
36
37
38
39
40 private static final Logger LOGGER = LogManager.getLogger(OverviewAction.class);
41
42 @InjectEJB(name="LocationDao")
43 private LocationDaoLocal locationDaoLocal;
44
45 private Location location;
46
47 private String uncheckLocation;
48
49 public Location getLocation() {
50 return location;
51 }
52
53 public void setLocationUuid(String location) {
54 this.uncheckLocation = location;
55 }
56
57 @Override
58 @Actions({
59 @Action(
60 value = "overview",
61 results = {
62 @Result(name = "success", type="tiles", location = "locationOverview"),
63 @Result(name = "input", type = "redirectAction", location = "index.html"),
64 @Result(name = "error", type="tiles", location = "openingError")
65 }
66 )
67 })
68 public String execute() throws Exception {
69 LOGGER.info("execute() aufgerufen.");
70 this.loadPageParameter();
71 LOGGER.info("Anzahl der OpeningHours: " + location.getOpeningHours().size());
72 return SUCCESS;
73 }
74
75 private void loadPageParameter() {
76
77 if( uncheckLocation != null && uncheckLocation != "" && uncheckLocation.length() > 0) {
78 location = locationDaoLocal.findByUuid(uncheckLocation);
79 }
80
81 }
82
83 }