1 package de.tivsource.page.admin.actions.locations.event;
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
9 import de.tivsource.ejb3plugin.InjectEJB;
10 import de.tivsource.page.admin.actions.EmptyAction;
11 import de.tivsource.page.dao.event.EventDaoLocal;
12 import de.tivsource.page.entity.event.Event;
13
14
15
16
17
18
19 public class DeleteAction extends EmptyAction {
20
21
22
23
24 private static final long serialVersionUID = 3232644017754518165L;
25
26
27
28
29 private static final Logger LOGGER = LogManager.getLogger(DeleteAction.class);
30
31 @InjectEJB(name="EventDao")
32 private EventDaoLocal eventDaoLocal;
33
34 private Event event;
35
36 public Event getEvent() {
37 return event;
38 }
39
40 public void setEvent(Event event) {
41 this.event = event;
42 }
43
44 @Override
45 @Actions({
46 @Action(
47 value = "delete",
48 results = {
49 @Result(name = "success", type = "redirectAction", location = "index.html"),
50 @Result(name = "input", type="tiles", location = "eventDeleteForm"),
51 @Result(name = "error", type="tiles", location = "eventDeleteError")
52 }
53 )
54 })
55 public String execute() throws Exception {
56 LOGGER.info("execute() aufgerufen.");
57
58 if(event != null) {
59 Event dbEvent = eventDaoLocal.findByUuid(event.getUuid());
60 eventDaoLocal.delete(dbEvent);
61 return SUCCESS;
62 }
63 else {
64 return ERROR;
65 }
66
67
68 }
69
70 }