diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java index b4229ed4..75d0f42a 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java @@ -1,18 +1,18 @@ package info.bukova.isspst.services.requirement; import info.bukova.isspst.data.Requirement; -import info.bukova.isspst.services.AbstractOwnedService; import java.util.Date; import org.springframework.security.access.prepost.PreAuthorize; import org.springframework.transaction.annotation.Transactional; -public class RequirementServiceImpl extends AbstractOwnedService implements RequirementService, RequirementBaseService -{ +public class RequirementServiceImpl extends + RequirementBaseServiceImpl implements RequirementService, + RequirementBaseService { + @Override - protected Requirement createEntity() - { + protected Requirement createEntity() { Requirement entity = new Requirement(); entity.setReqDate(new Date()); @@ -23,8 +23,7 @@ public class RequirementServiceImpl extends AbstractOwnedService im @Override @Transactional @PreAuthorize("hasPermission(this, 'PERM_ADD')") - public void add(Requirement entity) - { + public void add(Requirement entity) { entity.setNumser(this.getNumberSerie()); super.add(entity); } diff --git a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java index 45e06dfc..bf6eee07 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java @@ -1,17 +1,20 @@ package info.bukova.isspst.ui.requirement; -import org.zkoss.bind.annotation.Command; -import org.zkoss.bind.annotation.NotifyChange; - import info.bukova.isspst.data.RequirementBase; -import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.services.requirement.RequirementBaseService; import info.bukova.isspst.ui.ListViewModel; +import org.zkoss.bind.annotation.Command; +import org.zkoss.bind.annotation.NotifyChange; + public class RequirementSubpage extends ListViewModel { - private RequirementBaseService reqService; - + protected RequirementBaseService reqService; + + @SuppressWarnings("unchecked") + public void init() { + reqService = (RequirementBaseService) service; + } @Override protected void loadLazyData(T data) { diff --git a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java index e1bb4f52..0d1262ee 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListAll.java @@ -1,5 +1,11 @@ package info.bukova.isspst.ui.requirement; +import info.bukova.isspst.data.TripRequirement; +import info.bukova.isspst.data.Workgroup; +import info.bukova.isspst.filters.TripRequirementFilter; +import info.bukova.isspst.services.requirement.TripRequirementService; +import info.bukova.isspst.services.workgroups.WorkgroupService; + import java.util.ArrayList; import java.util.List; @@ -8,22 +14,12 @@ import org.zkoss.bind.BindUtils; import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.select.annotation.WireVariable; -import info.bukova.isspst.data.TripRequirement; -import info.bukova.isspst.data.Workgroup; -import info.bukova.isspst.filters.TripRequirementFilter; -import info.bukova.isspst.services.requirement.TripRequirementService; -import info.bukova.isspst.services.users.UserService; -import info.bukova.isspst.services.workgroups.WorkgroupService; -import info.bukova.isspst.ui.ListViewModel; - -public class TripRequirementListAll extends ListViewModel { +public class TripRequirementListAll extends RequirementSubpage { @WireVariable private TripRequirementService tripRequirementService; @WireVariable private WorkgroupService workgroupService; - @WireVariable - private UserService userService; private List allCentres; private List allWorkgroups; @@ -36,6 +32,7 @@ public class TripRequirementListAll extends ListViewModel { allCentres = workgroupService.getCentres(); allWorkgroups = workgroupService.getWorkgroups(); + super.init(); } @Override @@ -55,9 +52,5 @@ public class TripRequirementListAll extends ListViewModel { public List getAllWorkgroups() { return allWorkgroups; } - - public boolean isCanApprove() { - return false; - } } diff --git a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java index 8acd6473..f8833c8a 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListCentre.java @@ -6,19 +6,16 @@ import info.bukova.isspst.filters.TripRequirementFilter; import info.bukova.isspst.services.requirement.TripRequirementService; import info.bukova.isspst.services.users.UserService; import info.bukova.isspst.services.workgroups.WorkgroupService; -import info.bukova.isspst.ui.ListViewModel; import java.util.ArrayList; import java.util.List; import org.springframework.security.access.AccessDeniedException; import org.zkoss.bind.BindUtils; -import org.zkoss.bind.annotation.Command; import org.zkoss.bind.annotation.Init; -import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.zk.ui.select.annotation.WireVariable; -public class TripRequirementListCentre extends ListViewModel { +public class TripRequirementListCentre extends RequirementSubpage { @WireVariable private TripRequirementService tripRequirementService; @@ -36,6 +33,7 @@ public class TripRequirementListCentre extends ListViewModel { dataFilter = new TripRequirementFilter(getFilterTemplate()); myCentres = workgroupService.getUserCentres(userService.getCurrent()); + super.init(); } @Override diff --git a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListWorkgroup.java b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListWorkgroup.java index ce9267a8..d744e0a1 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListWorkgroup.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/TripRequirementListWorkgroup.java @@ -1,5 +1,12 @@ package info.bukova.isspst.ui.requirement; +import info.bukova.isspst.data.TripRequirement; +import info.bukova.isspst.data.Workgroup; +import info.bukova.isspst.filters.TripRequirementFilter; +import info.bukova.isspst.services.requirement.TripRequirementService; +import info.bukova.isspst.services.users.UserService; +import info.bukova.isspst.services.workgroups.WorkgroupService; + import java.util.ArrayList; import java.util.List; @@ -8,15 +15,7 @@ import org.zkoss.bind.BindUtils; import org.zkoss.bind.annotation.Init; import org.zkoss.zk.ui.select.annotation.WireVariable; -import info.bukova.isspst.data.TripRequirement; -import info.bukova.isspst.data.Workgroup; -import info.bukova.isspst.filters.TripRequirementFilter; -import info.bukova.isspst.services.requirement.TripRequirementService; -import info.bukova.isspst.services.users.UserService; -import info.bukova.isspst.services.workgroups.WorkgroupService; -import info.bukova.isspst.ui.ListViewModel; - -public class TripRequirementListWorkgroup extends ListViewModel { +public class TripRequirementListWorkgroup extends RequirementSubpage { @WireVariable private TripRequirementService tripRequirementService; @@ -36,6 +35,7 @@ public class TripRequirementListWorkgroup extends ListViewModel myCentres = workgroupService.getUserCentres(userService.getCurrent()); myWorkgroups = workgroupService.getUserWorkgroups(userService.getCurrent()); + super.init(); } @Override @@ -56,8 +56,4 @@ public class TripRequirementListWorkgroup extends ListViewModel return myWorkgroups; } - public boolean isCanApprove() { - return false; - } - }