Search in sources :

Example 1 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class TeamSynchronizer method notifyPM.

protected void notifyPM(Project project, List<Employee> closedEmployees, List<Employee> newEmployees) throws MessagingException {
    Map<String, Object> params = new HashMap<>();
    params.put("managedProject", project);
    params.put("newEmployees", newEmployees);
    params.put("closedEmployees", closedEmployees);
    params.put("appUrl", settings.getApplicationBaseUrl());
    String body = mailTemplateManager.getTemplateText(MailTemplate.TEAM_SYNCHRONIZATION_BODY.getFileName(), params);
    String subject = mailTemplateManager.getTemplateText(MailTemplate.TEAM_SYNCHRONIZATION_SUBJECT.getFileName(), params);
    Mail mail = new Mail(subject, body);
    for (Employee manager : project.getManagers()) {
        mailingEngine.send(manager.getEmail(), mail);
    }
}
Also used : Mail(com.artezio.arttime.services.mailing.Mail) Employee(com.artezio.arttime.datamodel.Employee) HashMap(java.util.HashMap)

Example 2 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class LdapAdapter method getEmployees.

public List<Employee> getEmployees() {
    Filter filter = new Filter(employeeFilter, new Object[] {});
    List<Employee> employees = listEmployees(filter);
    employees.sort(Employee.NAME_COMPARATOR);
    return employees;
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter)

Example 3 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class LdapAdapter method findEmployee.

public Employee findEmployee(String userName) {
    if (StringUtils.isNotBlank(userFilter)) {
        Filter filter = new Filter(userFilter, new Object[] { userName });
        List<Employee> employees = listEmployees(filter);
        return (employees.isEmpty()) ? null : employees.get(0);
    }
    return null;
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter)

Example 4 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class LdapAdapter method listEmployeesByTeamCodes.

List<Employee> listEmployeesByTeamCodes(String teamCodes) {
    Set<Employee> team = new HashSet<Employee>();
    List<String> codes = (!StringUtils.isEmpty(teamCodes)) ? splitTeamCodeString(teamCodes) : Collections.<String>emptyList();
    for (String code : codes) {
        Filter filter = new Filter(groupMemberFilter, new Object[] { code });
        team.addAll(listEmployees(filter));
    }
    return new ArrayList<Employee>(team);
}
Also used : Employee(com.artezio.arttime.datamodel.Employee) TeamFilter(com.artezio.arttime.datamodel.TeamFilter) ArrayList(java.util.ArrayList) HashSet(java.util.HashSet)

Example 5 with Employee

use of com.artezio.arttime.datamodel.Employee in project ART-TIME by Artezio.

the class LdapAdapter method createEmployee.

protected Employee createEmployee(Attributes attrs) throws NamingException, IllegalAccessException, InvocationTargetException {
    Employee employee = new Employee();
    for (Entry<String, String> item : attributeMapping.entrySet()) {
        Attribute attr = attrs.get(item.getKey());
        String value = parseAttribute(attr);
        BeanUtils.setProperty(employee, item.getValue(), value);
    }
    employee.castDepartmentToNameCase();
    WorkdaysCalendar calendar = workdaysCalendarRepository.findDefaultCalendar(employee);
    employee.setCalendar(calendar);
    return employee;
}
Also used : WorkdaysCalendar(com.artezio.arttime.datamodel.WorkdaysCalendar) Employee(com.artezio.arttime.datamodel.Employee) Attribute(javax.naming.directory.Attribute)

Aggregations

Employee (com.artezio.arttime.datamodel.Employee)339 Test (org.junit.Test)300 Project (com.artezio.arttime.datamodel.Project)196 HourType (com.artezio.arttime.datamodel.HourType)115 Hours (com.artezio.arttime.datamodel.Hours)101 Date (java.util.Date)67 Period (com.artezio.arttime.datamodel.Period)61 CalendarUtils.getOffsetDate (com.artezio.arttime.test.utils.CalendarUtils.getOffsetDate)52 BigDecimal (java.math.BigDecimal)45 TeamFilter (com.artezio.arttime.datamodel.TeamFilter)27 Filter (com.artezio.arttime.filter.Filter)26 ArrayList (java.util.ArrayList)24 CalendarUtils.createPeriod (com.artezio.arttime.test.utils.CalendarUtils.createPeriod)22 HashMap (java.util.HashMap)21 PrepareForTest (org.powermock.core.classloader.annotations.PrepareForTest)21 WorkdaysCalendar (com.artezio.arttime.datamodel.WorkdaysCalendar)16 Arrays.asList (java.util.Arrays.asList)15 List (java.util.List)15 Map (java.util.Map)15 HoursRepository (com.artezio.arttime.repositories.HoursRepository)13