コード例 #1
0
 private boolean updateName(Division dbDiv, DivisionLdap ldapDiv) {
   if ((dbDiv.getLdapName() == null) || !dbDiv.getLdapName().equals(ldapDiv.getLdap_name())) {
     dbDiv.setLdapName(ldapDiv.getLdap_name());
     return true;
   }
   return false;
 }
コード例 #2
0
  private boolean updateLeader(Division dbDiv, DivisionLdap ldapDiv) {
    String dbObjectSid;
    String ldapObjectSid;
    boolean forceUpdate;
    if (dbDiv.getLeader() != null) {
      dbObjectSid = dbDiv.getLeader().getObjectSid();
      forceUpdate = false;
    } else {
      logger.error("For employee [{}] no objectSid", dbDiv.getLeader());
      forceUpdate = true;
      dbObjectSid = "";
    }

    if (ldapDiv.getLeaderSid() != null) {
      ldapObjectSid = ldapDiv.getLeaderSid();
    } else {
      logger.error("No leader's objectSid for division [{}]", ldapDiv.getLdap_name());
      return false;
    }

    if (forceUpdate || !(dbObjectSid.equals(ldapObjectSid))) {
      Employee employee = employeeService.findByObjectSid(ldapObjectSid);
      dbDiv.setLeader(employee);
      return true;
    }
    return false;
  }
コード例 #3
0
 private StringBuffer add(List<DivisionLdap> forAppend) {
   StringBuffer sb = new StringBuffer();
   for (DivisionLdap ldapDiv : forAppend) {
     Division division = new Division();
     division.setName(ldapDiv.getLdap_name());
     division.setLdapName(ldapDiv.getLdap_name());
     division.setLdap_objectSid(ldapDiv.getLdapObjectSid());
     Employee leader = employeeService.findByObjectSid(ldapDiv.getLeaderSid());
     if (leader == null) {
       logger.debug("div name {}", ldapDiv.getLdap_name());
       logger.debug("not found leader sid {}", ldapDiv.getLeaderSid());
     }
     division.setLeader(leader);
     Set<Employee> employees = getEmpoyees(ldapDiv.getMembers());
     division.setEmployees(employees);
     division.setActive(true);
     sb.append(divisionDAO.setDivision(division));
   }
   return sb;
 }