| | |
| | | |
| | | Set<AttributeType> notificationAttrs = config.getAttributeType(); |
| | | for (AttributeType t : notificationAttrs) { |
| | | for (Attribute a : userEntry.getAttribute(t)) { |
| | | for (Attribute a : userEntry.getAllAttributes(t)) { |
| | | List<String> attrVals = new ArrayList<>(); |
| | | String attrName = a.getAttributeDescription().getAttributeType().getNameOrOID(); |
| | | for (ByteString v : a) { |
| | |
| | | { |
| | | SearchResultEntry adminConnectorEntry = result.getFirst(); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> attrs = adminConnectorEntry.getAttribute(attrType); |
| | | List<Attribute> attrs = adminConnectorEntry.getAllAttributes(attrType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | | // Get the attribute value |
| | |
| | | // First check to see if the ds-pwp-password-policy-dn is present. |
| | | String userDNString = userEntry.getName().toString(); |
| | | AttributeType type = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_POLICY_DN); |
| | | for (Attribute a : userEntry.getAttribute(type)) |
| | | for (Attribute a : userEntry.getAllAttributes(type)) |
| | | { |
| | | if (a.isEmpty()) |
| | | { |
| | |
| | | protected static ConditionResult getBoolean(final Entry entry, |
| | | final AttributeType attributeType) throws DirectoryException |
| | | { |
| | | for (final Attribute a : entry.getAttribute(attributeType)) |
| | | for (final Attribute a : entry.getAllAttributes(attributeType)) |
| | | { |
| | | if (a.isEmpty()) |
| | | { |
| | |
| | | { |
| | | long timeValue = -1; |
| | | |
| | | for (final Attribute a : entry.getAttribute(attributeType)) |
| | | for (final Attribute a : entry.getAllAttributes(attributeType)) |
| | | { |
| | | if (a.isEmpty()) |
| | | { |
| | |
| | | } |
| | | |
| | | AttributeType privType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PRIVILEGE_NAME); |
| | | for (Attribute a : entry.getAttribute(privType)) |
| | | for (Attribute a : entry.getAllAttributes(privType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | && resourceEntry.hasAttribute(modAttrType)) |
| | | { |
| | | container.setCurrentAttributeType(modAttrType); |
| | | for (Attribute a : resourceEntry.getAttribute(modAttr.getAttributeDescription())) |
| | | for (Attribute a : resourceEntry.getAllAttributes(modAttr.getAttributeDescription())) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | break; |
| | | case INCREMENT: |
| | | Entry modifiedEntry = operation.getModifiedEntry(); |
| | | for (Attribute attr : modifiedEntry.getAttribute(modAttr.getAttributeDescription())) |
| | | for (Attribute attr : modifiedEntry.getAllAttributes(modAttr.getAttributeDescription())) |
| | | { |
| | | for (ByteString val : attr) |
| | | { |
| | |
| | | //DN is checked to verify it is equal to the config DN. If not those |
| | | //attributes are skipped. |
| | | if(hasGlobalAci && entry.getName().equals(configDN)) { |
| | | List<Attribute> attributeList = entry.getAttribute(globalAciType); |
| | | List<Attribute> attributeList = entry.getAllAttributes(globalAciType); |
| | | validAcis = addAciAttributeList(aciList, DN.rootDN(), configDN, |
| | | attributeList, failedACIMsgs); |
| | | } |
| | | |
| | | if(hasAci) { |
| | | List<Attribute> attributeList = entry.getAttribute(aciType); |
| | | List<Attribute> attributeList = entry.getAllAttributes(aciType); |
| | | validAcis += addAciAttributeList(aciList, entry.getName(), configDN, |
| | | attributeList, failedACIMsgs); |
| | | } |
| | |
| | | //attributes are skipped. |
| | | if(hasGlobalAci && oldEntry.getName().equals(configDN)) { |
| | | aciList.remove(DN.rootDN()); |
| | | List<Attribute> attributeList = newEntry.getAttribute(globalAciType); |
| | | List<Attribute> attributeList = newEntry.getAllAttributes(globalAciType); |
| | | addAciAttributeList(aciList, DN.rootDN(), configDN, |
| | | attributeList, failedACIMsgs); |
| | | } |
| | |
| | | public static boolean evaluate (Entry e, AciEvalContext evalCtx, |
| | | AttributeType attributeType, |
| | | DN suffixDN) { |
| | | List<Attribute> attrs = e.getAttribute(attributeType); |
| | | List<Attribute> attrs = e.getAllAttributes(attributeType); |
| | | for(ByteString v : attrs.get(0)) { |
| | | try { |
| | | DN groupDN = DN.valueOf(v.toString()); |
| | |
| | | { |
| | | // Found a match in the entry, iterate over each attribute |
| | | // type in the entry and check its values against the filter. |
| | | for (Attribute a : entry.getAttribute(attrType)) |
| | | for (Attribute a : entry.getAllAttributes(attrType)) |
| | | { |
| | | if (!matchFilterAttributeValues(a, attrType, f)) |
| | | { |
| | |
| | | private EnumEvalResult evalURL(AciEvalContext evalCtx) { |
| | | EnumEvalResult matched= EnumEvalResult.FALSE; |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrStr); |
| | | List<Attribute> attrs=evalCtx.getResourceEntry().getAttribute(attrType); |
| | | List<Attribute> attrs=evalCtx.getResourceEntry().getAllAttributes(attrType); |
| | | for(Attribute a : attrs) { |
| | | for(ByteString v : a) { |
| | | LDAPURL url; |
| | |
| | | */ |
| | | public static boolean evaluate(Entry e, DN clientDN, |
| | | AttributeType attrType) { |
| | | List<Attribute> attrs = e.getAttribute(attrType); |
| | | List<Attribute> attrs = e.getAllAttributes(attrType); |
| | | for(ByteString v : attrs.get(0)) { |
| | | try { |
| | | DN dn = DN.valueOf(v.toString()); |
| | |
| | | Entry backupDirEntry = getBackupDirectoryEntry(entryDN); |
| | | |
| | | AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | List<Attribute> attrList = backupDirEntry.getAttribute(t); |
| | | List<Attribute> attrList = backupDirEntry.getAllAttributes(t); |
| | | for (ByteString v : attrList.get(0)) |
| | | { |
| | | try |
| | |
| | | |
| | | if (scope != SearchScope.SINGLE_LEVEL) |
| | | { |
| | | List<Attribute> attrList = backupDirEntry.getAttribute(backupPathType); |
| | | List<Attribute> attrList = backupDirEntry.getAllAttributes(backupPathType); |
| | | returnEntries(searchOperation, backupDirDN, filter, attrList); |
| | | } |
| | | } |
| | |
| | | if (scope != SearchScope.BASE_OBJECT) |
| | | { |
| | | AttributeType t = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | List<Attribute> attrList = backupDirEntry.getAttribute(t); |
| | | List<Attribute> attrList = backupDirEntry.getAllAttributes(t); |
| | | returnEntries(searchOperation, baseDN, filter, attrList); |
| | | } |
| | | } |
| | |
| | | // loop on the attribute types in the entry just received |
| | | // and add them in the existing schema. |
| | | Set<String> oidList = new HashSet<>(1000); |
| | | for (Attribute a : newSchemaEntry.getAttribute(attributeTypesType)) |
| | | for (Attribute a : newSchemaEntry.getAllAttributes(attributeTypesType)) |
| | | { |
| | | // Look for attribute types that could have been added to the schema |
| | | // or modified in the schema |
| | |
| | | // loop on the objectClasses from the entry, search if they are |
| | | // already in the current schema, add them if not. |
| | | oidList.clear(); |
| | | for (Attribute a : newSchemaEntry.getAttribute(objectClassesType)) |
| | | for (Attribute a : newSchemaEntry.getAllAttributes(objectClassesType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | } |
| | | else |
| | | { |
| | | List<Attribute> certAttrs = entry.getAttribute( |
| | | List<Attribute> certAttrs = entry.getAllAttributes( |
| | | ATTR_CRYPTO_PUBLIC_KEY_CERTIFICATE); |
| | | if (certAttrs.isEmpty()) |
| | | { |
| | |
| | | |
| | | void indexEntry(Entry entry, Set<ByteString> keys) |
| | | { |
| | | for (Attribute attr : entry.getAttribute(attributeType)) |
| | | for (Attribute attr : entry.getAllAttributes(attributeType)) |
| | | { |
| | | if (!attr.isVirtual()) |
| | | { |
| | |
| | | final AttributeDescription attrDesc = AttributeDescription.valueOf(sortKey.getAttributeDescription()); |
| | | final MatchingRule matchingRule = getEffectiveOrderingRule(sortKey); |
| | | ByteString sortValue = null; |
| | | for (Attribute a : entry.getAttribute(attrDesc.getAttributeType())) |
| | | for (Attribute a : entry.getAllAttributes(attrDesc.getAttributeType())) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | Arg1<Object> multipleEntriesErrorMsg, Arg1<Object> noAttrValueErrorMsg) throws DirectoryException |
| | | { |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | LocalizableMessage message = noEntryErrorMsg.get(attrName); |
| | |
| | | private String getAttributeValue(String attributeName, boolean isRequired) |
| | | throws InitializationException |
| | | { |
| | | List<Attribute> attrList = taskEntry.getAttribute(attributeName); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(attributeName); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | if (isRequired) |
| | |
| | | private LinkedList<String> getAttributeValues(String attributeName) throws InitializationException |
| | | { |
| | | LinkedList<String> valueStrings = new LinkedList<>(); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attributeName); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(attributeName); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | return valueStrings; |
| | |
| | | { |
| | | // Get the name of the class that implements the task logic. |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_CLASS); |
| | | List<Attribute> attrList = entry.getAttribute(attrType); |
| | | List<Attribute> attrList = entry.getAllAttributes(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | LocalizableMessage message = ERR_TASKSCHED_NO_CLASS_ATTRIBUTE.get(ATTR_TASK_ID); |
| | |
| | | |
| | | private Attribute getFirstAttributeNotEmpty(AttributeType attributeType) |
| | | { |
| | | for (Attribute a : userEntry.getAttribute(attributeType)) |
| | | for (Attribute a : userEntry.getAllAttributes(attributeType)) |
| | | { |
| | | if (!a.isEmpty()) |
| | | { |
| | |
| | | { |
| | | ArrayList<Long> timeValues = new ArrayList<>(); |
| | | |
| | | for (Attribute a : userEntry.getAttribute(attributeType)) |
| | | for (Attribute a : userEntry.getAllAttributes(attributeType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | |
| | | boolean isGeneralizedTime = SYNTAX_GENERALIZED_TIME_NAME.equals(type.getSyntax().getName()); |
| | | lastLoginTime = -1; |
| | | for (Attribute a : userEntry.getAttribute(type)) |
| | | for (Attribute a : userEntry.getAllAttributes(type)) |
| | | { |
| | | if (a.isEmpty()) |
| | | { |
| | |
| | | */ |
| | | public List<ByteString> getClearPasswords() |
| | | { |
| | | final List<Attribute> attrList = userEntry.getAttribute(passwordPolicy.getPasswordAttribute()); |
| | | final List<Attribute> attrList = userEntry.getAllAttributes(passwordPolicy.getPasswordAttribute()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | return Collections.emptyList(); |
| | |
| | | @Override |
| | | public boolean passwordMatches(ByteString password) |
| | | { |
| | | List<Attribute> attrList = userEntry.getAttribute(passwordPolicy.getPasswordAttribute()); |
| | | List<Attribute> attrList = userEntry.getAllAttributes(passwordPolicy.getPasswordAttribute()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | |
| | | } |
| | | |
| | | AttributeType type = passwordPolicy.getPasswordAttribute(); |
| | | List<Attribute> attrList = userEntry.getAttribute(type); |
| | | List<Attribute> attrList = userEntry.getAllAttributes(type); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | logger.trace("Doing nothing for entry %s because no password values were found.", userDNString); |
| | |
| | | { |
| | | TreeMap<Long, ByteString> historyMap = new TreeMap<>(); |
| | | AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | for (Attribute a : userEntry.getAttribute(historyType)) |
| | | for (Attribute a : userEntry.getAllAttributes(historyType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | */ |
| | | public void updatePasswordHistory() |
| | | { |
| | | for (Attribute a : userEntry.getAttribute(passwordPolicy.getPasswordAttribute())) |
| | | for (Attribute a : userEntry.getAllAttributes(passwordPolicy.getPasswordAttribute())) |
| | | { |
| | | ByteString insecurePassword = null; |
| | | for (ByteString v : a) |
| | |
| | | { |
| | | ArrayList<String> historyValues = new ArrayList<>(); |
| | | AttributeType historyType = DirectoryServer.getSchema().getAttributeType(OP_ATTR_PWPOLICY_HISTORY_LC); |
| | | for (Attribute a : userEntry.getAttribute(historyType)) |
| | | for (Attribute a : userEntry.getAllAttributes(historyType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | { |
| | | AttributeType pwdAttrType = |
| | | DirectoryServer.getSchema().getAttributeType(PWD_ATTR_VALIDATOR); |
| | | for (Attribute attr : entry.getAttribute(pwdAttrType)) |
| | | for (Attribute attr : entry.getAllAttributes(pwdAttrType)) |
| | | { |
| | | for (ByteString val : attr) |
| | | { |
| | |
| | | private String getAttrValue(Entry entry, String pwdAttrName) |
| | | { |
| | | AttributeType pwdAttrType = DirectoryServer.getSchema().getAttributeType(pwdAttrName); |
| | | for (Attribute attr : entry.getAttribute(pwdAttrType)) |
| | | for (Attribute attr : entry.getAllAttributes(pwdAttrType)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | */ |
| | | private void modifyEntry(Entry srcEntry, Entry dstEntry) |
| | | { |
| | | List<Attribute> srcList = srcEntry.getAttribute(attrCert); |
| | | List<Attribute> dstList = dstEntry.getAttribute(attrCert); |
| | | List<Attribute> srcList = srcEntry.getAllAttributes(attrCert); |
| | | List<Attribute> dstList = dstEntry.getAllAttributes(attrCert); |
| | | |
| | | // Check for changes to the certificate value. |
| | | if (!srcList.equals(dstList)) |
| | |
| | | private void putAttributeTypeIfExist(Map<AttributeType, List<Attribute>> userAttrs, Entry srcEntry, |
| | | AttributeType attrType) |
| | | { |
| | | List<Attribute> attrList = srcEntry.getAttribute(attrType); |
| | | List<Attribute> attrList = srcEntry.getAllAttributes(attrType); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | userAttrs.put(attrType, new ArrayList<>(attrList)); |
| | |
| | | final ByteString vr = ByteString.valueOfUtf8(reversed); |
| | | for (AttributeType t : matchAttributes) |
| | | { |
| | | for (Attribute a : userEntry.getAttribute(t)) |
| | | for (Attribute a : userEntry.getAllAttributes(t)) |
| | | { |
| | | if (a.contains(vf) || |
| | | (config.isTestReversedPassword() && a.contains(vr)) || |
| | |
| | | // out the LDAP URLs that it contains. |
| | | LinkedHashSet<LDAPURL> memberURLs = new LinkedHashSet<>(); |
| | | AttributeType memberURLType = DirectoryServer.getSchema().getAttributeType(ATTR_MEMBER_URL_LC); |
| | | for (Attribute a : groupEntry.getAttribute(memberURLType)) |
| | | for (Attribute a : groupEntry.getAllAttributes(memberURLType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | |
| | | // Get the userCertificate attribute from the user's entry for use in the |
| | | // validation process. |
| | | List<Attribute> certAttrList = userEntry.getAttribute(certificateAttributeType); |
| | | List<Attribute> certAttrList = userEntry.getAllAttributes(certificateAttributeType); |
| | | switch (validationPolicy) |
| | | { |
| | | case ALWAYS: |
| | |
| | | // The bind DN is contained in an attribute in the user's entry. |
| | | mapBind: for (final AttributeType at : cfg.getMappedAttribute()) |
| | | { |
| | | for (final Attribute attribute : userEntry.getAttribute(at)) |
| | | for (final Attribute attribute : userEntry.getAllAttributes(at)) |
| | | { |
| | | if (!attribute.isEmpty()) |
| | | { |
| | |
| | | final LinkedList<SearchFilter> filterComponents = new LinkedList<>(); |
| | | for (final AttributeType at : cfg.getMappedAttribute()) |
| | | { |
| | | for (final Attribute attribute : userEntry.getAttribute(at)) |
| | | for (final Attribute attribute : userEntry.getAllAttributes(at)) |
| | | { |
| | | for (final ByteString value : attribute) |
| | | { |
| | |
| | | boolean foundValidCachedPasswordTime = false; |
| | | |
| | | foundCachedPasswordTime: |
| | | for (Attribute attribute : userEntry.getAttribute(cachedPasswordTimeAttribute)) |
| | | for (Attribute attribute : userEntry.getAllAttributes(cachedPasswordTimeAttribute)) |
| | | { |
| | | // Ignore any attributes with options. |
| | | if (!attribute.getAttributeDescription().hasOptions()) |
| | |
| | | // Next determine if there is a cached password. |
| | | ByteString cachedPassword = null; |
| | | foundCachedPassword: |
| | | for (Attribute attribute : userEntry.getAttribute(cachedPasswordAttribute)) |
| | | for (Attribute attribute : userEntry.getAllAttributes(cachedPasswordAttribute)) |
| | | { |
| | | // Ignore any attributes with options. |
| | | if (!attribute.getAttributeDescription().hasOptions()) |
| | |
| | | Entry userEntry = notification.getUserEntry(); |
| | | for (AttributeType t : addressAttrs) |
| | | { |
| | | for (Attribute a : userEntry.getAttribute(t)) |
| | | for (Attribute a : userEntry.getAllAttributes(t)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | throw new DirectoryException(ResultCode.OBJECTCLASS_VIOLATION, message); |
| | | } |
| | | |
| | | List<Attribute> memberAttrList = groupEntry.getAttribute(someMemberAttributeType); |
| | | List<Attribute> memberAttrList = groupEntry.getAllAttributes(someMemberAttributeType); |
| | | int membersCount = 0; |
| | | for (Attribute a : memberAttrList) |
| | | { |
| | |
| | | AccountStatusNotification notification) |
| | | { |
| | | Entry userEntry = notification.getUserEntry(); |
| | | for (Attribute a : userEntry.getAttribute(attributeType)) |
| | | for (Attribute a : userEntry.getAllAttributes(attributeType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | // Get the target group DN attribute from the entry, if there is one. |
| | | DN targetDN = null; |
| | | AttributeType targetType = DirectoryServer.getSchema().getAttributeType(ATTR_TARGET_GROUP_DN); |
| | | for (Attribute a : groupEntry.getAttribute(targetType)) |
| | | for (Attribute a : groupEntry.getAllAttributes(targetType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | { |
| | | // See if the entry being imported already contains an entryUUID attribute. |
| | | // If so, then leave it alone. |
| | | List<Attribute> uuidList = entry.getAttribute(entryUUIDType); |
| | | List<Attribute> uuidList = entry.getAllAttributes(entryUUIDType); |
| | | if (!uuidList.isEmpty()) |
| | | { |
| | | return PluginResult.ImportLDIF.continueEntryProcessing(); |
| | |
| | | |
| | | // See if the entry explicitly states the password policy that it should |
| | | // use. If so, then only use it to perform the encoding. |
| | | List<Attribute> attrList = entry.getAttribute(customPolicyAttribute); |
| | | List<Attribute> attrList = entry.getAllAttributes(customPolicyAttribute); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | DN policyDN = null; |
| | |
| | | PasswordStorageScheme<?>[] schemes = schemesByPolicy.get(policyDN); |
| | | if (schemes != null) |
| | | { |
| | | attrList = entry.getAttribute(policy.getPasswordAttribute()); |
| | | attrList = entry.getAllAttributes(policy.getPasswordAttribute()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | return PluginResult.ImportLDIF.continueEntryProcessing(); |
| | |
| | | // appropriate schemes. |
| | | for (AttributeType t : authPasswordTypes) |
| | | { |
| | | for (Attribute a : entry.getAttribute(t)) |
| | | for (Attribute a : entry.getAllAttributes(t)) |
| | | { |
| | | AttributeBuilder builder = new AttributeBuilder(a.getAttributeDescription()); |
| | | boolean gotError = false; |
| | |
| | | // appropriate schemes. |
| | | for (AttributeType t : userPasswordTypes) |
| | | { |
| | | for (Attribute a : entry.getAttribute(t)) |
| | | for (Attribute a : entry.getAllAttributes(t)) |
| | | { |
| | | AttributeBuilder builder = new AttributeBuilder(a.getAttributeDescription()); |
| | | boolean gotError = false; |
| | |
| | | |
| | | for (AttributeType attrType : attributeTypes) |
| | | { |
| | | final List<Attribute> attrs = entry.getAttribute(attrType, false); |
| | | final List<Attribute> attrs = entry.getAllAttributes(attrType, false); |
| | | PluginResult.PreOperation result = isIntegrityMaintained(attrs, entryDN, entryBaseDN); |
| | | if (result.getResultCode() != ResultCode.SUCCESS) |
| | | { |
| | |
| | | // Make sure all configured attributes have clean values. |
| | | for (AttributeType t : config.getAttributeType()) |
| | | { |
| | | for (Attribute a : entry.getAttribute(t)) |
| | | for (Attribute a : entry.getAllAttributes(t)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | List<ByteString> recordedValues = new LinkedList<>(); |
| | | for (AttributeType t : config.getType()) |
| | | { |
| | | for (Attribute a : entry.getAttribute(t)) |
| | | for (Attribute a : entry.getAllAttributes(t)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | DN entryDN = entry.getName(); |
| | | for (AttributeType t : config.getType()) |
| | | { |
| | | for (Attribute a : entry.getAttribute(t)) |
| | | for (Attribute a : entry.getAllAttributes(t)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | //Remove the attribute value from the map. |
| | | for (AttributeType t : config.getType()) |
| | | { |
| | | for (Attribute a : entry.getAttribute(t)) |
| | | for (Attribute a : entry.getAllAttributes(t)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | */ |
| | | public static List<Attribute> getHistoricalAttr(Entry entry) |
| | | { |
| | | return entry.getAttribute(HISTORICAL_ATTRIBUTE_NAME); |
| | | return entry.getAllAttributes(HISTORICAL_ATTRIBUTE_NAME); |
| | | } |
| | | |
| | | /** |
| | |
| | | |
| | | private Attribute getAttribute(String attributeName, Entry entry) |
| | | { |
| | | List<Attribute> attrs = entry.getAttribute(DirectoryServer.getSchema().getAttributeType(attributeName)); |
| | | List<Attribute> attrs = entry.getAllAttributes(DirectoryServer.getSchema().getAttributeType(attributeName)); |
| | | return !attrs.isEmpty() ? attrs.get(0) : null; |
| | | } |
| | | |
| | |
| | | if (resultEntry != null) |
| | | { |
| | | AttributeType synchronizationGenIDType = DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | List<Attribute> attrs = resultEntry.getAllAttributes(synchronizationGenIDType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | | Attribute attr = attrs.get(0); |
| | |
| | | private Iterator<ByteString> getAttributeValueIterator(SearchResultEntry resultEntry, String attrName) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> exclAttrs = resultEntry.getAttribute(attrType); |
| | | List<Attribute> exclAttrs = resultEntry.getAllAttributes(attrType); |
| | | if (!exclAttrs.isEmpty()) |
| | | { |
| | | Attribute exclAttr = exclAttrs.get(0); |
| | |
| | | SearchResultEntry resultEntry = result.get(0); |
| | | if (resultEntry != null) |
| | | { |
| | | List<Attribute> attrs = resultEntry.getAttribute(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAllAttributes(REPLICATION_GENERATION_ID); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | | Attribute attr = attrs.get(0); |
| | |
| | | private void updateStateFromEntry(SearchResultEntry resultEntry) |
| | | { |
| | | AttributeType synchronizationStateType = DirectoryServer.getSchema().getAttributeType(REPLICATION_STATE); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationStateType); |
| | | List<Attribute> attrs = resultEntry.getAllAttributes(synchronizationStateType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | | for (ByteString value : attrs.get(0)) |
| | |
| | | CSN dbMaxCSN = serverStateMaxCSN; |
| | | for (SearchResultEntry resEntry : op.getSearchEntries()) |
| | | { |
| | | for (ByteString attrValue : resEntry.getAttribute(histType).get(0)) |
| | | for (ByteString attrValue : resEntry.getAllAttributes(histType).get(0)) |
| | | { |
| | | HistoricalAttributeValue histVal = |
| | | new HistoricalAttributeValue(attrValue.toString()); |
| | |
| | | // Get the attribute that specifies which schema file(s) to add. |
| | | Entry taskEntry = getTaskEntry(); |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_ADDSCHEMAFILE_FILENAME); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(attrType); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | LocalizableMessage message = ERR_TASK_ADDSCHEMAFILE_NO_FILENAME.get( |
| | |
| | | AttributeType typeBackupDirectory = getSchema().getAttributeType(ATTR_BACKUP_DIRECTORY_PATH); |
| | | AttributeType typeIncrementalBaseID = getSchema().getAttributeType(ATTR_TASK_BACKUP_INCREMENTAL_BASE_ID); |
| | | |
| | | backUpAll = TaskUtils.getBoolean(taskEntry.getAttribute(typeBackupAll), false); |
| | | compress = TaskUtils.getBoolean(taskEntry.getAttribute(typeCompress), false); |
| | | encrypt = TaskUtils.getBoolean(taskEntry.getAttribute(typeEncrypt), false); |
| | | hash = TaskUtils.getBoolean(taskEntry.getAttribute(typeHash), false); |
| | | incremental = TaskUtils.getBoolean(taskEntry.getAttribute(typeIncremental), false); |
| | | signHash = TaskUtils.getBoolean(taskEntry.getAttribute(typeSignHash), false); |
| | | backendIDList = TaskUtils.getMultiValueString(taskEntry.getAttribute(typeBackendID)); |
| | | backupID = TaskUtils.getSingleValueString(taskEntry.getAttribute(typeBackupID)); |
| | | backUpAll = TaskUtils.getBoolean(taskEntry.getAllAttributes(typeBackupAll), false); |
| | | compress = TaskUtils.getBoolean(taskEntry.getAllAttributes(typeCompress), false); |
| | | encrypt = TaskUtils.getBoolean(taskEntry.getAllAttributes(typeEncrypt), false); |
| | | hash = TaskUtils.getBoolean(taskEntry.getAllAttributes(typeHash), false); |
| | | incremental = TaskUtils.getBoolean(taskEntry.getAllAttributes(typeIncremental), false); |
| | | signHash = TaskUtils.getBoolean(taskEntry.getAllAttributes(typeSignHash), false); |
| | | backendIDList = TaskUtils.getMultiValueString(taskEntry.getAllAttributes(typeBackendID)); |
| | | backupID = TaskUtils.getSingleValueString(taskEntry.getAllAttributes(typeBackupID)); |
| | | |
| | | String backupDirectoryPath = TaskUtils.getSingleValueString(taskEntry.getAttribute(typeBackupDirectory)); |
| | | String backupDirectoryPath = TaskUtils.getSingleValueString(taskEntry.getAllAttributes(typeBackupDirectory)); |
| | | backupDirectory = new File(backupDirectoryPath); |
| | | if (! backupDirectory.isAbsolute()) |
| | | { |
| | | backupDirectory = new File(DirectoryServer.getInstanceRoot(), backupDirectoryPath); |
| | | } |
| | | |
| | | incrementalBase = TaskUtils.getSingleValueString(taskEntry.getAttribute(typeIncrementalBaseID)); |
| | | incrementalBase = TaskUtils.getSingleValueString(taskEntry.getAllAttributes(typeIncrementalBaseID)); |
| | | |
| | | configEntries = TaskUtils.getBackendConfigEntries(); |
| | | } |
| | |
| | | private long getConnectionID(Entry taskEntry) throws DirectoryException |
| | | { |
| | | final AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_CONN_ID); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | for (Attribute a : taskEntry.getAllAttributes(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | private boolean mustNotifyClient(Entry taskEntry) throws DirectoryException |
| | | { |
| | | final AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_NOTIFY_CLIENT); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | for (Attribute a : taskEntry.getAllAttributes(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | private LocalizableMessage getDisconnectMessage(Entry taskEntry) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_TASK_DISCONNECT_MESSAGE); |
| | | for (Attribute a : taskEntry.getAttribute(attrType)) |
| | | for (Attribute a : taskEntry.getAllAttributes(attrType)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | includeBranchStrings = toListOfString(taskEntry, ATTR_TASK_EXPORT_INCLUDE_BRANCH); |
| | | excludeBranchStrings = toListOfString(taskEntry, ATTR_TASK_EXPORT_EXCLUDE_BRANCH); |
| | | |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeWrapColumn); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(typeWrapColumn); |
| | | wrapColumn = TaskUtils.getSingleValueInteger(attrList, 0); |
| | | |
| | | includeOperationalAttributes = toBoolean(taskEntry, true, ATTR_TASK_EXPORT_INCLUDE_OPERATIONAL_ATTRIBUTES); |
| | |
| | | private boolean toBoolean(Entry entry, boolean defaultValue, String attrName) |
| | | { |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | final List<Attribute> attrs = entry.getAllAttributes(attrType); |
| | | return TaskUtils.getBoolean(attrs, defaultValue); |
| | | } |
| | | |
| | | private ArrayList<String> toListOfString(Entry entry, String attrName) |
| | | { |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | final List<Attribute> attrs = entry.getAllAttributes(attrType); |
| | | return TaskUtils.getMultiValueString(attrs); |
| | | } |
| | | |
| | | private String toString(Entry entry, String attrName) |
| | | { |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrs = entry.getAttribute(attrType); |
| | | final List<Attribute> attrs = entry.getAllAttributes(attrType); |
| | | return TaskUtils.getSingleValueString(attrs); |
| | | } |
| | | |
| | |
| | | |
| | | private int asInt(Entry taskEntry, AttributeType attributeType) |
| | | { |
| | | final List<Attribute> attrList = taskEntry.getAttribute(attributeType); |
| | | final List<Attribute> attrList = taskEntry.getAllAttributes(attributeType); |
| | | return TaskUtils.getSingleValueInteger(attrList, 0); |
| | | } |
| | | |
| | | private boolean asBoolean(Entry taskEntry, AttributeType attributeType) |
| | | { |
| | | final List<Attribute> attrList = taskEntry.getAttribute(attributeType); |
| | | final List<Attribute> attrList = taskEntry.getAllAttributes(attributeType); |
| | | return TaskUtils.getBoolean(attrList, false); |
| | | } |
| | | |
| | | private String asString(Entry taskEntry, AttributeType attributeType) |
| | | { |
| | | final List<Attribute> attrList = taskEntry.getAttribute(attributeType); |
| | | final List<Attribute> attrList = taskEntry.getAllAttributes(attributeType); |
| | | return TaskUtils.getSingleValueString(attrList); |
| | | } |
| | | |
| | | private ArrayList<String> asListOfStrings(Entry taskEntry, AttributeType attributeType) |
| | | { |
| | | final List<Attribute> attrList = taskEntry.getAttribute(attributeType); |
| | | final List<Attribute> attrList = taskEntry.getAllAttributes(attributeType); |
| | | return TaskUtils.getMultiValueString(attrList); |
| | | } |
| | | |
| | |
| | | AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_TARGET_DOMAIN_DN); |
| | | AttributeType typeScope = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_TARGET_SCOPE); |
| | | |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | try |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_DN_SYNTAX, e); |
| | | } |
| | | |
| | | attrList = taskEntry.getAttribute(typeScope); |
| | | attrList = taskEntry.getAllAttributes(typeScope); |
| | | String targetString = TaskUtils.getSingleValueString(attrList); |
| | | target = domain.decodeTarget(targetString); |
| | | |
| | |
| | | AttributeType typeSourceScope = getSchema().getAttributeType(ATTR_TASK_INITIALIZE_SOURCE); |
| | | |
| | | List<Attribute> attrList; |
| | | attrList = taskEntry.getAttribute(typeDomainBase); |
| | | attrList = taskEntry.getAllAttributes(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | try |
| | |
| | | throw new DirectoryException(ResultCode.INVALID_DN_SYNTAX, e); |
| | | } |
| | | |
| | | attrList = taskEntry.getAttribute(typeSourceScope); |
| | | attrList = taskEntry.getAllAttributes(typeSourceScope); |
| | | String sourceString = TaskUtils.getSingleValueString(attrList); |
| | | source = domain.decodeSource(sourceString); |
| | | |
| | |
| | | Entry taskEntry = getTaskEntry(); |
| | | |
| | | AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_DOMAIN_DN); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeDomainBase); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | try |
| | |
| | | } |
| | | |
| | | AttributeType typeMaxDuration = getSchema().getAttributeType(ATTR_TASK_CONFLICTS_HIST_PURGE_MAX_DURATION); |
| | | attrList = taskEntry.getAttribute(typeMaxDuration); |
| | | attrList = taskEntry.getAllAttributes(typeMaxDuration); |
| | | String maxDurationStringInSec = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | if (maxDurationStringInSec != null) |
| | |
| | | isClearDegradedState = Boolean.parseBoolean(val); |
| | | |
| | | AttributeType typeIndex = getSchema().getAttributeType(ATTR_REBUILD_INDEX); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeIndex); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(typeIndex); |
| | | indexes = TaskUtils.getMultiValueString(attrList); |
| | | |
| | | rebuildMode = getRebuildMode(indexes); |
| | |
| | | private String asString(Entry taskEntry, String attrName) |
| | | { |
| | | final AttributeType attrType = getSchema().getAttributeType(attrName); |
| | | final List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | final List<Attribute> attrList = taskEntry.getAllAttributes(attrType); |
| | | return TaskUtils.getSingleValueString(attrList); |
| | | } |
| | | |
| | |
| | | private List<Attribute> getTaskParameter(Entry taskEntry, String attrTaskResetChangeNumberTo) |
| | | { |
| | | AttributeType taskAttr = getSchema().getAttributeType(attrTaskResetChangeNumberTo); |
| | | return taskEntry.getAttribute(taskAttr); |
| | | return taskEntry.getAllAttributes(taskAttr); |
| | | } |
| | | |
| | | @Override |
| | |
| | | |
| | | List<Attribute> attrList; |
| | | |
| | | attrList = taskEntry.getAttribute(typeBackupDirectory); |
| | | attrList = taskEntry.getAllAttributes(typeBackupDirectory); |
| | | String backupDirectoryPath = TaskUtils.getSingleValueString(attrList); |
| | | backupDirectory = new File(backupDirectoryPath); |
| | | if (! backupDirectory.isAbsolute()) |
| | |
| | | new File(DirectoryServer.getInstanceRoot(), backupDirectoryPath); |
| | | } |
| | | |
| | | attrList = taskEntry.getAttribute(typebackupID); |
| | | attrList = taskEntry.getAllAttributes(typebackupID); |
| | | backupID = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | attrList = taskEntry.getAttribute(typeVerifyOnly); |
| | | attrList = taskEntry.getAllAttributes(typeVerifyOnly); |
| | | verifyOnly = TaskUtils.getBoolean(attrList, false); |
| | | |
| | | } |
| | |
| | | |
| | | // Retrieves the eventual generation-ID |
| | | AttributeType typeNewValue = getSchema().getAttributeType(ATTR_TASK_SET_GENERATION_ID_NEW_VALUE); |
| | | List<Attribute> attrList = taskEntry.getAttribute(typeNewValue); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(typeNewValue); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | try |
| | |
| | | |
| | | // Retrieves the replication domain |
| | | AttributeType typeDomainBase = getSchema().getAttributeType(ATTR_TASK_SET_GENERATION_ID_DOMAIN_DN); |
| | | attrList = taskEntry.getAttribute(typeDomainBase); |
| | | attrList = taskEntry.getAllAttributes(typeDomainBase); |
| | | domainString = TaskUtils.getSingleValueString(attrList); |
| | | |
| | | try |
| | |
| | | shutdownMessage = INFO_TASK_SHUTDOWN_DEFAULT_MESSAGE.get(taskEntry.getName()); |
| | | |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(ATTR_SHUTDOWN_MESSAGE); |
| | | List<Attribute> attrList = taskEntry.getAttribute(attrType); |
| | | List<Attribute> attrList = taskEntry.getAllAttributes(attrType); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | Attribute attr = attrList.get(0); |
| | |
| | | } |
| | | |
| | | attrType = DirectoryServer.getSchema().getAttributeType(ATTR_RESTART_SERVER); |
| | | attrList = taskEntry.getAttribute(attrType); |
| | | attrList = taskEntry.getAllAttributes(attrType); |
| | | if (!attrList.isEmpty()) |
| | | { |
| | | Attribute attr = attrList.get(0); |
| | |
| | | */ |
| | | public static String getStringSingleValuedAttribute(Entry entry, String attrName) |
| | | { |
| | | List<Attribute> attributes = entry.getAttribute(attrName); |
| | | List<Attribute> attributes = entry.getAllAttributes(attrName); |
| | | if (!attributes.isEmpty()) |
| | | { |
| | | Attribute attribute = attributes.get(0); |
| | |
| | | { |
| | | try |
| | | { |
| | | List<Attribute> attributes = configEntry.getAttribute(ATTR_BACKEND_BASE_DN); |
| | | List<Attribute> attributes = configEntry.getAllAttributes(ATTR_BACKEND_BASE_DN); |
| | | if (!attributes.isEmpty()) |
| | | { |
| | | Attribute attribute = attributes.get(0); |
| | |
| | | Set<DN> baseDNs = new TreeSet<>(); |
| | | try |
| | | { |
| | | List<Attribute> attributes = configEntry.getAttribute(ATTR_BACKEND_BASE_DN); |
| | | List<Attribute> attributes = configEntry.getAllAttributes(ATTR_BACKEND_BASE_DN); |
| | | if (!attributes.isEmpty()) |
| | | { |
| | | Attribute attribute = attributes.get(0); |
| | |
| | | } |
| | | |
| | | private String getSingleStringValue(Entry entry, String attrName) { |
| | | List<Attribute> attrList = entry.getAttribute(attrName); |
| | | List<Attribute> attrList = entry.getAllAttributes(attrName); |
| | | if (attrList.size() == 1) { |
| | | Attribute attr = attrList.get(0); |
| | | if (!attr.isEmpty()) { |
| | |
| | | |
| | | private List<String> getMultiStringValue(Entry entry, String attrName) { |
| | | List<String> valuesList = new ArrayList<>(); |
| | | for (Attribute attr : entry.getAttribute(attrName)) { |
| | | for (Attribute attr : entry.getAllAttributes(attrName)) { |
| | | for (ByteString value : attr) { |
| | | valuesList.add(value.toString()); |
| | | } |
| | |
| | | * the attribute type |
| | | * @return the List of user or operational attributes |
| | | */ |
| | | private List<Attribute> getAttributes(AttributeType attrType) |
| | | private List<Attribute> getAllAttributes0(AttributeType attrType) |
| | | { |
| | | return getUserOrOperationalAttributes(attrType).get(attrType); |
| | | } |
| | |
| | | * attribute type, or an empty list if the specified |
| | | * attribute type is not present in this entry. |
| | | */ |
| | | public List<Attribute> getAttribute(AttributeType attributeType) |
| | | public List<Attribute> getAllAttributes(AttributeType attributeType) |
| | | { |
| | | return getAttribute(attributeType, true); |
| | | return getAllAttributes(attributeType, true); |
| | | } |
| | | |
| | | |
| | |
| | | * attribute type, or an empty list if the specified |
| | | * attribute type is not present in this entry. |
| | | */ |
| | | public List<Attribute> getAttribute(AttributeType attributeType, |
| | | public List<Attribute> getAllAttributes(AttributeType attributeType, |
| | | boolean includeSubordinates) |
| | | { |
| | | if (includeSubordinates && !attributeType.isObjectClass()) |
| | |
| | | * attribute type, or an empty list if the specified |
| | | * attribute type is not present in this entry. |
| | | */ |
| | | public List<Attribute> getAttribute(String nameOrOID) |
| | | public List<Attribute> getAllAttributes(String nameOrOID) |
| | | { |
| | | for (AttributeType attr : userAttributes.keySet()) |
| | | { |
| | | if (attr.hasNameOrOID(nameOrOID)) |
| | | { |
| | | return getAttribute(attr); |
| | | return getAllAttributes(attr); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | if (attr.hasNameOrOID(nameOrOID)) |
| | | { |
| | | return getAttribute(attr); |
| | | return getAllAttributes(attr); |
| | | } |
| | | } |
| | | |
| | |
| | | * attribute type is not present in this entry with the |
| | | * provided set of options. |
| | | */ |
| | | public List<Attribute> getAttribute(AttributeDescription attributeDescription) |
| | | public List<Attribute> getAllAttributes(AttributeDescription attributeDescription) |
| | | { |
| | | AttributeType attributeType = attributeDescription.getAttributeType(); |
| | | |
| | |
| | | public AttributeParser parseAttribute(String attributeDescription) |
| | | throws LocalizedIllegalArgumentException, NullPointerException |
| | | { |
| | | final List<Attribute> attribute = getAttribute(attributeDescription); |
| | | final List<Attribute> attribute = getAllAttributes(attributeDescription); |
| | | return AttributeParser.parseAttribute(!attribute.isEmpty() ? attribute.get(0) : null); |
| | | } |
| | | |
| | |
| | | */ |
| | | public List<Attribute> getUserAttribute(AttributeType attributeType) |
| | | { |
| | | return getAttribute(attributeType, userAttributes); |
| | | return getAllAttributes(attributeType, userAttributes); |
| | | } |
| | | |
| | | private List<Attribute> getAttribute(AttributeType attributeType, |
| | | private List<Attribute> getAllAttributes(AttributeType attributeType, |
| | | Map<AttributeType, List<Attribute>> attrs) |
| | | { |
| | | List<Attribute> results = new LinkedList<>(); |
| | |
| | | return results; |
| | | } |
| | | |
| | | private List<Attribute> getAttribute(AttributeDescription attributeDescription, |
| | | private List<Attribute> getAllAttributes(AttributeDescription attributeDescription, |
| | | Map<AttributeType, List<Attribute>> attrs) |
| | | { |
| | | List<Attribute> results = new LinkedList<>(); |
| | |
| | | */ |
| | | public List<Attribute> getOperationalAttribute(AttributeType attributeType) |
| | | { |
| | | return getAttribute(attributeType, operationalAttributes); |
| | | return getAllAttributes(attributeType, operationalAttributes); |
| | | } |
| | | |
| | | |
| | |
| | | */ |
| | | public List<Attribute> getOperationalAttribute(AttributeDescription attributeDescription) |
| | | { |
| | | return getAttribute(attributeDescription, operationalAttributes); |
| | | return getAllAttributes(attributeDescription, operationalAttributes); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | AttributeDescription attrDesc = attribute.getAttributeDescription(); |
| | | AttributeType attrType = attrDesc.getAttributeType(); |
| | | List<Attribute> attributes = getAttributes(attrType); |
| | | List<Attribute> attributes = getAllAttributes0(attrType); |
| | | if (attributes == null) |
| | | { |
| | | // There are no attributes with the same attribute type. |
| | |
| | | */ |
| | | public boolean hasValue(AttributeType attributeType, ByteString value) |
| | | { |
| | | for (Attribute a : getAttribute(attributeType)) |
| | | for (Attribute a : getAllAttributes(attributeType)) |
| | | { |
| | | if (!a.getAttributeDescription().hasOptions() && a.contains(value)) |
| | | { |
| | |
| | | try |
| | | { |
| | | DN inheritFromDN = null; |
| | | for (Attribute attr : getAttribute(subEntry.getInheritFromDNType())) |
| | | for (Attribute attr : getAllAttributes(subEntry.getInheritFromDNType())) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | { |
| | | try |
| | | { |
| | | for (Attribute attr : getAttribute(subEntry.getInheritFromRDNAttrType())) |
| | | for (Attribute attr : getAllAttributes(subEntry.getInheritFromRDNAttrType())) |
| | | { |
| | | inheritFromDN = subEntry.getInheritFromBaseDN(); |
| | | for (ByteString value : attr) |
| | |
| | | */ |
| | | public Attribute getExactAttribute(AttributeDescription attributeDescription) |
| | | { |
| | | List<Attribute> attributes = getAttributes(attributeDescription.getAttributeType()); |
| | | List<Attribute> attributes = getAllAttributes0(attributeDescription.getAttributeType()); |
| | | if (attributes != null) |
| | | { |
| | | for (Attribute attribute : attributes) |
| | |
| | | { |
| | | AttributeDescription attrDesc = attribute.getAttributeDescription(); |
| | | AttributeType attrType = attrDesc.getAttributeType(); |
| | | List<Attribute> attributes = getAttributes(attrType); |
| | | List<Attribute> attributes = getAllAttributes0(attrType); |
| | | if (attributes == null) |
| | | { |
| | | // Do nothing if we are deleting a non-existing attribute. |
| | |
| | | } |
| | | |
| | | // See if the entry has an attribute with the requested type. |
| | | List<Attribute> attrs = entry.getAttribute(attributeDescription); |
| | | List<Attribute> attrs = entry.getAllAttributes(attributeDescription); |
| | | if (attrs.isEmpty()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | |
| | | } |
| | | |
| | | // See if the entry has an attribute with the requested type. |
| | | List<Attribute> attrs = entry.getAttribute(attributeDescription); |
| | | List<Attribute> attrs = entry.getAllAttributes(attributeDescription); |
| | | if (attrs.isEmpty()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | |
| | | } |
| | | |
| | | // See if the entry has an attribute with the requested type. |
| | | List<Attribute> attrs = entry.getAttribute(attributeDescription); |
| | | List<Attribute> attrs = entry.getAllAttributes(attributeDescription); |
| | | if (attrs.isEmpty()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | |
| | | } |
| | | |
| | | // See if the entry has an attribute with the requested type. |
| | | List<Attribute> attrs = entry.getAttribute(attributeDescription); |
| | | List<Attribute> attrs = entry.getAllAttributes(attributeDescription); |
| | | if (attrs.isEmpty()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | |
| | | } |
| | | |
| | | // See if the entry has an attribute with the requested type. |
| | | List<Attribute> attrs = entry.getAttribute(attributeDescription); |
| | | List<Attribute> attrs = entry.getAllAttributes(attributeDescription); |
| | | if (attrs.isEmpty()) |
| | | { |
| | | if (logger.isTraceEnabled()) |
| | |
| | | } |
| | | else |
| | | { |
| | | final Iterable<Attribute> attrs = entry.getAttribute(attributeDescription); |
| | | final Iterable<Attribute> attrs = entry.getAllAttributes(attributeDescription); |
| | | result = assertionMatchesAnyAttribute(matchingRule, assertion, attrs, result, entry, completeFilter); |
| | | if (ConditionResult.TRUE.equals(result)) |
| | | { |
| | |
| | | { |
| | | if (this.isInheritedFromDNCollective) |
| | | { |
| | | for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_DN_LC)) |
| | | for (Attribute attr : entry.getAllAttributes(ATTR_INHERIT_COLLECTIVE_FROM_DN_LC)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | |
| | | if (this.isInheritedFromRDNCollective) |
| | | { |
| | | for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN_LC)) |
| | | for (Attribute attr : entry.getAllAttributes(ATTR_INHERIT_COLLECTIVE_FROM_RDN_LC)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | break; |
| | | } |
| | | } |
| | | for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE_LC)) |
| | | for (Attribute attr : entry.getAllAttributes(ATTR_INHERIT_COLLECTIVE_FROM_RDN_TYPE_LC)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | break; |
| | | } |
| | | } |
| | | for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_FROM_BASE_LC)) |
| | | for (Attribute attr : entry.getAllAttributes(ATTR_INHERIT_COLLECTIVE_FROM_BASE_LC)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | for (Attribute attr : entry.getAttribute(ATTR_INHERIT_COLLECTIVE_ATTR_LC)) |
| | | for (Attribute attr : entry.getAllAttributes(ATTR_INHERIT_COLLECTIVE_ATTR_LC)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | // Establish collective attribute conflict behavior. |
| | | if (this.isCollective || this.isInheritedCollective) |
| | | { |
| | | for (Attribute attr : entry.getAttribute(ATTR_COLLECTIVE_CONFLICT_BEHAVIOR_LC)) |
| | | for (Attribute attr : entry.getAllAttributes(ATTR_COLLECTIVE_CONFLICT_BEHAVIOR_LC)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | String specString = null; |
| | | boolean isValidSpec = true; |
| | | AttributeType specAttrType = DirectoryServer.getSchema().getAttributeType(ATTR_SUBTREE_SPEC_LC); |
| | | for (Attribute attr : entry.getAttribute(specAttrType)) |
| | | for (Attribute attr : entry.getAllAttributes(specAttrType)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | |
| | | // See if a password was specified. |
| | | AttributeType passwordAttribute = passwordPolicy.getPasswordAttribute(); |
| | | List<Attribute> attrList = entry.getAttribute(passwordAttribute); |
| | | List<Attribute> attrList = entry.getAllAttributes(passwordAttribute); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | // The entry doesn't have a password, so no action is required. |
| | |
| | | PasswordPolicy policy = pwPolicyState.getAuthenticationPolicy(); |
| | | |
| | | AttributeType pwType = policy.getPasswordAttribute(); |
| | | if (userEntry.getAttribute(pwType).isEmpty()) |
| | | if (userEntry.getAllAttributes(pwType).isEmpty()) |
| | | { |
| | | throw new DirectoryException(ResultCode.INVALID_CREDENTIALS, |
| | | ERR_BIND_OPERATION_NO_PASSWORD.get()); |
| | |
| | | Arg2<Object, Object> cannotProcessAttributeMessage) |
| | | { |
| | | AttributeType attrType = DirectoryServer.getSchema().getAttributeType(attributeTypeName); |
| | | List<Attribute> attrList = userEntry.getAttribute(attrType); |
| | | List<Attribute> attrList = userEntry.getAllAttributes(attrType); |
| | | if (attrList.size() == 1) |
| | | { |
| | | Attribute a = attrList.get(0); |
| | |
| | | |
| | | // Actually perform the compare operation. |
| | | AttributeDescription attrDesc = getAttributeDescription(); |
| | | List<Attribute> attrList = entry.getAttribute(attrDesc); |
| | | List<Attribute> attrList = entry.getAllAttributes(attrDesc); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | setResultCode(ResultCode.NO_SUCH_ATTRIBUTE); |
| | |
| | | |
| | | // We still need to check if the pre-encoded password matches |
| | | // an existing value, to decrease the number of passwords. |
| | | List<Attribute> attrList = currentEntry.getAttribute(pwdAttrDesc.getAttributeType()); |
| | | List<Attribute> attrList = currentEntry.getAllAttributes(pwdAttrDesc.getAttributeType()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, ERR_MODIFY_NO_EXISTING_VALUES.get()); |
| | |
| | | } |
| | | else |
| | | { |
| | | List<Attribute> attrList = currentEntry.getAttribute(pwdAttrDesc.getAttributeType()); |
| | | List<Attribute> attrList = currentEntry.getAllAttributes(pwdAttrDesc.getAttributeType()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, ERR_MODIFY_NO_EXISTING_VALUES.get()); |
| | |
| | | public static HashSet<PluginType> getPluginTypes(Entry e) |
| | | { |
| | | HashSet<PluginType> pluginTypes = new HashSet<>(); |
| | | for (Attribute a : e.getAttribute("ds-cfg-plugin-type")) |
| | | for (Attribute a : e.getAllAttributes("ds-cfg-plugin-type")) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | |
| | | // Save Global ACI. |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf(ACCESS_HANDLER_DN)); |
| | | List<Attribute> attrs = e.getAttribute(ConfigConstants.ATTR_AUTHZ_GLOBAL_ACI); |
| | | List<Attribute> attrs = e.getAllAttributes(ConfigConstants.ATTR_AUTHZ_GLOBAL_ACI); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | | Reporter.log("Saved global ACI attribute"); |
| | |
| | | private String readCookieFromNthEntry(List<SearchResultEntry> entries, int i) |
| | | { |
| | | SearchResultEntry entry = entries.get(i); |
| | | return entry.getAttribute("changelogcookie").get(0).iterator().next().toString(); |
| | | return entry.getAllAttributes("changelogcookie").get(0).iterator().next().toString(); |
| | | } |
| | | |
| | | private String assertEntriesContainsCSNsAndReadLastCookie(String test, List<SearchResultEntry> entries, |
| | |
| | | private static void assertAttributeValues(Entry entry, String attrName, Set<String> expectedValues) |
| | | { |
| | | final Set<String> values = new HashSet<>(); |
| | | for (Attribute attr : entry.getAttribute(attrName)) |
| | | for (Attribute attr : entry.getAllAttributes(attrName)) |
| | | { |
| | | for (ByteString value : attr) |
| | | { |
| | |
| | | |
| | | private static String getAttributeValue(Entry entry, String attrName) |
| | | { |
| | | List<Attribute> attrs = entry.getAttribute(attrName); |
| | | List<Attribute> attrs = entry.getAllAttributes(attrName); |
| | | if (attrs.isEmpty()) |
| | | { |
| | | return null; |
| | |
| | | assertTrue(schemaEntry.hasAttribute(mtType)); |
| | | |
| | | ByteString oldMTValue = |
| | | schemaEntry.getAttribute(mtType).get(0).iterator().next(); |
| | | schemaEntry.getAllAttributes(mtType).get(0).iterator().next(); |
| | | |
| | | String ldif = toLdif( |
| | | "dn: cn=schema", |
| | |
| | | assertTrue(schemaEntry.hasAttribute(mtType)); |
| | | |
| | | ByteString newMTValue = |
| | | schemaEntry.getAttribute(mtType).get(0).iterator().next(); |
| | | schemaEntry.getAllAttributes(mtType).get(0).iterator().next(); |
| | | assertNotEquals(oldMTValue, newMTValue); |
| | | } |
| | | |
| | |
| | | |
| | | // check the user attributes were not changed |
| | | for (AttributeType attrType : entryBefore.getUserAttributes().keySet()) { |
| | | List<Attribute> listBefore = entryBefore.getAttribute(attrType); |
| | | List<Attribute> listAfter = entryAfter.getAttribute(attrType); |
| | | List<Attribute> listBefore = entryBefore.getAllAttributes(attrType); |
| | | List<Attribute> listAfter = entryAfter.getAllAttributes(attrType); |
| | | assertThat(listBefore).hasSameSizeAs(listAfter); |
| | | |
| | | for (Attribute attrBefore : listBefore) { |
| | |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | List<Attribute> attrList = e.getAttribute(a.getAttributeDescription()); |
| | | List<Attribute> attrList = e.getAllAttributes(a.getAttributeDescription()); |
| | | assertFalse(attrList.isEmpty()); |
| | | |
| | | boolean foundFoo = false; |
| | |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | assertThat(e.getAttribute(a.getAttributeDescription().getAttributeType())).isNotEmpty(); |
| | | assertThat(e.getAllAttributes(a.getAttributeDescription().getAttributeType())).isNotEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | } |
| | |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | assertThat(e.getAttribute(attrType)).isEmpty(); |
| | | assertThat(e.getAllAttributes(attrType)).isEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | } |
| | |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("ou"); |
| | | List<Attribute> attrList = e.getAllAttributes("ou"); |
| | | assertThat(attrList).isNotEmpty(); |
| | | } |
| | | |
| | |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,o=test")); |
| | | List<Attribute> attrList = e.getAttribute(getObjectClassAttributeType()); |
| | | List<Attribute> attrList = e.getAllAttributes(getObjectClassAttributeType()); |
| | | assertTrue(findAttributeValueIgnoreCase(attrList, "top")); |
| | | } |
| | | |
| | |
| | | public void testGetAndAddModifications() throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isEmpty(); |
| | | assertThat(e.getAllAttributes(getDescriptionAttributeType())).isEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | UpdatePreOpPlugin.addModification( |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isNotEmpty(); |
| | | assertThat(e.getAllAttributes(getDescriptionAttributeType())).isNotEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | } |
| | |
| | | public void testSuccessAddAttribute() throws Exception |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isEmpty(); |
| | | assertThat(e.getAllAttributes(getDescriptionAttributeType())).isEmpty(); |
| | | |
| | | RawModification mod = newRawModification(REPLACE, "description", "foo"); |
| | | ModifyOperation modifyOperation = processModify("o=test", mod); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | assertThat(e.getAttribute(getDescriptionAttributeType())).isNotEmpty(); |
| | | assertThat(e.getAllAttributes(getDescriptionAttributeType())).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(getOAttributeType()); |
| | | List<Attribute> attrList = e.getAllAttributes(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 1); |
| | | |
| | | ModifyOperation modifyOperation = processModify("o=test", newRawModification(ADD, "o", "test2")); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("o=test")); |
| | | attrList = e.getAttribute(getOAttributeType()); |
| | | attrList = e.getAllAttributes(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | | |
| | |
| | | { |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(getOAttributeType()); |
| | | List<Attribute> attrList = e.getAllAttributes(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 1); |
| | | |
| | | RawModification mod = newRawModification(ADD, "o;lang-en-us", "test"); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf(baseDN)); |
| | | attrList = e.getAttribute(getOAttributeType()); |
| | | attrList = e.getAllAttributes(getOAttributeType()); |
| | | assertEquals(countValues(attrList), 2); |
| | | } |
| | | |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType()); |
| | | List<Attribute> attrList = e.getAllAttributes(getEmployeeNumberAttributeType()); |
| | | assertIntegerValueExists(attrList, 2); |
| | | } |
| | | |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType()); |
| | | List<Attribute> attrList = e.getAllAttributes(getEmployeeNumberAttributeType()); |
| | | assertIntegerValueExists(attrList, 11); |
| | | } |
| | | |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = e.getAttribute(getEmployeeNumberAttributeType()); |
| | | List<Attribute> attrList = e.getAllAttributes(getEmployeeNumberAttributeType()); |
| | | assertIntegerValueExists(attrList, 0); |
| | | } |
| | | |
| | |
| | | "displayName: Test User", |
| | | "userPassword: password"); |
| | | |
| | | String passwd = firstValue(e.getAttribute(getUserPasswordAttributeType())); |
| | | String passwd = firstValue(e.getAllAttributes(getUserPasswordAttributeType())); |
| | | assertNotNull(passwd); |
| | | |
| | | String path = TestCaseUtils.createTempFile( |
| | |
| | | // @formatter:on |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | List<Attribute> attrList = e.getAllAttributes("userpassword"); |
| | | assertThat(attrList).hasSize(1); |
| | | assertFalse(attrList.get(0).getAttributeDescription().hasOptions()); |
| | | assertThat(attrList.get(0)).hasSize(1); |
| | |
| | | // @formatter:on |
| | | |
| | | e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | List<Attribute> attrList = e.getAllAttributes("userpassword"); |
| | | assertThat(attrList).hasSize(1); |
| | | assertFalse(attrList.get(0).getAttributeDescription().hasOptions()); |
| | | assertThat(attrList.get(0)).hasSize(1); |
| | |
| | | // @formatter:on |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | List<Attribute> attrList = e.getAllAttributes("userpassword"); |
| | | assertThat(attrList).hasSize(1); |
| | | assertFalse(attrList.get(0).getAttributeDescription().hasOptions()); |
| | | assertThat(attrList.get(0)).hasSize(1); |
| | |
| | | // @formatter:on |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("cn=Test User,o=test")); |
| | | List<Attribute> attrList = e.getAttribute("userpassword"); |
| | | List<Attribute> attrList = e.getAllAttributes("userpassword"); |
| | | assertThat(attrList).hasSize(1); |
| | | assertFalse(attrList.get(0).getAttributeDescription().hasOptions()); |
| | | assertThat(attrList.get(0)).hasSize(1); |
| | |
| | | retrieveSuccessfulOperationElements(modifyOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user," + baseDN)); |
| | | List<Attribute> attrList = e.getAttribute(getUserCertificateAttributeType()); |
| | | List<Attribute> attrList = e.getAllAttributes(getUserCertificateAttributeType()); |
| | | assertThat(attrList).hasSize(1); |
| | | Attribute a = attrList.get(0); |
| | | assertTrue(a.getAttributeDescription().hasOption("binary")); |
| | |
| | | { |
| | | for (String attrType : virtualAttrTypes) |
| | | { |
| | | List<Attribute> attrList = entry.getAttribute(attrType); |
| | | List<Attribute> attrList = entry.getAllAttributes(attrType); |
| | | |
| | | if (stripVirtualAttributes) |
| | | { |
| | |
| | | { |
| | | for (String attrType : realAttrTypes) |
| | | { |
| | | List<Attribute> attrList = entry.getAttribute(attrType); |
| | | List<Attribute> attrList = entry.getAllAttributes(attrType); |
| | | |
| | | if (stripRealAttributes) |
| | | { |
| | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=normal user,ou=people,o=test")); |
| | | assertNotNull(e); |
| | | |
| | | List<Attribute> description = e.getAttribute("description"); |
| | | List<Attribute> description = e.getAllAttributes("description"); |
| | | assertThat(description).isEmpty(); |
| | | |
| | | // Collective user will inherit the collective description attribute. |
| | | e = DirectoryServer.getEntry(DN.valueOf("uid=collective user,ou=people,o=test")); |
| | | assertNotNull(e); |
| | | |
| | | description = e.getAttribute("description"); |
| | | description = e.getAllAttributes("description"); |
| | | assertThat(description).hasSize(1); |
| | | Attribute attribute = description.get(0); |
| | | assertEquals(attribute.size(), 1); |
| | |
| | | private void assertAttrValue(Entry newEntry, String attrName, String expectedAttrValue) |
| | | { |
| | | AttributeType at = DirectoryServer.getSchema().getAttributeType(attrName); |
| | | List<Attribute> attrList = newEntry.getAttribute(at); |
| | | List<Attribute> attrList = newEntry.getAllAttributes(at); |
| | | assertThat(attrList).hasSize(1); |
| | | |
| | | // Because deleteOldRDN is true, the values from RDN and the entry have to be identical |
| | |
| | | runModifyDNOp(oldEntryDN, "cn=Aaccf Amar Test", true, "dc=example,dc=com"); |
| | | assertSuccess(modifyDNOperation); |
| | | Entry entry = assertCnAttrValues(newEntryDN, oldEntryDN); |
| | | assertThat(entry.getAttribute("uid")).isEmpty(); |
| | | assertThat(entry.getAllAttributes("uid")).isEmpty(); |
| | | examineCompletedOPNoExtraPluginCounts(modifyDNOperation); |
| | | |
| | | InvocationCounterPlugin.resetAllCounters(); |
| | | modifyDNOperation = runModifyDNOp(newEntryDN, "uid=user.0", false, "ou=People,dc=example,dc=com"); |
| | | assertSuccess(modifyDNOperation); |
| | | Entry newOldEntry = assertCnAttrValues(oldEntryDN, newEntryDN); |
| | | for(Attribute attribute : newOldEntry.getAttribute("uid")) |
| | | for(Attribute attribute : newOldEntry.getAllAttributes("uid")) |
| | | { |
| | | assertTrue(attribute.contains(b("user.0"))); |
| | | } |
| | |
| | | assertNotNull(entry); |
| | | assertNull(DirectoryServer.getEntry(dn(entryDN2))); |
| | | |
| | | for (Attribute attribute : entry.getAttribute("cn")) |
| | | for (Attribute attribute : entry.getAllAttributes("cn")) |
| | | { |
| | | assertTrue(attribute.contains(b("Aaccf Amar Test"))); |
| | | assertTrue(attribute.contains(b("Aaccf Amar"))); |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(entryDNType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(entryDNType); |
| | | List<Attribute> attrList = e.getAllAttributes(entryDNType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(entryUUIDType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(entryUUIDType); |
| | | List<Attribute> attrList = e.getAllAttributes(entryUUIDType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | "dc: example"); |
| | | assertTrue(e.hasAttribute(entryUUIDType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(entryUUIDType); |
| | | List<Attribute> attrList = e.getAllAttributes(entryUUIDType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(governingStructureRuleType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(governingStructureRuleType); |
| | | List<Attribute> attrList = e.getAllAttributes(governingStructureRuleType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(hasSubordinatesType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(hasSubordinatesType); |
| | | List<Attribute> attrList = e.getAllAttributes(hasSubordinatesType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | | for (Attribute a : e.getAllAttributes(isMemberOfType)) |
| | | { |
| | | assertEquals(a.size(), 1); |
| | | |
| | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | | for (Attribute a : e.getAllAttributes(isMemberOfType)) |
| | | { |
| | | assertEquals(a.size(), 1); |
| | | |
| | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | | for (Attribute a : e.getAllAttributes(isMemberOfType)) |
| | | { |
| | | assertEquals(a.size(), 1); |
| | | |
| | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | | for (Attribute a : e.getAllAttributes(isMemberOfType)) |
| | | { |
| | | assertEquals(a.size(), 2); |
| | | |
| | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("uid=test.user,ou=People,o=test")); |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(isMemberOfType)); |
| | | for (Attribute a : e.getAttribute(isMemberOfType)) |
| | | for (Attribute a : e.getAllAttributes(isMemberOfType)) |
| | | { |
| | | assertEquals(a.size(), 4); |
| | | |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(numSubordinatesType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(numSubordinatesType); |
| | | List<Attribute> attrList = e.getAllAttributes(numSubordinatesType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2012 profiq, s.r.o. |
| | | * Portions Copyright 2014-2015 ForgeRock AS. |
| | | * Portions Copyright 2014-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | SearchResultEntry entry = entries.get(0); |
| | | assertNotNull(entry); |
| | | |
| | | List<Attribute> attrs = entry.getAttribute(attributeName); |
| | | List<Attribute> attrs = entry.getAllAttributes(attributeName); |
| | | assertEquals(attrs.size(), 1); |
| | | |
| | | Attribute attr = attrs.get(0); |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(structuralObjectClassType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(structuralObjectClassType); |
| | | List<Attribute> attrList = e.getAllAttributes(structuralObjectClassType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(subschemaSubentryType)); |
| | | |
| | | List<Attribute> attrList = e.getAttribute(subschemaSubentryType); |
| | | List<Attribute> attrList = e.getAllAttributes(subschemaSubentryType); |
| | | assertThat(attrList).isNotEmpty(); |
| | | for (Attribute a : attrList) |
| | | { |
| | |
| | | final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT); |
| | | InternalSearchOperation searchOperation = conn.processSearch(request); |
| | | |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType); |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAllAttributes(descriptionType); |
| | | assertEquals(attrList.size(), 1); |
| | | |
| | | Attribute attr = attrList.get(0); |
| | |
| | | final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT); |
| | | InternalSearchOperation searchOperation = conn.processSearch(request); |
| | | |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType); |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAllAttributes(descriptionType); |
| | | assertEquals(attrList.size(), 1); |
| | | |
| | | Attribute attr = attrList.get(0); |
| | |
| | | final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT); |
| | | InternalSearchOperation searchOperation = conn.processSearch(request); |
| | | |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType); |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAllAttributes(descriptionType); |
| | | assertEquals(attrList.size(), 1); |
| | | |
| | | Attribute attr = attrList.get(0); |
| | |
| | | final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT); |
| | | InternalSearchOperation searchOperation = conn.processSearch(request); |
| | | |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType); |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAllAttributes(descriptionType); |
| | | assertEquals(attrList.size(), 1); |
| | | |
| | | Attribute attr = attrList.get(0); |
| | |
| | | final SearchRequest request = newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT); |
| | | InternalSearchOperation searchOperation = conn.processSearch(request); |
| | | |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType); |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAllAttributes(descriptionType); |
| | | assertEquals(attrList.size(), 1); |
| | | |
| | | Attribute a = attrList.get(0); |
| | |
| | | newSearchRequest(DN.valueOf(userDN), SearchScope.BASE_OBJECT).addAttribute("description"); |
| | | InternalSearchOperation searchOperation = conn.processSearch(request); |
| | | |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAttribute(descriptionType); |
| | | List<Attribute> attrList = searchOperation.getSearchEntries().get(0).getAllAttributes(descriptionType); |
| | | assertEquals(attrList.size(), 1); |
| | | |
| | | Attribute a = attrList.get(0); |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(memberType)); |
| | | |
| | | Attribute a = e.getAttribute(memberType).get(0); |
| | | Attribute a = e.getAllAttributes(memberType).get(0); |
| | | assertEquals(a.size(), 4); |
| | | assertTrue(a.contains(ByteString.valueOfUtf8(u1.toString()))); |
| | | |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(memberType)); |
| | | |
| | | Attribute a = e.getAttribute(memberType).get(0); |
| | | Attribute a = e.getAllAttributes(memberType).get(0); |
| | | assertEquals(a.size(), 1); |
| | | |
| | | ByteString v = ByteString.valueOfUtf8(u4.toString()); |
| | |
| | | ModifyOperation modifyOperation = getRootConnection().processModify(d1, mods); |
| | | assertEquals(modifyOperation.getResultCode(), ResultCode.SUCCESS); |
| | | |
| | | a = e.getAttribute(memberType).get(0); |
| | | a = e.getAllAttributes(memberType).get(0); |
| | | assertEquals(a.size(), 4); |
| | | assertTrue(a.contains(v)); |
| | | |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(memberType)); |
| | | |
| | | Attribute a = e.getAttribute(memberType).get(0); |
| | | Attribute a = e.getAllAttributes(memberType).get(0); |
| | | assertEquals(a.size(), 1); |
| | | |
| | | ByteString v = ByteString.valueOfUtf8(u4.toString()); |
| | |
| | | assertNotNull(e); |
| | | assertTrue(e.hasAttribute(memberType)); |
| | | |
| | | a = e.getAttribute(memberType).get(0); |
| | | a = e.getAllAttributes(memberType).get(0); |
| | | assertEquals(a.size(), 0); |
| | | |
| | | v = ByteString.valueOfUtf8(u4.toString()); |
| | |
| | | DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn); |
| | | plugin.doLDIFImport(importConfig, e); |
| | | |
| | | assertThat(e.getAttribute("entryuuid")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("entryuuid")).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | DirectoryServer.getPluginConfigManager().getRegisteredPlugin(dn); |
| | | plugin.doLDIFImport(importConfig, e); |
| | | |
| | | assertThat(e.getAttribute("entryuuid")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("entryuuid")).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | assertThat(e.getAttribute("entryuuid")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("entryuuid")).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | "objectClass: device", |
| | | "cn: test", |
| | | "entryUUID: " + UUID.randomUUID()); |
| | | assertThat(e.getAttribute("entryuuid")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("entryuuid")).isNotEmpty(); |
| | | } |
| | | } |
| | |
| | | assertFalse(searchOperation.getSearchEntries().isEmpty()); |
| | | |
| | | Entry e = searchOperation.getSearchEntries().get(0); |
| | | assertThat(e.getAttribute("o")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("o")).isNotEmpty(); |
| | | } |
| | | } |
| | |
| | | "objectClass: top", |
| | | "objectClass: device", |
| | | "cn: test"); |
| | | assertThat(e.getAttribute("creatorsname")).isNotEmpty(); |
| | | assertThat(e.getAttribute("createtimestamp")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("creatorsname")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("createtimestamp")).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | Entry e = DirectoryConfig.getEntry(DN.valueOf("o=test")); |
| | | assertNotNull(e); |
| | | assertThat(e.getAttribute("modifiersname")).isNotEmpty(); |
| | | assertThat(e.getAttribute("modifytimestamp")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("modifiersname")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("modifytimestamp")).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | |
| | | e = DirectoryConfig.getEntry(DN.valueOf("cn=test2,o=test")); |
| | | assertNotNull(e); |
| | | assertThat(e.getAttribute("modifiersname")).isNotEmpty(); |
| | | assertThat(e.getAttribute("modifytimestamp")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("modifiersname")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("modifytimestamp")).isNotEmpty(); |
| | | } |
| | | } |
| | |
| | | private boolean contains(Entry entry, String attrName, String password) |
| | | { |
| | | boolean foundPwd = false; |
| | | for (Attribute a : entry.getAttribute(attrName)) |
| | | for (Attribute a : entry.getAllAttributes(attrName)) |
| | | { |
| | | for (ByteString val : a) |
| | | { |
| | |
| | | |
| | | Entry entry = DirectoryServer.getEntry(testEntry.getName()); |
| | | assertNotNull(entry); |
| | | assertThat(entry.getAttribute("sambantpassword")).isEmpty(); |
| | | assertThat(entry.getAttribute("sambalmpassword")).isEmpty(); |
| | | assertThat(entry.getAllAttributes("sambantpassword")).isEmpty(); |
| | | assertThat(entry.getAllAttributes("sambalmpassword")).isEmpty(); |
| | | |
| | | TestCaseUtils.deleteEntry(entry); |
| | | } |
| | |
| | | |
| | | Entry entry = DirectoryServer.getEntry(testEntry.getName()); |
| | | assertNotNull(entry); |
| | | assertThat(entry.getAttribute("sambantpassword")).isEmpty(); |
| | | assertThat(entry.getAttribute("sambalmpassword")).isEmpty(); |
| | | assertThat(entry.getAllAttributes("sambantpassword")).isEmpty(); |
| | | assertThat(entry.getAllAttributes("sambalmpassword")).isEmpty(); |
| | | |
| | | TestCaseUtils.deleteEntry(entry); |
| | | } |
| | |
| | | Attribute sambaPwdLastSetAttr = |
| | | Attributes.create("sambapwdlastset", String.valueOf(1339012789L)); |
| | | |
| | | assertThat(entry.getAttribute("sambapwdlastset")).contains(sambaPwdLastSetAttr); |
| | | assertThat(entry.getAllAttributes("sambapwdlastset")).contains(sambaPwdLastSetAttr); |
| | | TestCaseUtils.deleteEntry(testEntry); |
| | | } |
| | | finally |
| | |
| | | List<SearchResultEntry> entries = searchOperation.getSearchEntries(); |
| | | SearchResultEntry e = entries.get(0); |
| | | assertNotNull(e); |
| | | List<Attribute> attrs = e.getAttribute("usercertificate"); |
| | | List<Attribute> attrs = e.getAllAttributes("usercertificate"); |
| | | Attribute a = attrs.get(0); |
| | | assertNotNull(a); |
| | | assertThat(a.getAttributeDescription().getOptions()).contains("binary"); |
| | |
| | | { |
| | | final Entry newEntry = DirectoryServer.getEntry(dn); |
| | | assertNotNull(newEntry); |
| | | List<Attribute> attrList = newEntry.getAttribute(attrTypeStr); |
| | | List<Attribute> attrList = newEntry.getAllAttributes(attrTypeStr); |
| | | Assertions.assertThat(attrList).isNotEmpty(); |
| | | Attribute attr = attrList.get(0); |
| | | boolean foundAttributeValue = attr.contains(ByteString.valueOfUtf8(valueString)); |
| | |
| | | { |
| | | Entry newEntry = DirectoryServer.getEntry(dn); |
| | | assertNotNull(newEntry); |
| | | Attribute attribute = newEntry.getAttribute("entryuuid").get(0); |
| | | Attribute attribute = newEntry.getAllAttributes("entryuuid").get(0); |
| | | String found = attribute.iterator().next().toString(); |
| | | assertNotNull(found, "Entry: " + dn + " Could not be found."); |
| | | return found; |
| | |
| | | |
| | | // Read the entry back to get its UUID. |
| | | Entry entry = DirectoryServer.getEntry(dn1); |
| | | List<Attribute> attrs = entry.getAttribute(entryuuidType); |
| | | List<Attribute> attrs = entry.getAllAttributes(entryuuidType); |
| | | String entryuuid = attrs.get(0).iterator().next().toString(); |
| | | |
| | | // A change on a first server. |
| | |
| | | |
| | | // Read the entry to see how the conflict was resolved. |
| | | entry = DirectoryServer.getEntry(dn1); |
| | | attrs = entry.getAttribute(attrType); |
| | | attrs = entry.getAllAttributes(attrType); |
| | | String attrValue1 = attrs.get(0).iterator().next().toString(); |
| | | |
| | | // the value should be the last (time t2) value added |
| | |
| | | |
| | | // Read the entry to see how the conflict was resolved. |
| | | entry = DirectoryServer.getEntry(dn1); |
| | | attrs = entry.getAttribute(attrType); |
| | | attrs = entry.getAllAttributes(attrType); |
| | | |
| | | // there should not be a value (delete at time t2) |
| | | assertNull(attrs); |
| | |
| | | */ |
| | | private boolean assertConflictAttributeExists(Entry entry) |
| | | { |
| | | return !entry.getAttribute("ds-sync-confict").isEmpty(); |
| | | return !entry.getAllAttributes("ds-sync-confict").isEmpty(); |
| | | } |
| | | |
| | | @DataProvider(name="assured") |
| | |
| | | throw new Exception("Unknown assured type"); |
| | | } |
| | | |
| | | List<Attribute> attrs = entry.getAttribute(assuredAttr); |
| | | List<Attribute> attrs = entry.getAllAttributes(assuredAttr); |
| | | if (attrs.isEmpty()) |
| | | { |
| | | return Collections.emptyMap(); |
| | |
| | | |
| | | private List<ByteString> getValues(Entry entry, Modification mod) |
| | | { |
| | | return getValues(entry.getAttribute(mod.getAttribute().getAttributeDescription())); |
| | | return getValues(entry.getAllAttributes(mod.getAttribute().getAttributeDescription())); |
| | | } |
| | | |
| | | private List<ByteString> getValues(List<Attribute> attributes) |
| | |
| | | |
| | | private void assertAttributeValues(Entry entry, String... expectedValues) |
| | | { |
| | | List<ByteString> actualValues = getValues(entry.getAttribute(ATTRIBUTE_NAME)); |
| | | List<ByteString> actualValues = getValues(entry.getAllAttributes(ATTRIBUTE_NAME)); |
| | | assertThat(actualValues).containsOnly(toByteStrings(expectedValues)); |
| | | } |
| | | |
| | |
| | | |
| | | private ByteString getActualValue(Entry entry, Modification mod) |
| | | { |
| | | return getActualValue(entry.getAttribute(mod.getAttribute().getAttributeDescription())); |
| | | return getActualValue(entry.getAllAttributes(mod.getAttribute().getAttributeDescription())); |
| | | } |
| | | |
| | | private ByteString getActualValue(List<Attribute> attributes) |
| | |
| | | |
| | | private void assertAttributeValue(Entry entry, String expectedValue) |
| | | { |
| | | ByteString actualValue = getActualValue(entry.getAttribute(ATTRIBUTE_NAME)); |
| | | ByteString actualValue = getActualValue(entry.getAllAttributes(ATTRIBUTE_NAME)); |
| | | assertEquals(actualValue, expectedValue != null ? ByteString.valueOfUtf8(expectedValue) : null); |
| | | } |
| | | |
| | |
| | | |
| | | AttributeType synchronizationGenIDType = |
| | | DirectoryServer.getSchema().getAttributeType(REPLICATION_GENERATION_ID); |
| | | List<Attribute> attrs = resultEntry.getAttribute(synchronizationGenIDType); |
| | | List<Attribute> attrs = resultEntry.getAllAttributes(synchronizationGenIDType); |
| | | if (!attrs.isEmpty()) |
| | | { |
| | | Attribute attr = attrs.get(0); |
| | |
| | | */ |
| | | private static void checkEntryAttributeValue(Entry entry, String attributeName, String attributeValue) |
| | | { |
| | | List<Attribute> attrs = entry.getAttribute(attributeName); |
| | | List<Attribute> attrs = entry.getAllAttributes(attributeName); |
| | | assertThat(attrs).as("Was expecting attribute " + attributeName + "=" + attributeValue).hasSize(1); |
| | | Attribute attr = attrs.get(0); |
| | | Iterator<ByteString> attrValues = attr.iterator(); |
| | |
| | | assertEquals(newEntryDn, newEntry.getName()); |
| | | assertTrue(newEntry.hasObjectClass(getInetOrgPersonObjectClass())); |
| | | checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept"); |
| | | assertThat(newEntry.getAttribute("givenName")).isEmpty(); |
| | | assertThat(newEntry.getAllAttributes("givenName")).isEmpty(); |
| | | } |
| | | finally |
| | | { |
| | |
| | | assertEquals(newEntryDn, newEntry.getName()); |
| | | assertTrue(newEntry.hasObjectClass(getInetOrgPersonObjectClass())); |
| | | checkEntryAttributeValue(newEntry, "displayName", "ValueToBeKept"); |
| | | assertThat(newEntry.getAttribute("description")).isEmpty(); |
| | | assertThat(newEntry.getAllAttributes("description")).isEmpty(); |
| | | } |
| | | finally |
| | | { |
| | |
| | | |
| | | // Read the entry back to get its historical and included CSN |
| | | Entry entry = DirectoryServer.getEntry(dn1); |
| | | List<Attribute> attrs1 = entry.getAttribute(histType); |
| | | List<Attribute> attrs1 = entry.getAllAttributes(histType); |
| | | Assertions.assertThat(attrs1).isNotEmpty(); |
| | | |
| | | String histValue = attrs1.get(0).iterator().next().toString(); |
| | |
| | | assertEquals(resultCode, 0); |
| | | |
| | | Entry entry2 = DirectoryServer.getEntry(dn1); |
| | | List<Attribute> attrs2 = entry2.getAttribute(histType); |
| | | List<Attribute> attrs2 = entry2.getAllAttributes(histType); |
| | | Assertions.assertThat(attrs2).isNotEmpty(); |
| | | |
| | | for (ByteString av : attrs2.get(0)) { |
| | |
| | | assertEquals(mod.getAttribute(), values3and4); |
| | | |
| | | // check that the entry now contains value1 and value2 and no other values. |
| | | Attribute resultEntryAttr = entry.getAttribute(DESCRIPTION).get(0); |
| | | Attribute resultEntryAttr = entry.getAllAttributes(DESCRIPTION).get(0); |
| | | assertEquals(resultEntryAttr, values1and2); |
| | | |
| | | Attribute attr = buildSyncHist(DESCRIPTION, |
| | |
| | | |
| | | private String getEntryUUID(Entry entry) |
| | | { |
| | | List<Attribute> uuidAttrs = entry.getAttribute(getEntryUUIDAttributeType()); |
| | | List<Attribute> uuidAttrs = entry.getAllAttributes(getEntryUUIDAttributeType()); |
| | | return uuidAttrs.get(0).iterator().next().toString(); |
| | | } |
| | | |
| | |
| | | testModify(entry, hist, 1, true, newModification(DELETE, DISPLAYNAME, "aValue")); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(hist.encodeAndPurge(), attr); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(hist.encodeAndPurge(), attrDel); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(hist.encodeAndPurge(), attr); |
| | | |
| | | // The entry should have no value |
| | | List<Attribute> attrs = entry.getAttribute(DESCRIPTION); |
| | | List<Attribute> attrs = entry.getAllAttributes(DESCRIPTION); |
| | | assertEquals(attrs.get(0), Attributes.create(DESCRIPTION, "value2", "value3", "value4")); |
| | | } |
| | | |
| | |
| | | assertEquals(hist.encodeAndPurge(), attr); |
| | | |
| | | // The entry should have no value |
| | | List<Attribute> attrs = entry.getAttribute(DESCRIPTION); |
| | | List<Attribute> attrs = entry.getAllAttributes(DESCRIPTION); |
| | | assertEquals(attrs.get(0), Attributes.create(DESCRIPTION, "value3", "value4")); |
| | | } |
| | | |
| | |
| | | assertEquals(hist.encodeAndPurge(), attrDel); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(hist.encodeAndPurge(), attr); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(hist.encodeAndPurge(), attr); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(hist.encodeAndPurge(), attrDel); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(hist.encodeAndPurge(), attrDel); |
| | | |
| | | // The entry should have no value |
| | | assertThat(entry.getAttribute(DISPLAYNAME)).isEmpty(); |
| | | assertThat(entry.getAllAttributes(DISPLAYNAME)).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | assertEquals(getEntryUUID(resultEntry.getName()), |
| | | "c9cb8c3c-615a-4122-865d-50323aaaed48", |
| | | "The wrong entry has been renamed"); |
| | | assertThat(resultEntry.getAttribute(LDAPReplicationDomain.DS_SYNC_CONFLICT)).isEmpty(); |
| | | assertThat(resultEntry.getAllAttributes(LDAPReplicationDomain.DS_SYNC_CONFLICT)).isEmpty(); |
| | | } |
| | | |
| | | private AddMsg addMsg(Entry entry, CSN csn, String parentUUID, String childUUID) |
| | |
| | | assertEquals(getEntryUUID(resultEntry.getName()), |
| | | "c9cb8c3c-615a-4122-865d-50323aaaed48", |
| | | "The wrong entry has been renamed"); |
| | | assertThat(resultEntry.getAttribute(LDAPReplicationDomain.DS_SYNC_CONFLICT)).isEmpty(); |
| | | assertThat(resultEntry.getAllAttributes(LDAPReplicationDomain.DS_SYNC_CONFLICT)).isEmpty(); |
| | | } |
| | | |
| | | private Entry createAndAddEntry(String commonName) throws Exception |
| | |
| | | { |
| | | Entry e = readSchemaEntry(f); |
| | | return e != null |
| | | ? e.getAttribute(attributeType) |
| | | ? e.getAllAttributes(attributeType) |
| | | // An empty schema file. This is OK. |
| | | : Collections.<Attribute> emptyList(); |
| | | } |
| | |
| | | assertThat(entries).isNotEmpty(); |
| | | SearchResultEntry e = entries.get(0); |
| | | assertNotNull(e); |
| | | Attribute attr = e.getAttribute("ldapsyntaxes").get(0); |
| | | Attribute attr = e.getAllAttributes("ldapsyntaxes").get(0); |
| | | |
| | | //There are other ways of doing it but we will extract the OID |
| | | //from the attribute values and then check to see if our |
| | |
| | | Entry taskEntry = getTaskEntry(); |
| | | if (taskEntry != null) |
| | | { |
| | | for (Attribute a : taskEntry.getAttribute(TASK_SLEEP_TIME_ATTRIBUTE)) |
| | | for (Attribute a : taskEntry.getAllAttributes(TASK_SLEEP_TIME_ATTRIBUTE)) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | * information: "Portions Copyright [year] [name of copyright owner]". |
| | | * |
| | | * Copyright 2006-2008 Sun Microsystems, Inc. |
| | | * Portions Copyright 2015 ForgeRock AS. |
| | | * Portions Copyright 2015-2016 ForgeRock AS. |
| | | */ |
| | | |
| | | package org.opends.server.tools; |
| | |
| | | }; |
| | | assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0); |
| | | Entry e = readEntry(); |
| | | assertThat(e.getAttribute("objectclass")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("objectclass")).isNotEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | }; |
| | | assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0); |
| | | Entry e = readEntry(); |
| | | assertThat(e.getAttribute("objectclass")).isEmpty(); |
| | | assertThat(e.getAllAttributes("objectclass")).isEmpty(); |
| | | } |
| | | |
| | | /** |
| | |
| | | }; |
| | | assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0); |
| | | Entry e = readEntry(); |
| | | assertThat(e.getAttribute("objectclass")).isEmpty(); |
| | | assertThat(e.getAttribute("mail")).isNotEmpty(); |
| | | assertThat(e.getAttribute("uid")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("objectclass")).isEmpty(); |
| | | assertThat(e.getAllAttributes("mail")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("uid")).isNotEmpty(); |
| | | } |
| | | |
| | | |
| | |
| | | }; |
| | | assertEquals(LDIFSearch.mainSearch(args, false, System.out, System.err), 0); |
| | | Entry e = readEntry(); |
| | | assertThat(e.getAttribute("objectclass")).isEmpty(); |
| | | assertThat(e.getAttribute("mail")).isNotEmpty(); |
| | | assertThat(e.getAttribute("uid")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("objectclass")).isEmpty(); |
| | | assertThat(e.getAllAttributes("mail")).isNotEmpty(); |
| | | assertThat(e.getAllAttributes("uid")).isNotEmpty(); |
| | | } |
| | | } |
| | |
| | | |
| | | Entry e = readEntry(outLdifFilePath); |
| | | assertNotNull(e); |
| | | List<Attribute> attrs = e.getAttribute(attrName); |
| | | List<Attribute> attrs = e.getAllAttributes(attrName); |
| | | assertFalse(attrs.isEmpty()); |
| | | Attribute a = attrs.get(0); |
| | | Attribute expectedRes = Attributes.create(attrName, expectedValue); |
| | |
| | | |
| | | Entry e = readEntry(outLdifFilePath); |
| | | assertNotNull(e); |
| | | List<Attribute> attrs = e.getAttribute("cn"); |
| | | List<Attribute> attrs = e.getAllAttributes("cn"); |
| | | assertFalse(attrs.isEmpty()); |
| | | Attribute a = attrs.get(0); |
| | | assertTrue(a.iterator().next().toString().matches("Foo <[A-Z]>\\{1\\}Bar"), |
| | |
| | | |
| | | Entry entry = createTestEntry(type, values); |
| | | Set<SubtreeSpecification> result = new HashSet<>(); |
| | | List<Attribute> attributes = entry.getAttribute(type, true); |
| | | List<Attribute> attributes = entry.getAllAttributes(type, true); |
| | | for (Attribute a : attributes) |
| | | { |
| | | for (ByteString value : a) |
| | |
| | | AttributeType uidType = getUIDAttributeType(); |
| | | AttributeType mnType = getModifiersNameAttributeType(); |
| | | |
| | | assertThat(e.getAttribute(ocType)).hasSize(1); |
| | | assertThat(e.getAttribute(cnType)).hasSize(2); |
| | | assertThat(e.getAttribute(nameType)).hasSize(6); |
| | | assertThat(e.getAllAttributes(ocType)).hasSize(1); |
| | | assertThat(e.getAllAttributes(cnType)).hasSize(2); |
| | | assertThat(e.getAllAttributes(nameType)).hasSize(6); |
| | | |
| | | assertThat(e.getAttribute(nameType, false)).isEmpty(); |
| | | assertThat(e.getAttribute(uidType)).isEmpty(); |
| | | assertThat(e.getAttribute(mnType)).hasSize(1); |
| | | assertThat(e.getAttribute("objectclass")).hasSize(1); |
| | | assertThat(e.getAttribute("cn")).hasSize(2); |
| | | assertThat(e.getAttribute("uid")).isEmpty(); |
| | | assertThat(e.getAttribute("modifiersname")).hasSize(1); |
| | | assertThat(e.getAllAttributes(nameType, false)).isEmpty(); |
| | | assertThat(e.getAllAttributes(uidType)).isEmpty(); |
| | | assertThat(e.getAllAttributes(mnType)).hasSize(1); |
| | | assertThat(e.getAllAttributes("objectclass")).hasSize(1); |
| | | assertThat(e.getAllAttributes("cn")).hasSize(2); |
| | | assertThat(e.getAllAttributes("uid")).isEmpty(); |
| | | assertThat(e.getAllAttributes("modifiersname")).hasSize(1); |
| | | |
| | | LinkedHashSet<String> options = null; |
| | | assertThat(e.getAttribute(AttributeDescription.create(ocType, options))).hasSize(1); |
| | | assertThat(e.getAttribute(AttributeDescription.create(cnType, options))).hasSize(2); |
| | | assertThat(e.getAttribute(AttributeDescription.create(nameType, options))).hasSize(6); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(ocType, options))).hasSize(1); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(cnType, options))).hasSize(2); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(nameType, options))).hasSize(6); |
| | | |
| | | assertThat(e.getAttribute(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(mnType, options))).hasSize(1); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(mnType, options))).hasSize(1); |
| | | |
| | | options = new LinkedHashSet<>(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(ocType, options))).hasSize(1); |
| | | assertThat(e.getAttribute(AttributeDescription.create(cnType, options))).hasSize(2); |
| | | assertThat(e.getAttribute(AttributeDescription.create(nameType, options))).hasSize(6); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(ocType, options))).hasSize(1); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(cnType, options))).hasSize(2); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(nameType, options))).hasSize(6); |
| | | |
| | | assertThat(e.getAttribute(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(mnType, options))).hasSize(1); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(mnType, options))).hasSize(1); |
| | | |
| | | options.add("lang-en-US"); |
| | | assertThat(e.getAttribute(AttributeDescription.create(ocType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(cnType, options))).hasSize(1); |
| | | assertThat(e.getAttribute(AttributeDescription.create(nameType, options))).hasSize(3); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(ocType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(cnType, options))).hasSize(1); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(nameType, options))).hasSize(3); |
| | | |
| | | assertThat(e.getAttribute(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(mnType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(mnType, options))).isEmpty(); |
| | | |
| | | options.add("lang-en-GB"); |
| | | assertThat(e.getAttribute(AttributeDescription.create(ocType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(cnType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(nameType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(mnType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(ocType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(cnType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(nameType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(mnType, options))).isEmpty(); |
| | | |
| | | options.clear(); |
| | | options.add("lang-en-GB"); |
| | | assertThat(e.getAttribute(AttributeDescription.create(ocType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(cnType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(nameType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAttribute(AttributeDescription.create(mnType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(ocType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(cnType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(nameType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(uidType, options))).isEmpty(); |
| | | assertThat(e.getAllAttributes(AttributeDescription.create(mnType, options))).isEmpty(); |
| | | } |
| | | |
| | | |