Search in sources :

Example 1 with AbacContext

use of com.artezio.javax.jpa.abac.AbacContext in project ART-TIME by Artezio.

the class FilterService method getTimesheetFilter.

@AbacContext(VIEW_TIMESHEET)
public Filter getTimesheetFilter() {
    Filter result = new Filter();
    result.setDepartments(departmentRepository.getDepartments());
    result.setHourTypes(hourTypeService.getAll());
    employeeService.getLoggedEmployee().ifPresent(employee -> result.setEmployees(Collections.singletonList(employee)));
    result.setProjects(getActiveAndReportedProjects(result.getPeriod()));
    return result;
}
Also used : Filter(com.artezio.arttime.filter.Filter) AbacContext(com.artezio.javax.jpa.abac.AbacContext)

Example 2 with AbacContext

use of com.artezio.javax.jpa.abac.AbacContext in project ART-TIME by Artezio.

the class WorkTimeService method getRequiredWorkHours.

@PermitAll
@AbacContext(VIEW_TIMESHEET)
public BigDecimal getRequiredWorkHours(Employee employee, Period period) {
    List<Date> workDayDates = getWorkDayDates(employee, period);
    BigDecimal workDaysNumber = new BigDecimal(workDayDates.size());
    return workDaysNumber.multiply(employee.getWorkLoadHours());
}
Also used : BigDecimal(java.math.BigDecimal) PermitAll(javax.annotation.security.PermitAll) AbacContext(com.artezio.javax.jpa.abac.AbacContext)

Aggregations

AbacContext (com.artezio.javax.jpa.abac.AbacContext)2 Filter (com.artezio.arttime.filter.Filter)1 BigDecimal (java.math.BigDecimal)1 PermitAll (javax.annotation.security.PermitAll)1