public List<Department> getDepartmentTags() { List<Department> departmentTags = new ArrayList<Department>(); if (tag.getDepartmentTags() != null && !tag.getDepartmentTags().isEmpty()) { departmentTags.addAll(tag.getDepartmentTags()); } return departmentTags; }
public List<Position> getPositionTags() { List<Position> positionTags = new ArrayList<Position>(); if (tag.getPositionTags() != null && !tag.getPositionTags().isEmpty()) { positionTags.addAll(tag.getPositionTags()); } return positionTags; }
public List<Contact> getContactTags() { List<Contact> contactTags = new ArrayList<Contact>(); if (tag.getContactTags() != null && !tag.getContactTags().isEmpty()) { contactTags.addAll(tag.getContactTags()); } return contactTags; }
public List<Organization> getOrganizationTags() { List<Organization> organizationTags = new ArrayList<Organization>(); if (tag.getOrganizationTags() != null && !tag.getOrganizationTags().isEmpty()) { organizationTags.addAll(tag.getOrganizationTags()); } return organizationTags; }
/** * Create a new empty instance of the one-to-many field * * @return forward to the same page */ public String editOrganizationTags() { Organization item = new Organization(); if (tag.getOrganizationTags() == null) { tag.setOrganizationTags(new HashSet()); } tag.getOrganizationTags().add(item); return null; }
/** * Create a new empty instance of the one-to-many field * * @return forward to the same page */ public String editDepartmentTags() { Department item = new Department(); if (tag.getDepartmentTags() == null) { tag.setDepartmentTags(new HashSet()); } tag.getDepartmentTags().add(item); return null; }
/** * Create a new empty instance of the one-to-many field * * @return forward to the same page */ public String editPositionTags() { Position item = new Position(); if (tag.getPositionTags() == null) { tag.setPositionTags(new HashSet()); } tag.getPositionTags().add(item); return null; }
/** * Create a new empty instance of the one-to-many field * * @return forward to the same page */ public String editContactTags() { Contact item = new Contact(); if (tag.getContactTags() == null) { tag.setContactTags(new HashSet()); } tag.getContactTags().add(item); return null; }
/** Delete tag. */ public void deleteEntity(Tag tag) { // for Position tracking tag.getPositionTags().clear(); tag.getContactTags().clear(); trackPositionChanges(tag); trackContactChanges(tag); tagDAO.delete(tag); }
private void trackPositionChanges(Tag tag) { // tracking associated Positions for (Position position : tag.getPositionTags()) { Position positionDB = PositionManager.getDefault().getEntityById(position.getId()); if (!positionDB.getTags().contains(tag)) { positionDB .getHistory() .add( PositionManager.getDefault() .getChange(positionDB, PositionManager.FIELD_TAGS, "", tag.getName())); } } // tracking deassociated Positions if (tag.getId() != null) { Tag tagDB = getEntityById(tag.getId()); for (Position positionDB : tagDB.getPositionTags()) { if (!tag.getPositionTags().contains(positionDB)) { positionDB .getHistory() .add( PositionManager.getDefault() .getChange(positionDB, PositionManager.FIELD_TAGS, tag.getName(), "")); } } } }
public void setDepartmentTags(List<Department> departmentTags) { Set<Department> result = new HashSet<Department>(); if (departmentTags != null && !departmentTags.isEmpty()) { result.addAll(departmentTags); } tag.setDepartmentTags(result); }
public void setOrganizationTags(List<Organization> organizationTags) { Set<Organization> result = new HashSet<Organization>(); if (organizationTags != null && !organizationTags.isEmpty()) { result.addAll(organizationTags); } tag.setOrganizationTags(result); }
public void setPositionTags(List<Position> positionTags) { Set<Position> result = new HashSet<Position>(); if (positionTags != null && !positionTags.isEmpty()) { result.addAll(positionTags); } tag.setPositionTags(result); }
public void setContactTags(List<Contact> contactTags) { Set<Contact> result = new HashSet<Contact>(); if (contactTags != null && !contactTags.isEmpty()) { result.addAll(contactTags); } tag.setContactTags(result); }
/** * Save bean and stay on it * * @return forward to list page */ public String save() { doBeforeSave(); if (tag.getId() == null) { manager.insertEntity(tag); } else { manager.updateEntity(tag); } // Calls an after save action String result = doAfterSave(NavigationResults.LIST); // Unselect object tag = null; return result; }
public void setContacts(Set<Contact> contacts) { tag.setContactTags(contacts); }
public Set<Contact> getContacts() { return tag.getContactTags(); }
public String addContact() { tag.getContactTags().add(getSelectedContact()); return NavigationResults.EDIT; }
public Date getInsertDate() { return tag.getInsertDate(); }
public Set<Position> getPosition() { return tag.getPositionTags(); }
public void setOwnerId(Integer ownerId) { tag.setOwnerId(ownerId); }
public Integer getDepartmentId() { return tag.getDepartmentId(); }
public void setUpdateDate(Date updateDate) { tag.setUpdateDate(updateDate); }
public Date getUpdateDate() { return tag.getUpdateDate(); }
public void setInsertDate(Date insertDate) { tag.setInsertDate(insertDate); }
public String deleteContact() { final UIData table = (UIData) FacesUtils.getComponent("tag:contacts"); final Contact toDelete = (Contact) table.getRowData(); tag.getContactTags().remove(toDelete); return NavigationResults.EDIT; }
public String addPosition() { tag.getPositionTags().add(getSelectedPosition()); return NavigationResults.EDIT; }
public Integer getOwnerId() { return tag.getOwnerId(); }
public void setPosition(Set<Position> positions) { tag.setPositionTags(positions); }
public void setDepartmentId(Integer departmentId) { tag.setDepartmentId(departmentId); }