public List<Position> getPositionTags() { List<Position> positionTags = new ArrayList<Position>(); if (tag.getPositionTags() != null && !tag.getPositionTags().isEmpty()) { positionTags.addAll(tag.getPositionTags()); } return positionTags; }
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(), "")); } } } }
/** * 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; }
/** Delete tag. */ public void deleteEntity(Tag tag) { // for Position tracking tag.getPositionTags().clear(); tag.getContactTags().clear(); trackPositionChanges(tag); trackContactChanges(tag); tagDAO.delete(tag); }
public Set<Position> getPosition() { return tag.getPositionTags(); }
public String addPosition() { tag.getPositionTags().add(getSelectedPosition()); return NavigationResults.EDIT; }
/** * Delete selected instance of the one-to-many field * * @return forward to the same page */ public String deletePositionTags() { UIData table = (UIData) FacesUtils.getComponent("tag:positionTags"); tag.getPositionTags().remove(table.getRowData()); return null; }
public String deletePosition() { final UIData table = (UIData) FacesUtils.getComponent("tag:positions"); final Position toDelete = (Position) table.getRowData(); tag.getPositionTags().remove(toDelete); return NavigationResults.EDIT; }