diff --git a/src/main/java/info/bukova/isspst/data/RequirementBase.java b/src/main/java/info/bukova/isspst/data/RequirementBase.java index c8f918fa..fc1854eb 100644 --- a/src/main/java/info/bukova/isspst/data/RequirementBase.java +++ b/src/main/java/info/bukova/isspst/data/RequirementBase.java @@ -26,7 +26,7 @@ public class RequirementBase extends BaseData { private RequirementType type; @OneToMany(cascade = CascadeType.ALL) @LazyCollection(LazyCollectionOption.TRUE) - @OrderBy("WORDER") + @OrderBy("CENTRE, WORDER") private List workflow; @Column(name = "NUMSER", unique = true) private String numser; diff --git a/src/main/java/info/bukova/isspst/data/RequirementType.java b/src/main/java/info/bukova/isspst/data/RequirementType.java index 3f35181b..ce5b3a88 100644 --- a/src/main/java/info/bukova/isspst/data/RequirementType.java +++ b/src/main/java/info/bukova/isspst/data/RequirementType.java @@ -23,7 +23,7 @@ public class RequirementType extends BaseData { private String description; @OneToMany(cascade = CascadeType.ALL, orphanRemoval=true) @LazyCollection(LazyCollectionOption.FALSE) - @OrderBy("WORDER") + @OrderBy("CENTRE, WORDER") private List workflow; public RequirementType() { diff --git a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java index 12158718..aeaf4dc9 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementBaseServiceImpl.java @@ -56,6 +56,7 @@ public abstract class RequirementBaseServiceImpl exte entity.setWorkgroup(reqWorkgroup); entity.setNumser(this.getNumberSerie()); + this.addWorkflow(entity); super.add(entity); @@ -79,12 +80,14 @@ public abstract class RequirementBaseServiceImpl exte } for (Workflow w : entity.getType().getWorkflow()) { - Workflow workflow = new Workflow(); - workflow.setCentre(w.getCentre()); - workflow.setLimit(w.getLimit()); - workflow.setOrder(w.getOrder()); - workflow.setRole(w.getRole()); - entity.getWorkflow().add(workflow); + if ((entity.getWorkgroup() != null && !w.getCentre()) || w.getCentre()) { + Workflow workflow = new Workflow(); + workflow.setCentre(w.getCentre()); + workflow.setLimit(w.getLimit()); + workflow.setOrder(w.getOrder()); + workflow.setRole(w.getRole()); + entity.getWorkflow().add(workflow); + } } } @@ -93,7 +96,6 @@ public abstract class RequirementBaseServiceImpl exte public List getNextApprover(T entity) { T e = (T) dao.getById(entity.getId()); - List users = new ArrayList(); Workgroup wg; Workflow wf = getNextWorkflow(e); 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 32a5e245..d57b2d85 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/RequirementServiceImpl.java @@ -7,8 +7,6 @@ import info.bukova.isspst.data.RequirementState; import java.util.Date; import org.springframework.beans.factory.annotation.Autowired; -import org.springframework.security.access.prepost.PreAuthorize; -import org.springframework.transaction.annotation.Transactional; public class RequirementServiceImpl extends RequirementBaseServiceImpl implements RequirementService, @@ -24,15 +22,8 @@ public class RequirementServiceImpl extends entity.setReqDate(new Date()); entity.setType(reqTypeService.getTypeById(Constants.REQTYPE_ORDER)); entity.setState(RequirementState.NEW); - this.addWorkflow(entity); return entity; } - @Override - @Transactional - @PreAuthorize("hasPermission(this, 'PERM_ADD')") - public void add(Requirement entity) { - super.add(entity); - } } diff --git a/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java b/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java index b274a0f7..975f5248 100644 --- a/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java +++ b/src/main/java/info/bukova/isspst/services/requirement/TripRequirementServiceImpl.java @@ -31,15 +31,8 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl @@ -56,4 +58,10 @@ public class ReqListMyAll extends RequirementSubpage return new ArrayList(); } } + + @GlobalCommand + @NotifyChange({ "dataList", "dataBean", "fullFill" }) + public void reloadRelated() { + this.reload(); + } } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java index b4954d00..91ca4aa7 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyCenters.java @@ -13,7 +13,9 @@ import java.util.List; import org.springframework.security.access.AccessDeniedException; import org.zkoss.bind.BindUtils; +import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.Init; +import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.zk.ui.select.annotation.WireVariable; public class ReqListMyCenters extends RequirementSubpage @@ -56,4 +58,10 @@ public class ReqListMyCenters extends RequirementSubpage return new ArrayList(); } } + + @GlobalCommand + @NotifyChange({ "dataList", "dataBean", "fullFill" }) + public void reloadRelated() { + this.reload(); + } } diff --git a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java index 26856a70..a822fe1e 100644 --- a/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java +++ b/src/main/java/info/bukova/isspst/ui/main/orders/requirements/ReqListMyWorkgroups.java @@ -13,7 +13,9 @@ import java.util.List; import org.springframework.security.access.AccessDeniedException; import org.zkoss.bind.BindUtils; +import org.zkoss.bind.annotation.GlobalCommand; import org.zkoss.bind.annotation.Init; +import org.zkoss.bind.annotation.NotifyChange; import org.zkoss.zk.ui.select.annotation.WireVariable; public class ReqListMyWorkgroups extends RequirementSubpage @@ -56,4 +58,10 @@ public class ReqListMyWorkgroups extends RequirementSubpage return new ArrayList(); } } + + @GlobalCommand + @NotifyChange({ "dataList", "dataBean", "fullFill" }) + public void reloadRelated() { + this.reload(); + } } 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 0f0601d9..ce76f066 100644 --- a/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java +++ b/src/main/java/info/bukova/isspst/ui/requirement/RequirementSubpage.java @@ -30,7 +30,6 @@ public class RequirementSubpage extends ListViewModel this.bigDecimalConverter = new BigDecimalConverter(); } - @SuppressWarnings("unchecked") private RequirementBaseService getReqService() { return (RequirementBaseService) service; diff --git a/src/main/webapp/main/orders/requirements/reqListMy.zul b/src/main/webapp/main/orders/requirements/reqListMy.zul index 6df3ecc8..01c4b7a3 100644 --- a/src/main/webapp/main/orders/requirements/reqListMy.zul +++ b/src/main/webapp/main/orders/requirements/reqListMy.zul @@ -9,7 +9,9 @@ + model="@load(vm.dataList)" + onAfterRender="@command('afterRender')" + selectedIndex="@bind(vm.selIndex)"> - + diff --git a/src/main/webapp/main/orders/requirements/reqListMyAll.zul b/src/main/webapp/main/orders/requirements/reqListMyAll.zul index 4eb3bd58..bef6590d 100644 --- a/src/main/webapp/main/orders/requirements/reqListMyAll.zul +++ b/src/main/webapp/main/orders/requirements/reqListMyAll.zul @@ -11,7 +11,9 @@ vflex="1" hflex="7" selectedItem="@bind(vm.dataBean)" - model="@load(vm.dataList)"> + model="@load(vm.dataList)" + onAfterRender="@command('afterRender')" + selectedIndex="@bind(vm.selIndex)"> - + diff --git a/src/main/webapp/main/orders/requirements/reqListMyCenters.zul b/src/main/webapp/main/orders/requirements/reqListMyCenters.zul index b6aa74ec..5f9e7b5b 100644 --- a/src/main/webapp/main/orders/requirements/reqListMyCenters.zul +++ b/src/main/webapp/main/orders/requirements/reqListMyCenters.zul @@ -11,7 +11,9 @@ vflex="1" hflex="7" selectedItem="@bind(vm.dataBean)" - model="@load(vm.dataList)"> + model="@load(vm.dataList)" + onAfterRender="@command('afterRender')" + selectedIndex="@bind(vm.selIndex)"> - + diff --git a/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul b/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul index 07347d49..f234f5c4 100644 --- a/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul +++ b/src/main/webapp/main/orders/requirements/reqListMyWorkgroups.zul @@ -11,7 +11,9 @@ vflex="1" hflex="7" selectedItem="@bind(vm.dataBean)" - model="@load(vm.dataList)"> + model="@load(vm.dataList)" + onAfterRender="@command('afterRender')" + selectedIndex="@bind(vm.selIndex)"> - +