Beispiel #1
0
 public List<Department> getDepartmentTags() {
   List<Department> departmentTags = new ArrayList<Department>();
   if (tag.getDepartmentTags() != null && !tag.getDepartmentTags().isEmpty()) {
     departmentTags.addAll(tag.getDepartmentTags());
   }
   return departmentTags;
 }
Beispiel #2
0
 public List<Position> getPositionTags() {
   List<Position> positionTags = new ArrayList<Position>();
   if (tag.getPositionTags() != null && !tag.getPositionTags().isEmpty()) {
     positionTags.addAll(tag.getPositionTags());
   }
   return positionTags;
 }
Beispiel #3
0
 public List<Contact> getContactTags() {
   List<Contact> contactTags = new ArrayList<Contact>();
   if (tag.getContactTags() != null && !tag.getContactTags().isEmpty()) {
     contactTags.addAll(tag.getContactTags());
   }
   return contactTags;
 }
Beispiel #4
0
 public List<Organization> getOrganizationTags() {
   List<Organization> organizationTags = new ArrayList<Organization>();
   if (tag.getOrganizationTags() != null && !tag.getOrganizationTags().isEmpty()) {
     organizationTags.addAll(tag.getOrganizationTags());
   }
   return organizationTags;
 }
Beispiel #5
0
  /**
   * 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;
  }
Beispiel #6
0
  /**
   * 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;
  }
Beispiel #7
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;
  }
Beispiel #8
0
  /**
   * 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;
  }
Beispiel #9
0
  /** Delete tag. */
  public void deleteEntity(Tag tag) {
    // for Position tracking
    tag.getPositionTags().clear();
    tag.getContactTags().clear();
    trackPositionChanges(tag);
    trackContactChanges(tag);

    tagDAO.delete(tag);
  }
Beispiel #10
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(), ""));
       }
     }
   }
 }
Beispiel #11
0
 public void setDepartmentTags(List<Department> departmentTags) {
   Set<Department> result = new HashSet<Department>();
   if (departmentTags != null && !departmentTags.isEmpty()) {
     result.addAll(departmentTags);
   }
   tag.setDepartmentTags(result);
 }
Beispiel #12
0
 public void setOrganizationTags(List<Organization> organizationTags) {
   Set<Organization> result = new HashSet<Organization>();
   if (organizationTags != null && !organizationTags.isEmpty()) {
     result.addAll(organizationTags);
   }
   tag.setOrganizationTags(result);
 }
Beispiel #13
0
 public void setPositionTags(List<Position> positionTags) {
   Set<Position> result = new HashSet<Position>();
   if (positionTags != null && !positionTags.isEmpty()) {
     result.addAll(positionTags);
   }
   tag.setPositionTags(result);
 }
Beispiel #14
0
 public void setContactTags(List<Contact> contactTags) {
   Set<Contact> result = new HashSet<Contact>();
   if (contactTags != null && !contactTags.isEmpty()) {
     result.addAll(contactTags);
   }
   tag.setContactTags(result);
 }
Beispiel #15
0
  /**
   * 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;
  }
Beispiel #16
0
 public void setContacts(Set<Contact> contacts) {
   tag.setContactTags(contacts);
 }
Beispiel #17
0
 public Set<Contact> getContacts() {
   return tag.getContactTags();
 }
Beispiel #18
0
 public String addContact() {
   tag.getContactTags().add(getSelectedContact());
   return NavigationResults.EDIT;
 }
Beispiel #19
0
 public Date getInsertDate() {
   return tag.getInsertDate();
 }
Beispiel #20
0
 public Set<Position> getPosition() {
   return tag.getPositionTags();
 }
Beispiel #21
0
 public void setOwnerId(Integer ownerId) {
   tag.setOwnerId(ownerId);
 }
Beispiel #22
0
 public Integer getDepartmentId() {
   return tag.getDepartmentId();
 }
Beispiel #23
0
 public void setUpdateDate(Date updateDate) {
   tag.setUpdateDate(updateDate);
 }
Beispiel #24
0
 public Date getUpdateDate() {
   return tag.getUpdateDate();
 }
Beispiel #25
0
 public void setInsertDate(Date insertDate) {
   tag.setInsertDate(insertDate);
 }
Beispiel #26
0
 public String deleteContact() {
   final UIData table = (UIData) FacesUtils.getComponent("tag:contacts");
   final Contact toDelete = (Contact) table.getRowData();
   tag.getContactTags().remove(toDelete);
   return NavigationResults.EDIT;
 }
Beispiel #27
0
 public String addPosition() {
   tag.getPositionTags().add(getSelectedPosition());
   return NavigationResults.EDIT;
 }
Beispiel #28
0
 public Integer getOwnerId() {
   return tag.getOwnerId();
 }
Beispiel #29
0
 public void setPosition(Set<Position> positions) {
   tag.setPositionTags(positions);
 }
Beispiel #30
0
 public void setDepartmentId(Integer departmentId) {
   tag.setDepartmentId(departmentId);
 }