Search in sources :

Example 1 with Occupation

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

the class OccupationBean method create.

/**
 * Go to create page
 * @return forward to CREATE page
 */
public String create() {
    selectedOrganization = null;
    occupation = new Occupation();
    return NavigationResults.CREATE;
}
Also used : Occupation(com.autentia.tnt.businessobject.Occupation)

Example 2 with Occupation

use of com.autentia.tnt.businessobject.Occupation 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 Occupation

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

the class AvailabilityBean method fillAvailability.

private void fillAvailability(User user, OcupationModel model) {
    Calendar calendarFirstDayOfMonth = Calendar.getInstance();
    Calendar calendarLastDayOfMonth = Calendar.getInstance();
    Date firstDayOfMonth = DateUtils.getFirstDayOfMonth(selectedDate);
    Date lastDayOfMonth = DateUtils.getLastDayOfMonth(selectedDate);
    calendarFirstDayOfMonth.setTime(firstDayOfMonth);
    calendarLastDayOfMonth.setTime(lastDayOfMonth);
    calendarFirstDayOfMonth.add(Calendar.MONTH, -1);
    calendarLastDayOfMonth.add(Calendar.MONTH, 1);
    OccupationManager ocManager = OccupationManager.getDefault();
    OccupationSearch ocSearch = new OccupationSearch();
    ocSearch.setStartOccupationDate(calendarFirstDayOfMonth.getTime());
    ocSearch.setEndOccupationDate(calendarLastDayOfMonth.getTime());
    ocSearch.setUser(user);
    for (Occupation oc : ocManager.getAllEntities(ocSearch, null)) {
        OcupationEntryImpl oce = new OcupationEntryImpl();
        oce.setStart(DateUtils.minHourInDate(oc.getStartDate()));
        oce.setEnd(DateUtils.maxHourInDate(oc.getEndDate()));
        oce.setVacances(false);
        oce.setDescription(oc.getProject().getName() + "(" + oc.getProject().getClient().getName() + "). " + oc.getDescription());
        oce.setDuration(oc.getDuration());
        model.addOcupationEntry(oce);
    }
}
Also used : Occupation(com.autentia.tnt.businessobject.Occupation) Calendar(java.util.Calendar) Date(java.util.Date) OccupationManager(com.autentia.tnt.manager.activity.OccupationManager) OccupationSearch(com.autentia.tnt.dao.search.OccupationSearch)

Aggregations

Occupation (com.autentia.tnt.businessobject.Occupation)3 User (com.autentia.tnt.businessobject.User)1 OccupationSearch (com.autentia.tnt.dao.search.OccupationSearch)1 OccupationManager (com.autentia.tnt.manager.activity.OccupationManager)1 UserManager (com.autentia.tnt.manager.admin.UserManager)1 Calendar (java.util.Calendar)1 Date (java.util.Date)1