Search in sources :

Example 1 with UserManager

use of com.autentia.tnt.manager.admin.UserManager in project TNTConcept by autentia.

the class ObjectiveBean method getFiltrableUsers.

public List<SelectItem> getFiltrableUsers() {
    List<User> refs = new ArrayList<User>();
    ObjectiveSearch search = new ObjectiveSearch();
    List<Objective> objetivos = manager.getAllEntities(search, null);
    UserManager userManager = UserManager.getDefault();
    UserSearch userSearch = new UserSearch();
    userSearch.setActive(true);
    int sizeMaxUser = userManager.getAllEntities(userSearch, null).size();
    for (Objective obj : objetivos) {
        User us = obj.getUser();
        if (us.isActive() && !refs.contains(us)) {
            refs.add(us);
        }
        if (refs.size() >= sizeMaxUser)
            break;
    }
    Collections.sort(refs, new UserComparator());
    ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
    ret.add(new SelectItem(Integer.valueOf(ALL_USERS), "--"));
    for (User ref : refs) {
        ret.add(new SelectItem(ref.getId(), ref.getName()));
    }
    return ret;
}
Also used : UserManager(com.autentia.tnt.manager.admin.UserManager)

Example 2 with UserManager

use of com.autentia.tnt.manager.admin.UserManager in project TNTConcept by autentia.

the class OccupationBean method insertOccupation.

/* occupation - generated by stajanov (do not edit/delete) */
public String insertOccupation() {
    Integer id = Integer.parseInt(FacesUtils.getRequestParameter(ROW_ID));
    occupation = new Occupation();
    UserManager userManager = UserManager.getDefault();
    User user = userManager.getEntityById(id);
    occupation.setUser(user);
    return "insertOccupation";
}
Also used : Occupation(com.autentia.tnt.businessobject.Occupation) User(com.autentia.tnt.businessobject.User) UserManager(com.autentia.tnt.manager.admin.UserManager)

Example 3 with UserManager

use of com.autentia.tnt.manager.admin.UserManager in project TNTConcept by autentia.

the class UserHolidaysStateBean method getAll.

public List<UserHolidaysState> getAll() {
    List<UserHolidaysState> ret = new ArrayList<UserHolidaysState>();
    if (chargeYear == null)
        return ret;
    UserManager userManager = UserManager.getDefault();
    UserSearch searchUser = new UserSearch();
    searchUser.setActive(true);
    List<User> users = userManager.getAllEntities(searchUser, new SortCriteria(sortColumn, sortAscending));
    for (User us : users) {
        ret.add(manager.calculateUserHolidaysState(us, this.getChargeYear()));
    }
    return ret;
}
Also used : SortCriteria(com.autentia.tnt.dao.SortCriteria) User(com.autentia.tnt.businessobject.User) UserManager(com.autentia.tnt.manager.admin.UserManager) ArrayList(java.util.ArrayList) UserHolidaysState(com.autentia.tnt.businessobject.UserHolidaysState) UserSearch(com.autentia.tnt.dao.search.UserSearch)

Aggregations

UserManager (com.autentia.tnt.manager.admin.UserManager)3 User (com.autentia.tnt.businessobject.User)2 Occupation (com.autentia.tnt.businessobject.Occupation)1 UserHolidaysState (com.autentia.tnt.businessobject.UserHolidaysState)1 SortCriteria (com.autentia.tnt.dao.SortCriteria)1 UserSearch (com.autentia.tnt.dao.search.UserSearch)1 ArrayList (java.util.ArrayList)1