Exemplo n.º 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;
 }
Exemplo n.º 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(), ""));
       }
     }
   }
 }
Exemplo n.º 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;
  }
Exemplo n.º 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);
  }
Exemplo n.º 5
0
 public Set<Position> getPosition() {
   return tag.getPositionTags();
 }
Exemplo n.º 6
0
 public String addPosition() {
   tag.getPositionTags().add(getSelectedPosition());
   return NavigationResults.EDIT;
 }
Exemplo n.º 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;
 }
Exemplo n.º 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;
 }