use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.
the class GlobalHoursReportBean method getAll.
public List<GlobalHourReport> getAll() {
// Retrieve activities for every User during that period of time
ActivitySearch search = new ActivitySearch();
Calendar init = Calendar.getInstance();
init.setTime(startDate);
Calendar last = Calendar.getInstance();
last.setTime(endDate);
init.set(Calendar.HOUR_OF_DAY, init.getMinimum(Calendar.HOUR_OF_DAY));
init.set(Calendar.MINUTE, init.getMinimum(Calendar.MINUTE));
init.set(Calendar.SECOND, init.getMinimum(Calendar.SECOND));
init.set(Calendar.MILLISECOND, init.getMinimum(Calendar.MILLISECOND));
last.set(Calendar.HOUR_OF_DAY, last.getMaximum(Calendar.HOUR_OF_DAY));
last.set(Calendar.MINUTE, last.getMaximum(Calendar.MINUTE));
last.set(Calendar.SECOND, last.getMaximum(Calendar.SECOND));
last.set(Calendar.MILLISECOND, last.getMaximum(Calendar.MILLISECOND));
search.setStartStartDate(init.getTime());
search.setEndStartDate(last.getTime());
List<GlobalHourReport> listGlobal = new ArrayList<GlobalHourReport>();
if (billable)
search.setBillable(true);
// Search activities during indicated dates
List<Activity> activities = manager.getAllEntities(search, new SortCriteria("role.project.client.name"));
for (Activity act : activities) {
Project proj = act.getRole().getProject();
GlobalHourReport unit = new GlobalHourReport();
unit.setProject(proj);
// an entry in the list represents a project
if (!listGlobal.contains(unit))
listGlobal.add(unit);
// Retrieve the stored unit and save hours
GlobalHourReport storedUnit = listGlobal.get(listGlobal.indexOf(unit));
float horas = act.getDuration() / 60.0f;
storedUnit.setUserHours(act.getUser(), horas);
storedUnit.setIterator(usuarios.iterator());
}
return listGlobal;
}
use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.
the class OccupationBean method getOrganizations.
/**
* Get the list of all organizations
* @return the list of all organizations
*/
public List<SelectItem> getOrganizations() {
ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
List<Organization> refs = organizationDAO.search(new SortCriteria("name"));
for (Organization ref : refs) {
ret.add(new SelectItem(ref, ref.getName()));
}
return ret;
}
use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.
the class OccupationBean method getProjects.
/**
* Get the list of all projects
* @return the list of all projects
*/
public List<SelectItem> getProjects() {
List<Project> refs = ProjectManager.getDefault().getAllEntities(null, new SortCriteria("name"));
ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
for (Project ref : refs) {
ret.add(new SelectItem(ref, ref.getName()));
}
return ret;
}
use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.
the class ActivityBean method fillExternalActivities.
private void fillExternalActivities(SimpleScheduleModel model) {
Calendar calMin = Calendar.getInstance();
Calendar calMax = Calendar.getInstance();
calMin = getMinimumSearchTime(selectedDate);
calMax = getMaximumSearchTime(selectedDate);
ExternalActivitySearch search = new ExternalActivitySearch();
search.setStartStartDate(calMin.getTime());
search.setEndStartDate(calMax.getTime());
search.setStartEndDate(calMin.getTime());
search.setEndEndDate(calMax.getTime());
search.setOwner(authManager.getCurrentPrincipal().getUser());
List<ExternalActivity> extActivities = externalActivityManager.getAllEntities(search, new SortCriteria(sortColumn, sortAscending));
for (ExternalActivity extActivity : extActivities) {
ExternalActivityScheduleEntry entry = new ExternalActivityScheduleEntry(extActivity);
model.addEntry(entry);
}
}
use of com.autentia.tnt.dao.SortCriteria in project TNTConcept by autentia.
the class ActivityBean method getUsers.
// Getters to list possible values of related entities
/**
* Get the list of all users
*
* @return the list of all users
*/
public List<SelectItem> getUsers() {
ArrayList<SelectItem> ret = new ArrayList<SelectItem>();
List<User> refs = userDAO.search(new SortCriteria("name"));
for (User ref : refs) {
ret.add(new SelectItem(ref, ref.getName()));
}
return ret;
}
Aggregations