if (departmentID != null && unit.getType() != null && unit.getType().equals(PartyType.DEPARTMENT)) {
if (departmentID != null && unit.getType() != null && unit.getType().equals(PartyTypeEnum.DEPARTMENT)) {
    private void setDepartment(Integer departmentID, Unit unit)            throws ExcepcaoPersistencia {        Department department = null;        if (departmentID != null && unit.getType() != null && unit.getType().equals(PartyType.DEPARTMENT)) {            department = (Department) persistentObject.readByOID(                    Department.class, departmentID);            unit.setDepartment(department);        } else if (unit.getDepartment() != null) {            unit.removeDepartment();                }    }