package org.synyx.urlaubsverwaltung.department.web;

import org.synyx.urlaubsverwaltung.department.Department;

import java.util.List;

import static java.util.stream.Collectors.toList;

final class DepartmentDepartmentFormMapper {

    private DepartmentDepartmentFormMapper() {
        // prevents init
    }

    static List<DepartmentForm> mapToDepartmentForm(List<Department> departments) {

        return departments.stream().map(DepartmentDepartmentFormMapper::mapToDepartmentForm).collect(toList());
    }

    static DepartmentForm mapToDepartmentForm(Department department) {

        final DepartmentForm departmentForm = new DepartmentForm();
        departmentForm.setId(department.getId());
        departmentForm.setName(department.getName());
        departmentForm.setDescription(department.getDescription());
        departmentForm.setMembers(department.getMembers());
        departmentForm.setDepartmentHeads(department.getDepartmentHeads());
        departmentForm.setLastModification(department.getLastModification());
        departmentForm.setTwoStageApproval(department.isTwoStageApproval());
        departmentForm.setSecondStageAuthorities(department.getSecondStageAuthorities());

        return departmentForm;
    }

    static Department mapToDepartment(DepartmentForm departmentForm) {

        final Department department = new Department();
        department.setId(departmentForm.getId());
        department.setName(departmentForm.getName());
        department.setDescription(departmentForm.getDescription());
        department.setMembers(departmentForm.getMembers());
        department.setDepartmentHeads(departmentForm.getDepartmentHeads());
        department.setLastModification(departmentForm.getLastModification());
        department.setTwoStageApproval(departmentForm.isTwoStageApproval());
        department.setSecondStageAuthorities(departmentForm.getSecondStageAuthorities());

        return department;
    }
}

@@ -109,83 +109,8 @@
 t;%0A%0A
-import java.util.List;%0A%0Aimport static java.util.stream.Collectors.toList;%0A%0A
 fina
@@ -234,212 +234,8 @@
  %7D%0A%0A
-    static List%3CDepartmentForm%3E mapToDepartmentForm(List%3CDepartment%3E departments) %7B%0A%0A        return departments.stream().map(DepartmentDepartmentFormMapper::mapToDepartmentForm).collect(toList());%0A    %7D%0A%0A
     

remove unused method