Search in sources :

Example 6 with Position

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

the class TagBean method deletePosition.

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

Example 7 with Position

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

the class TagBean method getAllPositions.

public List<SelectItem> getAllPositions() {
    final PositionSearch positionSearch = new PositionSearch();
    positionSearch.setDeleted(false);
    final List<Position> refs = PositionManager.getDefault().getAllEntities(positionSearch, 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)

Example 8 with Position

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

the class TagBean method getPositionTagss.

/**
 * Get the list of all positionTagss
 *
 * @return the list of all positionTagss
 */
public List<SelectItem> getPositionTagss() {
    List<Position> refs = PositionManager.getDefault().getAllEntities(null, new SortCriteria("name"));
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    for (Position ref : refs) {
        ret.add(new SelectItem(ref, ref.getName()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) Position(com.autentia.tnt.businessobject.Position) SelectItem(javax.faces.model.SelectItem) ArrayList(java.util.ArrayList)

Example 9 with Position

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

the class ContactPositionManagerTest method testDoAdvancedSearchBusyPosition.

/**
 * Buscar por puesto ocupado
 */
@Test
public void testDoAdvancedSearchBusyPosition() {
    final PositionDAO positionDAO = (PositionDAO) SpringUtilsForTesting.getSpringBean("daoPosition");
    final ContactDAO contactDAO = (ContactDAO) SpringUtilsForTesting.getSpringBean("daoContact");
    final ContactPositionManager contactPositionManager = new ContactPositionManager(contactDAO, positionDAO);
    this.insertInitialData();
    this.insertContactData();
    final AdvancedSearchContactSearch advancedSearch = new AdvancedSearchContactSearch();
    final List<Position> positions = new ArrayList<Position>();
    positions.add(becario);
    advancedSearch.setPositions(positions);
    final List<ContactPosition> contactPositions = contactPositionManager.doAdvancedSearch(advancedSearch, JUST_ACTIVE);
    // debe salir un resultado, que es Antonio Ruiz ya que posee el cargo de becario
    if (contactPositions.size() != 1) {
        fail("Deberia haber salido 1 resultado (1 contacto), pero han salido " + contactPositions.size());
    }
    if (!contactPositions.get(0).getName().equals("Antonio Ruiz")) {
        fail("El resultado debería haber sido 'Antonio Ruiz', pero ha sido " + contactPositions.get(0).getName());
    }
}
Also used : PositionDAO(com.autentia.tnt.dao.hibernate.PositionDAO) AdvancedSearchContactSearch(com.autentia.tnt.dao.search.AdvancedSearchContactSearch) ContactDAO(com.autentia.tnt.dao.hibernate.ContactDAO) Position(com.autentia.tnt.businessobject.Position) ArrayList(java.util.ArrayList) Test(org.junit.Test)

Example 10 with Position

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

the class ContactPositionManagerTest method testDoAdvancedSearchEmptyPosition.

/**
 * Buscar por puesto libre
 */
@Test
public void testDoAdvancedSearchEmptyPosition() {
    final PositionDAO positionDAO = (PositionDAO) SpringUtilsForTesting.getSpringBean("daoPosition");
    final ContactDAO contactDAO = (ContactDAO) SpringUtilsForTesting.getSpringBean("daoContact");
    final ContactPositionManager contactPositionManager = new ContactPositionManager(contactDAO, positionDAO);
    this.insertInitialData();
    this.insertContactData();
    final AdvancedSearchContactSearch advancedSearch = new AdvancedSearchContactSearch();
    final List<Position> positions = new ArrayList<Position>();
    positions.add(responsableDireccion);
    advancedSearch.setPositions(positions);
    final List<ContactPosition> contactPositions = contactPositionManager.doAdvancedSearch(advancedSearch, JUST_ACTIVE);
    // debe salir un resultado que es el puesto sin ocupantes
    if (contactPositions.size() != 1) {
        fail("Deberia haber salido 1 resultado (1 puesto), pero han salido " + contactPositions.size());
    }
    if (!contactPositions.get(0).getPosition().equals("Responsable de Dirección")) {
        fail("El resultado debería haber sido 'Responsable de Dirección', pero ha sido " + contactPositions.get(0).getPosition());
    }
}
Also used : PositionDAO(com.autentia.tnt.dao.hibernate.PositionDAO) AdvancedSearchContactSearch(com.autentia.tnt.dao.search.AdvancedSearchContactSearch) ContactDAO(com.autentia.tnt.dao.hibernate.ContactDAO) Position(com.autentia.tnt.businessobject.Position) ArrayList(java.util.ArrayList) Test(org.junit.Test)

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