Refaktorizace RequirementService.

multitenant
František Přibyl 11 years ago
parent dd4b7a2166
commit 7e87c05d92

@ -9,22 +9,21 @@ import org.zkoss.bind.annotation.NotifyChange;
public class RequirementSubpage<T extends RequirementBase> extends ListViewModel<T> { public class RequirementSubpage<T extends RequirementBase> extends ListViewModel<T> {
protected RequirementBaseService<T> reqService;
@SuppressWarnings("unchecked") @SuppressWarnings("unchecked")
public void init() { private RequirementBaseService<T> getReqService()
reqService = (RequirementBaseService<T>) service; {
return (RequirementBaseService<T>) service;
} }
@Override @Override
protected void loadLazyData(T data) { protected void loadLazyData(T data) {
reqService.loadAuthItems(data); this.getReqService().loadAuthItems(data);
} }
@Command @Command
@NotifyChange("dataBean") @NotifyChange("dataBean")
public void approve() { public void approve() {
reqService.approve(getDataBean()); this.getReqService().approve(getDataBean());
} }
@Override @Override
@ -35,11 +34,9 @@ public class RequirementSubpage<T extends RequirementBase> extends ListViewModel
public boolean isCanApprove() { public boolean isCanApprove() {
if (getDataBean() != null) { if (getDataBean() != null) {
return reqService.canApprove(getDataBean()); return this.getReqService().canApprove(getDataBean());
} }
return false; return false;
} }
} }

@ -32,7 +32,6 @@ public class TripRequirementListAll extends RequirementSubpage<TripRequirement>
allCentres = workgroupService.getCentres(); allCentres = workgroupService.getCentres();
allWorkgroups = workgroupService.getWorkgroups(); allWorkgroups = workgroupService.getWorkgroups();
super.init();
} }
@Override @Override

@ -33,7 +33,6 @@ public class TripRequirementListCentre extends RequirementSubpage<TripRequiremen
dataFilter = new TripRequirementFilter(getFilterTemplate()); dataFilter = new TripRequirementFilter(getFilterTemplate());
myCentres = workgroupService.getUserCentres(userService.getCurrent()); myCentres = workgroupService.getUserCentres(userService.getCurrent());
super.init();
} }
@Override @Override

@ -35,7 +35,6 @@ public class TripRequirementListWorkgroup extends RequirementSubpage<TripRequire
myCentres = workgroupService.getUserCentres(userService.getCurrent()); myCentres = workgroupService.getUserCentres(userService.getCurrent());
myWorkgroups = workgroupService.getUserWorkgroups(userService.getCurrent()); myWorkgroups = workgroupService.getUserWorkgroups(userService.getCurrent());
super.init();
} }
@Override @Override

Loading…
Cancel
Save