public List<Integer> getDropDownYears() { // do not cache the years because this is a long lasting service and the years could change in the meantime final List<Integer> years = timeableService.getAvailableStartTimeYears(employeeDao.internalLoadAll()); final Integer actualYear = new GregorianCalendar().get(Calendar.YEAR); if (years.contains(actualYear) == false) { years.add(actualYear); } if (years.contains(actualYear + 1) == false) { years.add(actualYear + 1); } return years .stream() .sorted() .collect(Collectors.toList()); }
@Override public List<EmployeeDO> findAllActive(final boolean checkAccess) { final Collection<EmployeeDO> employeeList; if (checkAccess) { employeeList = employeeDao.getList(new EmployeeFilter()); } else { employeeList = employeeDao.internalLoadAll(); } return employeeList.stream() .filter(this::isEmployeeActive) .collect(Collectors.toList()); }
@Override public List<EmployeeDO> getAll(boolean checkAccess) { return checkAccess ? employeeDao.getList(new EmployeeFilter()) : employeeDao.internalLoadAll(); }
@BeforeClass public void init() { logon(TEST_FULL_ACCESS_USER); employeeList = employeeDao.internalLoadAll(); assertTrue(employeeList.size() > 0, "Keine Mitarbeiter in der Test DB!"); }
@Override public UpdatePreCheckStatus runPreCheck() { log.info("Running pre-check for ProjectForge version 6.4.0"); // ensure that the tenant exists, otherwise the following statements will fail with an SQL exception if (!databaseService.doTablesExist(TenantDO.class) || databaseService.internalIsTableEmpty("T_TENANT")) { return UpdatePreCheckStatus.READY_FOR_UPDATE; } final EmployeeDao employeeDao = applicationContext.getBean(EmployeeDao.class); final boolean anyEmployeeWithAnOldStatusExists = databaseService.doTablesExist(EmployeeDO.class) && employeeDao .internalLoadAll() .stream() .filter(e -> !e.isDeleted()) .anyMatch(e -> e.getStatus() != null); final int employeeStatusGroupEntriesCount = databaseService .countTimeableAttrGroupEntries(EmployeeTimedDO.class, InternalAttrSchemaConstants.EMPLOYEE_STATUS_GROUP_NAME); if (anyEmployeeWithAnOldStatusExists && employeeStatusGroupEntriesCount <= 0) { return UpdatePreCheckStatus.READY_FOR_UPDATE; } else { return UpdatePreCheckStatus.ALREADY_UPDATED; } }
public static void migrateEmployeeStatusToAttr() { final EmployeeService employeeService = applicationContext.getBean(EmployeeService.class); final EmployeeDao employeeDao = applicationContext.getBean(EmployeeDao.class); final List<EmployeeDO> employees = employeeDao.internalLoadAll(); employees.forEach(employee -> { final EmployeeStatus status = employee.getStatus(); if (status != null) { final EmployeeTimedDO newAttrRow = employeeService.addNewTimeAttributeRow(employee, InternalAttrSchemaConstants.EMPLOYEE_STATUS_GROUP_NAME); newAttrRow.setStartTime(getDateForStatus(employee)); newAttrRow.putAttribute(InternalAttrSchemaConstants.EMPLOYEE_STATUS_DESC_NAME, status.getI18nKey()); employeeDao.internalUpdate(employee); } }); }