From f157b9694fddacb49e87cafad3764969345c9a95 Mon Sep 17 00:00:00 2001 From: Josef Rokos Date: Wed, 16 Jul 2014 14:00:49 +0200 Subject: [PATCH] =?UTF-8?q?Implementov=C3=A1no=20schvalov=C3=A1n=C3=AD=20s?= =?UTF-8?q?lu=C5=BEebn=C3=ADch=20cest.=20Spole=C4=8Dn=C3=A9=20b=C3=A1ze=20?= =?UTF-8?q?pro=20pr=C3=A1ci=20s=20po=C5=BEadavky=20na=20servisn=C3=AD=20vr?= =?UTF-8?q?stv=C4=9B=20a=20pro=20taby=20na=20UI.=20refs=20#108?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../requirement/RequirementServiceImpl.java | 13 +++++------ .../ui/requirement/RequirementSubpage.java | 15 +++++++----- .../requirement/TripRequirementListAll.java | 23 +++++++------------ .../TripRequirementListCentre.java | 6 ++--- .../TripRequirementListWorkgroup.java | 22 ++++++++---------- 5 files changed, 34 insertions(+), 45 deletions(-) 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; - } - }