AutoRefactor'ed code cleanups
| | |
| | | * changetype, so only use it if a newSuperior element has been |
| | | * provided, but use modrdn elsewhere. |
| | | */ |
| | | if (change.getNewSuperior() == null) { |
| | | writeLine("changetype: modrdn"); |
| | | } else { |
| | | if (change.getNewSuperior() != null) { |
| | | writeLine("changetype: moddn"); |
| | | } else { |
| | | writeLine("changetype: modrdn"); |
| | | } |
| | | |
| | | writeKeyAndValue("newrdn", change.getNewRDN().toString()); |
| | |
| | | if ((openPos > 0 && newLine.charAt(openPos - 1) != '\\') || (openPos == 0)) { |
| | | final String constantName = newLine.substring(openPos + 1, closePos).toLowerCase(); |
| | | final String constantValue = constants.get(constantName); |
| | | if (constantValue == null) { |
| | | warnings.add(WARN_ENTRY_GENERATOR_WARNING_UNDEFINED_CONSTANT.get(constantName, lineNumber)); |
| | | } else { |
| | | if (constantValue != null) { |
| | | lineBuffer.replace(openPos, closePos + 1, constantValue); |
| | | } else { |
| | | warnings.add(WARN_ENTRY_GENERATOR_WARNING_UNDEFINED_CONSTANT.get(constantName, lineNumber)); |
| | | } |
| | | } |
| | | if (openPos >= 0) { |
| | |
| | | Promise<BindResult, LdapException> returnedPromise; |
| | | if (filter != null && baseDN != null) { |
| | | if (sr == null) { |
| | | if (dataSources == null) { |
| | | sr = Requests.newSearchRequest(baseDN, scope, filter, attributes); |
| | | if (dataSources != null) { |
| | | final String newBaseDN = String.format(baseDN, data); |
| | | final String newFilter = String.format(filter, data); |
| | | sr = Requests.newSearchRequest(newBaseDN, scope, newFilter, attributes); |
| | | } else { |
| | | sr = Requests.newSearchRequest(String.format(baseDN, data), scope, |
| | | String.format(filter, data), attributes); |
| | | sr = Requests.newSearchRequest(baseDN, scope, filter, attributes); |
| | | } |
| | | sr.setDereferenceAliasesPolicy(dereferencesAliasesPolicy); |
| | | } else if (dataSources != null) { |
| | |
| | | final Object value = principals.get(key); |
| | | if (isJSONPrimitive(value)) { |
| | | values[i] = String.valueOf(value); |
| | | } else if (value == null) { |
| | | throw new ForbiddenException(i18n( |
| | | "The request could not be authorized because the required " |
| | | + "security principal '%s' could not be determined", key)); |
| | | } else { |
| | | } else if (value != null) { |
| | | throw new ForbiddenException(i18n( |
| | | "The request could not be authorized because the required " |
| | | + "security principal '%s' had an invalid data type", key)); |
| | | } else { |
| | | throw new ForbiddenException(i18n( |
| | | "The request could not be authorized because the required " |
| | | + "security principal '%s' could not be determined", key)); |
| | | } |
| | | } |
| | | return values; |
| | |
| | | |
| | | private void completeIfNecessary() { |
| | | if (pendingSearches.decrementAndGet() == 0) { |
| | | if (exception.get() == null) { |
| | | h.handleResult(newLDAPAttribute); |
| | | } else { |
| | | if (exception.get() != null) { |
| | | h.handleError(exception.get()); |
| | | } else { |
| | | h.handleResult(newLDAPAttribute); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public static org.opends.server.types.SearchScope to( |
| | | final org.forgerock.opendj.ldap.SearchScope searchScope) { |
| | | if (searchScope == null) { |
| | | return null; |
| | | if (searchScope != null) { |
| | | return org.opends.server.types.SearchScope.values()[searchScope.intValue()]; |
| | | } |
| | | return org.opends.server.types.SearchScope.values()[searchScope.intValue()]; |
| | | return null; |
| | | } |
| | | |
| | | /** |
| | |
| | | */ |
| | | public static org.forgerock.opendj.ldap.SearchScope from( |
| | | final org.opends.server.types.SearchScope searchScope) { |
| | | if (searchScope == null) { |
| | | return null; |
| | | if (searchScope != null) { |
| | | return org.forgerock.opendj.ldap.SearchScope.values().get(searchScope.intValue()); |
| | | } |
| | | return org.forgerock.opendj.ldap.SearchScope.values().get(searchScope.intValue()); |
| | | return null; |
| | | } |
| | | |
| | | /** |