Refaktorováno přidávání záznamů požadavků.

multitenant
Josef Rokos 10 years ago
parent e9254b7ad6
commit f26e5e12c9

@ -45,7 +45,18 @@ public abstract class RequirementBaseServiceImpl<T extends RequirementBase> exte
@Override @Override
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void add(T entity) { public void add(T entity) {
Workgroup reqWorkgroup = null;
for (Workgroup w : workgroupService.getUserWorkgroups(getLoggedInUser())) {
if (workgroupService.getMembers(entity.getCentre()).contains(w)) {
reqWorkgroup = w;
}
}
entity.setWorkgroup(reqWorkgroup);
entity.setNumser(this.getNumberSerie());
super.add(entity); super.add(entity);
this.sendToApprovers(entity); this.sendToApprovers(entity);

@ -33,7 +33,6 @@ public class RequirementServiceImpl extends
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')") @PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void add(Requirement entity) { public void add(Requirement entity) {
entity.setNumser(this.getNumberSerie());
super.add(entity); super.add(entity);
} }
} }

@ -3,7 +3,6 @@ package info.bukova.isspst.services.requirement;
import info.bukova.isspst.Constants; import info.bukova.isspst.Constants;
import info.bukova.isspst.data.RequirementState; import info.bukova.isspst.data.RequirementState;
import info.bukova.isspst.data.TripRequirement; import info.bukova.isspst.data.TripRequirement;
import info.bukova.isspst.data.Workgroup;
import info.bukova.isspst.services.LazyLoader; import info.bukova.isspst.services.LazyLoader;
import info.bukova.isspst.services.workgroups.WorkgroupService; import info.bukova.isspst.services.workgroups.WorkgroupService;
@ -36,14 +35,6 @@ public class TripRequirementServiceImpl extends RequirementBaseServiceImpl<TripR
@Transactional @Transactional
@PreAuthorize("hasPermission(this, 'PERM_ADD')") @PreAuthorize("hasPermission(this, 'PERM_ADD')")
public void add(TripRequirement entity) { public void add(TripRequirement entity) {
Workgroup reqWorkgroup = null;
for (Workgroup w : workgroupService.getUserWorkgroups(getLoggedInUser())) {
if (workgroupService.getMembers(entity.getCentre()).contains(w)) {
reqWorkgroup = w;
}
}
entity.setWorkgroup(reqWorkgroup);
entity.setNumser(getNumberSerie());
super.add(entity); super.add(entity);
} }

Loading…
Cancel
Save