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;
}
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";
}
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);
}
}
Aggregations