1 package de.tivsource.page.admin.actions.others.vacancy;
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.vacancy.VacancyDaoLocal;
12 import de.tivsource.page.entity.vacancy.Vacancy;
13
14
15
16
17
18
19 public class DeleteAction extends EmptyAction {
20
21
22
23
24 private static final long serialVersionUID = 3911634387524501176L;
25
26
27
28
29 private static final Logger LOGGER = LogManager.getLogger(DeleteAction.class);
30
31 @InjectEJB(name="VacancyDao")
32 private VacancyDaoLocal vacancyDaoLocal;
33
34 private Vacancy vacancy;
35
36 public Vacancy getVacancy() {
37 return vacancy;
38 }
39
40 public void setVacancy(Vacancy vacancy) {
41 this.vacancy = vacancy;
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 = "vacancyDeleteForm"),
51 @Result(name = "error", type="tiles", location = "vacancyDeleteError")
52 }
53 )
54 })
55 public String execute() throws Exception {
56 LOGGER.info("execute() aufgerufen.");
57
58 if(vacancy != null) {
59 Vacancy dbVacancy = vacancyDaoLocal.findByUuid(vacancy.getUuid());
60 vacancyDaoLocal.delete(dbVacancy);
61 return SUCCESS;
62 }
63 else {
64 return ERROR;
65 }
66
67
68 }
69
70 }