Search in sources :

Example 11 with Position

use of com.autentia.tnt.businessobject.Position in project TNTConcept by autentia.

the class PositionBean method create.

/**
 * Go to create page
 *
 * @return forward to CREATE page
 */
public String create() {
    position = new Position();
    position.setInsertDate(new Date());
    return NavigationResults.CREATE;
}
Also used : Position(com.autentia.tnt.businessobject.Position) Date(java.util.Date)

Example 12 with Position

use of com.autentia.tnt.businessobject.Position in project TNTConcept by autentia.

the class TagBean method editPositionTags.

/**
 * 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;
}
Also used : Position(com.autentia.tnt.businessobject.Position) HashSet(java.util.HashSet)

Example 13 with Position

use of com.autentia.tnt.businessobject.Position in project TNTConcept by autentia.

the class TagBean method getPositionTagsSelected.

/**
 * Get the list of all positionTags selected
 *
 * @return the list of all positionTags selected
 */
public List<SelectItem> getPositionTagsSelected() {
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    List<Position> refs = this.getPositionTags();
    for (Position ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : Position(com.autentia.tnt.businessobject.Position) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 14 with Position

use of com.autentia.tnt.businessobject.Position in project TNTConcept by autentia.

the class AdvancedSearchContactBean method getAllPositions.

public List<SelectItem> getAllPositions() {
    List<Position> refs = PositionManager.getDefault().getAllEntities(null, new SortCriteria("id"));
    List ret = new ArrayList();
    for (Position ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) ContactPosition(com.autentia.tnt.manager.contacts.advancedsearch.ContactPosition) Position(com.autentia.tnt.businessobject.Position) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList) ArrayList(java.util.ArrayList) List(java.util.List)

Example 15 with Position

use of com.autentia.tnt.businessobject.Position in project TNTConcept by autentia.

the class ContactManager method addOrganizationDepartmentOrPositionByDefault.

public Contact addOrganizationDepartmentOrPositionByDefault(final Contact contact, final Organization organization, final Department department, final Position position) {
    try {
        if (organization != null) {
            Department selectedDepartment = null;
            Position selectedPosition = null;
            if (department == null) {
                final DepartmentSearch departmentSearch = new DepartmentSearch();
                departmentSearch.setName("Indefinido");
                selectedDepartment = DepartmentDAO.getDefault().search(departmentSearch, new SortCriteria("id")).get(0);
            } else {
                selectedDepartment = department;
            }
            if (position == null) {
                final PositionSearch positionSearch = new PositionSearch();
                positionSearch.setName("Indefinido");
                selectedPosition = PositionDAO.getDefault().search(positionSearch, new SortCriteria("id")).get(0);
            } else {
                selectedPosition = position;
            }
            final ContactInfo contactInfo = new ContactInfo();
            contactInfo.setContact(contact);
            contactInfo.setOrganization(organization);
            contactInfo.setDepartment(selectedDepartment);
            contactInfo.setPosition(selectedPosition);
            contact.addContactInfo(contactInfo);
            this.updateEntity(contact);
        }
    } catch (Exception e) {
        log.error("addOrganizationDepartmentOrPositionByDefault - Error ", e);
    }
    return contact;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) PositionSearch(com.autentia.tnt.dao.search.PositionSearch) Department(com.autentia.tnt.businessobject.Department) ContactPosition(com.autentia.tnt.manager.contacts.advancedsearch.ContactPosition) Position(com.autentia.tnt.businessobject.Position) DepartmentSearch(com.autentia.tnt.dao.search.DepartmentSearch) ContactInfo(com.autentia.tnt.businessobject.ContactInfo)

Aggregations

Position (com.autentia.tnt.businessobject.Position)20 ArrayList (java.util.ArrayList)9 SortCriteria (com.autentia.tnt.dao.SortCriteria)7 SelectItem (javax.faces.model.SelectItem)6 PositionSearch (com.autentia.tnt.dao.search.PositionSearch)5 ContactDAO (com.autentia.tnt.dao.hibernate.ContactDAO)3 PositionDAO (com.autentia.tnt.dao.hibernate.PositionDAO)3 AdvancedSearchContactSearch (com.autentia.tnt.dao.search.AdvancedSearchContactSearch)3 HashSet (java.util.HashSet)3 Test (org.junit.Test)3 Department (com.autentia.tnt.businessobject.Department)2 ContactPosition (com.autentia.tnt.manager.contacts.advancedsearch.ContactPosition)2 UIData (javax.faces.component.UIData)2 ContactInfo (com.autentia.tnt.businessobject.ContactInfo)1 DepartmentSearch (com.autentia.tnt.dao.search.DepartmentSearch)1 EntityChange (com.autentia.tnt.tracking.EntityChange)1 EntityChangeDAO (com.autentia.tnt.tracking.hibernate.dao.EntityChangeDAO)1 Date (java.util.Date)1 List (java.util.List)1