/** * Unselects the entities * * @return the SUCCESS result */ public String unselect() throws ServiceException { Campaign campaign = null; Set<TargetList> targetLists = null; if ("Campaign".equals(this.getRelationKey())) { campaign = campaignService.getEntityById(Campaign.class, Integer.valueOf(this.getRelationValue())); targetLists = campaign.getTargetLists(); } if (this.getSeleteIDs() != null) { String[] ids = seleteIDs.split(","); Collection<TargetList> selectedTargetLists = new ArrayList<TargetList>(); for (int i = 0; i < ids.length; i++) { Integer selectId = Integer.valueOf(ids[i]); A: for (TargetList targetList : targetLists) { if (targetList.getId().intValue() == selectId.intValue()) { selectedTargetLists.add(targetList); break A; } } } targetLists.removeAll(selectedTargetLists); } if ("Campaign".equals(this.getRelationKey())) { campaignService.makePersistent(campaign); } return SUCCESS; }
/** * Selects the entities * * @return the SUCCESS result */ public String select() throws ServiceException { Campaign campaign = null; Set<TargetList> targetLists = null; if ("Campaign".equals(this.getRelationKey())) { campaign = campaignService.getEntityById(Campaign.class, Integer.valueOf(this.getRelationValue())); targetLists = campaign.getTargetLists(); } if (this.getSeleteIDs() != null) { String[] ids = seleteIDs.split(","); for (int i = 0; i < ids.length; i++) { String selectId = ids[i]; targetList = baseService.getEntityById(TargetList.class, Integer.valueOf(selectId)); targetLists.add(targetList); } } if ("Campaign".equals(this.getRelationKey())) { campaignService.makePersistent(campaign); } return SUCCESS; }