Search in sources :

Example 16 with Position

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

the class PositionManager method getEntityById.

/**
 * Get position by primary key.
 *
 * @return position selected by id.
 */
public Position getEntityById(int id) {
    Position position = positionDAO.loadById(id);
    position.initChanges();
    return position;
}
Also used : Position(com.autentia.tnt.businessobject.Position)

Example 17 with Position

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

the class PositionManager method updateEntity.

/**
 * Update position.
 */
public void updateEntity(Position position) {
    // get changes for history
    Position changes = position.getChanges();
    // update the entity
    positionDAO.update(position);
    // tracking entity changes
    Position positionHibSession = positionDAO.loadById(position.getId());
    positionHibSession.setChanges(changes);
    this.trackEntityChanges(positionHibSession);
}
Also used : Position(com.autentia.tnt.businessobject.Position)

Example 18 with Position

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

the class DepartmentBean method deletePosition.

public String deletePosition() {
    final UIData table = (UIData) FacesUtils.getComponent("department:positions");
    final Position toDelete = (Position) table.getRowData();
    department.getPositions().remove(toDelete);
    return NavigationResults.EDIT;
}
Also used : Position(com.autentia.tnt.businessobject.Position) UIData(javax.faces.component.UIData)

Example 19 with Position

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

the class DepartmentBean method create.

/**
 * Go to create page
 * @return forward to CREATE page
 */
public String create() {
    department = new Department();
    // se inserta el puesto 'Indefinido' en caso de existir
    final PositionSearch positionSearch = new PositionSearch();
    positionSearch.setName("Indefinido");
    List<Position> positions = PositionManager.getDefault().getAllEntities(positionSearch, new SortCriteria("name", true));
    Set<Position> positionsSet = new HashSet<Position>();
    for (Position position : positions) {
        positionsSet.add(position);
    }
    department.setPositions(positionsSet);
    return NavigationResults.CREATE;
}
Also used : PositionSearch(com.autentia.tnt.dao.search.PositionSearch) SortCriteria(com.autentia.tnt.dao.SortCriteria) Department(com.autentia.tnt.businessobject.Department) Position(com.autentia.tnt.businessobject.Position) HashSet(java.util.HashSet)

Example 20 with Position

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

the class DepartmentBean method getAllPositions.

public List<SelectItem> getAllPositions() {
    final PositionSearch notDeletedSearch = new PositionSearch();
    notDeletedSearch.setDeleted(false);
    final List<Position> refs = PositionManager.getDefault().getAllEntities(notDeletedSearch, new SortCriteria("name"));
    final List<SelectItem> ret = new ArrayList<SelectItem>();
    for (Position ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : PositionSearch(com.autentia.tnt.dao.search.PositionSearch) SortCriteria(com.autentia.tnt.dao.SortCriteria) Position(com.autentia.tnt.businessobject.Position) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

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