예제 #1
0
 public List<Position> getPositionTags() {
   List<Position> positionTags = new ArrayList<Position>();
   if (tag.getPositionTags() != null && !tag.getPositionTags().isEmpty()) {
     positionTags.addAll(tag.getPositionTags());
   }
   return positionTags;
 }
예제 #2
0
 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(), ""));
       }
     }
   }
 }
예제 #3
0
  /**
   * 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;
  }
예제 #4
0
  /** Delete tag. */
  public void deleteEntity(Tag tag) {
    // for Position tracking
    tag.getPositionTags().clear();
    tag.getContactTags().clear();
    trackPositionChanges(tag);
    trackContactChanges(tag);

    tagDAO.delete(tag);
  }
예제 #5
0
 public Set<Position> getPosition() {
   return tag.getPositionTags();
 }
예제 #6
0
 public String addPosition() {
   tag.getPositionTags().add(getSelectedPosition());
   return NavigationResults.EDIT;
 }
예제 #7
0
 /**
  * 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;
 }
예제 #8
0
 public String deletePosition() {
   final UIData table = (UIData) FacesUtils.getComponent("tag:positions");
   final Position toDelete = (Position) table.getRowData();
   tag.getPositionTags().remove(toDelete);
   return NavigationResults.EDIT;
 }