/** * Saves entity field * * @return original TargetList record * @throws Exception */ private TargetList saveEntity() throws Exception { TargetList originalTargetList = null; if (targetList.getId() == null) { UserUtil.permissionCheck("create_targetList"); } else { UserUtil.permissionCheck("update_targetList"); originalTargetList = baseService.getEntityById(TargetList.class, targetList.getId()); targetList.setTargets(originalTargetList.getTargets()); targetList.setContacts(originalTargetList.getContacts()); targetList.setLeads(originalTargetList.getLeads()); targetList.setUsers(originalTargetList.getUsers()); targetList.setAccounts(originalTargetList.getAccounts()); } User assignedTo = null; if (this.getAssignedToID() != null) { assignedTo = userService.getEntityById(User.class, this.getAssignedToID()); } targetList.setAssigned_to(assignedTo); User owner = null; if (this.getOwnerID() != null) { owner = userService.getEntityById(User.class, this.getOwnerID()); } targetList.setOwner(owner); super.updateBaseInfo(targetList); return originalTargetList; }
/** * Gets the related accounts. * * @return null */ public String relateTargetListAccount() throws Exception { targetList = baseService.getEntityById(TargetList.class, id); Set<Account> accounts = targetList.getAccounts(); Iterator<Account> accountIterator = accounts.iterator(); long totalRecords = accounts.size(); ListAccountAction.getListJson(accountIterator, totalRecords, null, false); return null; }