Source:
<code>private static List<DbGroup> updateGroups() { List<DbGroup> groups = DbFacade.getInstance().getDbGroupDao().getAll(); for (DbGroup group : groups) { if (group.getDomain() == null && group.getName().contains("@")) { StringBuilder logMsg = new StringBuilder(); logMsg.append("domain name for ad group ") .append(group.getName()) .append(" is null. This should not occur, please check that domain name is passed correctly from client"); log.warn(logMsg.toString()); String partAfterAtSign = group.getName().split("[@]", -1)[1]; String newDomainName = partAfterAtSign; if (partAfterAtSign.contains("/")) { String partPreviousToSlashSign = partAfterAtSign.split("[/]", -1)[0]; newDomainName = partPreviousToSlashSign; } group.setDomain(newDomainName); } if (group.getDomain() != null && !group.getDomain().isEmpty()) { if (UsersDomainsCacheManagerService.getInstance().getDomain(group.getDomain()) == null) { log.errorFormat("Cannot query for group {0} from domain {1} because the domain is not configured. Please use the manage domains utility if you wish to add this domain.", group.getName(), group.getDomain()); } else { LdapGroup groupFromAD = (LdapGroup) LdapFactory .getInstance(group.getDomain()) .RunAdAction(AdActionType.GetAdGroupByGroupId, new LdapSearchByIdParameters(group.getDomain(), group.getId())) .getReturnValue(); if (group.getStatus() == 1 && (groupFromAD == null || groupFromAD.getstatus() == LdapRefStatus.Inactive)) { <START> group.setStatus(0); END> } else if (groupFromAD != null && (!StringUtils.equals(group.getName(), groupFromAD.getname()) || group.getStatus() != groupFromAD.getstatus().getValue() || !StringUtils.equals(group.getDistinguishedName(), groupFromAD.getDistinguishedName()))) { group = new DbGroup(groupFromAD); } DbFacade.getInstance().getDbGroupDao().update(group); if (groupFromAD != null) { group.setMemberOf(groupFromAD.getMemberOf()); } } } } return groups; }</code><technical_language>If a group removed ladp server, want for good inactive</technical_language>

Target:
private static List<DbGroup> updateGroups() { List<DbGroup> groups = DbFacade.getInstance().getDbGroupDao().getAll(); for (DbGroup group : groups) { if (group.getDomain() == null && group.getName().contains("@")) { StringBuilder logMsg = new StringBuilder(); logMsg.append("domain name for ad group ") .append(group.getName()) .append(" is null. This should not occur, please check that domain name is passed correctly from client"); log.warn(logMsg.toString()); String partAfterAtSign = group.getName().split("[@]", -1)[1]; String newDomainName = partAfterAtSign; if (partAfterAtSign.contains("/")) { String partPreviousToSlashSign = partAfterAtSign.split("[/]", -1)[0]; newDomainName = partPreviousToSlashSign; } group.setDomain(newDomainName); } if (group.getDomain() != null && !group.getDomain().isEmpty()) { if (UsersDomainsCacheManagerService.getInstance().getDomain(group.getDomain()) == null) { log.errorFormat("Cannot query for group {0} from domain {1} because the domain is not configured. Please use the manage domains utility if you wish to add this domain.", group.getName(), group.getDomain()); } else { LdapGroup groupFromAD = (LdapGroup) LdapFactory .getInstance(group.getDomain()) .RunAdAction(AdActionType.GetAdGroupByGroupId, new LdapSearchByIdParameters(group.getDomain(), group.getId())) .getReturnValue(); if (group.isActive() && (groupFromAD == null || !groupFromAD.isActive())) { group.setActive(false); } else if (groupFromAD != null && (!StringUtils.equals(group.getName(), groupFromAD.getname()) || group.isActive() != groupFromAD.isActive() || !StringUtils.equals(group.getDistinguishedName(), groupFromAD.getDistinguishedName()))) { group = new DbGroup(groupFromAD); } DbFacade.getInstance().getDbGroupDao().update(group); if (groupFromAD != null) { group.setMemberOf(new HashSet<>(groupFromAD.getMemberOf())); } } } } return groups; }