Removed Attribute.getAttributeType()
| | |
| | | for (Modification m : modifications) |
| | | { |
| | | Attribute modAttr = m.getAttribute(); |
| | | AttributeType modAttrType = modAttr.getAttributeType(); |
| | | AttributeType modAttrType = modAttr.getAttributeDescription().getAttributeType(); |
| | | |
| | | if (modAttrType.equals(aciType) |
| | | /* |
| | |
| | | final Attribute attr = e.getObjectClassAttribute(); |
| | | if (attr != null) |
| | | { |
| | | AttributeType ocType = attr.getAttributeType(); |
| | | typeList.add(ocType); |
| | | typeList.add(attr.getAttributeDescription().getAttributeType()); |
| | | } |
| | | typeList.addAll(e.getUserAttributes().keySet()); |
| | | typeList.addAll(e.getOperationalAttributes().keySet()); |
| | |
| | | boolean hasAci = false, hasGlobalAci = false; |
| | | for (Modification mod : mods) |
| | | { |
| | | AttributeType attributeType = mod.getAttribute() |
| | | .getAttributeType(); |
| | | AttributeType attributeType = mod.getAttribute().getAttributeDescription().getAttributeType(); |
| | | if (attributeType.equals(AciHandler.aciType)) |
| | | { |
| | | hasAci = true; |
| | |
| | | import static org.opends.messages.BackendMessages.*; |
| | | import static org.opends.messages.ReplicationMessages.*; |
| | | import static org.opends.server.config.ConfigConstants.*; |
| | | import static org.opends.server.core.DirectoryServer.*; |
| | | import static org.opends.server.replication.plugin.MultimasterReplication.*; |
| | | import static org.opends.server.replication.server.changelog.api.DBCursor.KeyMatchingStrategy.*; |
| | | import static org.opends.server.replication.server.changelog.api.DBCursor.PositionStrategy.*; |
| | |
| | | private static final long CHANGE_NUMBER_FOR_EMPTY_CURSOR = 0L; |
| | | |
| | | private static final String CHANGE_NUMBER_ATTR = "changeNumber"; |
| | | private static final String CHANGE_NUMBER_ATTR_LC = CHANGE_NUMBER_ATTR.toLowerCase(); |
| | | private static final String ENTRY_SENDER_ATTACHMENT = OID_ECL_COOKIE_EXCHANGE_CONTROL + ".entrySender"; |
| | | |
| | | /** The set of objectclasses that will be used in root entry. */ |
| | |
| | | } |
| | | |
| | | /** The attribute type for the "creatorsName" attribute. */ |
| | | private static final AttributeType CREATORS_NAME_TYPE = |
| | | DirectoryServer.getAttributeType(OP_ATTR_CREATORS_NAME_LC); |
| | | private static final AttributeType CREATORS_NAME_TYPE = getAttributeType(OP_ATTR_CREATORS_NAME); |
| | | /** The attribute type for the "modifiersName" attribute. */ |
| | | private static final AttributeType MODIFIERS_NAME_TYPE = |
| | | DirectoryServer.getAttributeType(OP_ATTR_MODIFIERS_NAME_LC); |
| | | private static final AttributeType MODIFIERS_NAME_TYPE = getAttributeType(OP_ATTR_MODIFIERS_NAME); |
| | | |
| | | /** The base DN for the external change log. */ |
| | | public static final DN CHANGELOG_BASE_DN; |
| | |
| | | final StringBuilder builder = new StringBuilder(256); |
| | | for (Attribute attr : addMsg.getAttributes()) |
| | | { |
| | | if (attr.getAttributeType().equals(CREATORS_NAME_TYPE) && !attr.isEmpty()) |
| | | if (attr.getAttributeDescription().getAttributeType().equals(CREATORS_NAME_TYPE) && !attr.isEmpty()) |
| | | { |
| | | // This attribute is not multi-valued. |
| | | changeInitiatorsName = attr.iterator().next().toString(); |
| | |
| | | { |
| | | final Attribute attr = mod.getAttribute(); |
| | | if (mod.getModificationType() == ModificationType.REPLACE |
| | | && attr.getAttributeType().equals(MODIFIERS_NAME_TYPE) |
| | | && attr.getAttributeDescription().getAttributeType().equals(MODIFIERS_NAME_TYPE) |
| | | && !attr.isEmpty()) |
| | | { |
| | | // This attribute is not multi-valued. |
| | |
| | | { |
| | | private static final LocalizedLogger logger = LocalizedLogger.getLoggerForThisClass(); |
| | | |
| | | /** |
| | | * The set of user-defined attributes that will be included in the base |
| | | * monitor entry. |
| | | */ |
| | | /** The set of user-defined attributes that will be included in the base monitor entry. */ |
| | | private ArrayList<Attribute> userDefinedAttributes; |
| | | |
| | | /** The set of objectclasses that will be used in monitor entries. */ |
| | | private final HashMap<ObjectClass, String> monitorObjectClasses = new LinkedHashMap<>(2); |
| | | |
| | | /** The DN of the configuration entry for this backend. */ |
| | | private DN configEntryDN; |
| | | |
| | | /** The current configuration state. */ |
| | | private MonitorBackendCfg currentConfig; |
| | | |
| | | /** The DN for the base monitor entry. */ |
| | | private DN baseMonitorDN; |
| | | |
| | | /** The set of base DNs for this backend. */ |
| | | private DN[] baseDNs; |
| | | |
| | |
| | | // Add all the user-defined attributes. |
| | | for (final Attribute a : userDefinedAttributes) |
| | | { |
| | | final AttributeType type = a.getAttributeType(); |
| | | final AttributeType type = a.getAttributeDescription().getAttributeType(); |
| | | |
| | | final HashMap<AttributeType, List<Attribute>> attrsMap = |
| | | type.isOperational() ? monitorOperationalAttrs : monitorUserAttrs; |
| | |
| | | |
| | | private void put(final HashMap<AttributeType, List<Attribute>> attrsMap, final Attribute attr) |
| | | { |
| | | attrsMap.put(attr.getAttributeType(), newArrayList(attr)); |
| | | attrsMap.put(attr.getAttributeDescription().getAttributeType(), newArrayList(attr)); |
| | | } |
| | | |
| | | /** |
| | |
| | | // Take the rest of the information from the monitor data. |
| | | for (final Attribute a : monitorAttrs) |
| | | { |
| | | final AttributeType type = a.getAttributeType(); |
| | | final AttributeType type = a.getAttributeDescription().getAttributeType(); |
| | | |
| | | List<Attribute> attrs = attrMap.get(type); |
| | | if (attrs == null) |
| | |
| | | */ |
| | | private boolean isMonitorConfigAttribute(final Attribute attribute) |
| | | { |
| | | final AttributeType attrType = attribute.getAttributeType(); |
| | | final AttributeType attrType = attribute.getAttributeDescription().getAttributeType(); |
| | | return attrType.hasName(ATTR_COMMON_NAME) |
| | | || attrType.hasName(ATTR_BACKEND_ENABLED.toLowerCase()) |
| | | || attrType.hasName(ATTR_BACKEND_CLASS.toLowerCase()) |
| | |
| | | */ |
| | | private boolean isDSEConfigAttribute(Attribute attribute) |
| | | { |
| | | AttributeType attrType = attribute.getAttributeType(); |
| | | AttributeType attrType = attribute.getAttributeDescription().getAttributeType(); |
| | | return attrType.hasName(ATTR_ROOT_DSE_SUBORDINATE_BASE_DN.toLowerCase()) |
| | | || attrType.hasName(ATTR_ROOTDSE_SHOW_ALL_ATTRIBUTES.toLowerCase()) |
| | | || attrType.hasName(ATTR_COMMON_NAME); |
| | |
| | | { |
| | | for (Attribute a : attributes) |
| | | { |
| | | AttributeType type = a.getAttributeType(); |
| | | AttributeType type = a.getAttributeDescription().getAttributeType(); |
| | | |
| | | final Map<AttributeType, List<Attribute>> attrsMap = type.isOperational() && !showAllAttributes |
| | | ? operationalAttrs |
| | |
| | | if (!attribute.isEmpty()) |
| | | { |
| | | List<Attribute> attrs = newArrayList(attribute); |
| | | final AttributeType attrType = attribute.getAttributeType(); |
| | | final AttributeType attrType = attribute.getAttributeDescription().getAttributeType(); |
| | | if (showAllAttributes || !attrType.isOperational()) |
| | | { |
| | | userAttrs.put(attrType, attrs); |
| | |
| | | */ |
| | | private boolean isSchemaConfigAttribute(Attribute attribute) |
| | | { |
| | | AttributeType attrType = attribute.getAttributeType(); |
| | | AttributeType attrType = attribute.getAttributeDescription().getAttributeType(); |
| | | return attrType.hasName(ATTR_SCHEMA_ENTRY_DN.toLowerCase()) || |
| | | attrType.hasName(ATTR_BACKEND_ENABLED.toLowerCase()) || |
| | | attrType.hasName(ATTR_BACKEND_CLASS.toLowerCase()) || |
| | |
| | | Map<AttributeType, List<Attribute>> userAttrs, |
| | | Map<AttributeType, List<Attribute>> operationalAttrs) |
| | | { |
| | | AttributeType type = attribute.getAttributeType(); |
| | | AttributeType type = attribute.getAttributeDescription().getAttributeType(); |
| | | Map<AttributeType, List<Attribute>> attrsMap = type.isOperational() ? operationalAttrs : userAttrs; |
| | | List<Attribute> attrs = attrsMap.get(type); |
| | | if (attrs == null) |
| | |
| | | |
| | | Attribute attribute = builder.toAttribute(); |
| | | ArrayList<Attribute> attrList = newArrayList(attribute); |
| | | if (attribute.getAttributeType().isOperational() |
| | | if (attribute.getAttributeDescription().getAttributeType().isOperational() |
| | | && (ignoreShowAllOption || !showAllAttributes)) |
| | | { |
| | | operationalAttrs.put(attribute.getAttributeType(), attrList); |
| | | operationalAttrs.put(attribute.getAttributeDescription().getAttributeType(), attrList); |
| | | } |
| | | else |
| | | { |
| | | userAttrs.put(attribute.getAttributeType(), attrList); |
| | | userAttrs.put(attribute.getAttributeDescription().getAttributeType(), attrList); |
| | | } |
| | | } |
| | | |
| | |
| | | // to add a schema element that already exists and treat it as a |
| | | // replacement of that existing element. |
| | | Attribute a = m.getAttribute(); |
| | | AttributeType at = a.getAttributeType(); |
| | | AttributeType at = a.getAttributeDescription().getAttributeType(); |
| | | switch (m.getModificationType().asEnum()) |
| | | { |
| | | case ADD: |
| | |
| | | Attribute a = m.getAttribute(); |
| | | |
| | | if (m.getModificationType() != ModificationType.ADD || |
| | | !a.getAttributeType().equals(objectClassesType)) |
| | | !a.getAttributeDescription().getAttributeType().equals(objectClassesType)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | Attribute a = m.getAttribute(); |
| | | |
| | | if (m.getModificationType() != ModificationType.ADD || |
| | | !a.getAttributeType().equals(nameFormsType)) |
| | | !a.getAttributeDescription().getAttributeType().equals(nameFormsType)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | Attribute a = m.getAttribute(); |
| | | |
| | | if (m.getModificationType() != ModificationType.ADD || |
| | | !a.getAttributeType().equals(ditStructureRulesType)) |
| | | !a.getAttributeDescription().getAttributeType().equals(ditStructureRulesType)) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | for (Attribute attribute : attributes.values()) |
| | | { |
| | | ArrayList<Attribute> attrList = newArrayList(attribute); |
| | | schemaEntry.putAttribute(attribute.getAttributeType(), attrList); |
| | | schemaEntry.putAttribute(attribute.getAttributeDescription().getAttributeType(), attrList); |
| | | } |
| | | } |
| | | |
| | |
| | | for (Modification mod : mods) |
| | | { |
| | | Attribute modAttr = mod.getAttribute(); |
| | | AttributeType modAttrType = modAttr.getAttributeType(); |
| | | AttributeType modAttrType = modAttr.getAttributeDescription().getAttributeType(); |
| | | if (modAttrType.equals(referralType)) |
| | | { |
| | | Attribute a = mod.getAttribute(); |
| | |
| | | for (Modification mod : mods) |
| | | { |
| | | Attribute modAttr = mod.getAttribute(); |
| | | AttributeType modAttrType = modAttr.getAttributeType(); |
| | | AttributeType modAttrType = modAttr.getAttributeDescription().getAttributeType(); |
| | | if (modAttrType.equals(indexAttributeType) |
| | | || subTypes.contains(modAttrType)) |
| | | { |
| | |
| | | final List<AttributeType> subTypes = DirectoryServer.getSchema().getSubTypes(attributeType); |
| | | for (final Modification mod : mods) |
| | | { |
| | | final AttributeType modAttrType = mod.getAttribute().getAttributeType(); |
| | | final AttributeType modAttrType = mod.getAttribute().getAttributeDescription().getAttributeType(); |
| | | if (modAttrType.equals(attributeType) |
| | | || subTypes.contains(modAttrType)) |
| | | { |
| | |
| | | try |
| | | { |
| | | this.taskState = taskState; |
| | | Attribute attr = Attributes.create(ATTR_TASK_STATE, taskState.toString()); |
| | | taskEntry.putAttribute(attr.getAttributeType(), newArrayList(attr)); |
| | | putAttribute(ATTR_TASK_STATE, taskState.toString()); |
| | | } |
| | | finally |
| | | { |
| | |
| | | } |
| | | } |
| | | |
| | | private void putAttribute(String attrName, String attrValue) |
| | | { |
| | | Attribute attr = Attributes.create(attrName, attrValue); |
| | | taskEntry.putAttribute(attr.getAttributeDescription().getAttributeType(), newArrayList(attr)); |
| | | } |
| | | |
| | | /** |
| | | * Sets a state for this task that is the result of a call to |
| | | * {@link #interruptTask(TaskState, LocalizableMessage)}. |
| | |
| | | { |
| | | this.actualStartTime = actualStartTime; |
| | | Date d = new Date(actualStartTime); |
| | | String startTimeStr = StaticUtils.formatDateTimeString(d); |
| | | Attribute attr = Attributes.create(ATTR_TASK_ACTUAL_START_TIME, startTimeStr); |
| | | taskEntry.putAttribute(attr.getAttributeType(), newArrayList(attr)); |
| | | putAttribute(ATTR_TASK_ACTUAL_START_TIME, StaticUtils.formatDateTimeString(d)); |
| | | } |
| | | finally |
| | | { |
| | |
| | | SimpleDateFormat dateFormat = new SimpleDateFormat(DATE_FORMAT_GMT_TIME); |
| | | dateFormat.setTimeZone(TimeZone.getTimeZone("UTC")); |
| | | Date d = new Date(completionTime); |
| | | Attribute attr = Attributes.create(ATTR_TASK_COMPLETION_TIME, dateFormat.format(d)); |
| | | taskEntry.putAttribute(attr.getAttributeType(), newArrayList(attr)); |
| | | putAttribute(ATTR_TASK_COMPLETION_TIME, dateFormat.format(d)); |
| | | } |
| | | finally |
| | | { |
| | |
| | | } |
| | | |
| | | Attribute a = m.getAttribute(); |
| | | AttributeType at = a.getAttributeType(); |
| | | AttributeType at = a.getAttributeDescription().getAttributeType(); |
| | | if (!at.hasName(ATTR_TASK_STATE)) { |
| | | return false; |
| | | } |
| | |
| | | |
| | | Attribute attr = Attributes.create(ATTR_TASK_STATE, TaskState.RECURRING.toString()); |
| | | Entry recurringTaskEntry = recurringTask.getRecurringTaskEntry(); |
| | | recurringTaskEntry.putAttribute(attr.getAttributeType(), newArrayList(attr)); |
| | | recurringTaskEntry.putAttribute(attr.getAttributeDescription().getAttributeType(), newArrayList(attr)); |
| | | |
| | | if (scheduleIteration) |
| | | { |
| | |
| | | { |
| | | for (org.opends.server.types.Attribute a : monitor.getMonitorData()) |
| | | { |
| | | if (attrType.equals(a.getAttributeType())) |
| | | if (attrType.equals(a.getAttributeDescription().getAttributeType())) |
| | | { |
| | | if (a.isEmpty()) |
| | | { |
| | |
| | | { |
| | | for (org.opends.server.types.Attribute a : monitor.getMonitorData()) |
| | | { |
| | | if (attrType.equals(a.getAttributeType())) |
| | | if (attrType.equals(a.getAttributeDescription().getAttributeType())) |
| | | { |
| | | if (a.isEmpty()) |
| | | { |
| | |
| | | try |
| | | { |
| | | Attribute attr = a.toAttribute(); |
| | | AttributeType attrType = attr.getAttributeType(); |
| | | AttributeType attrType = attr.getAttributeDescription().getAttributeType(); |
| | | |
| | | // If the attribute type is marked "NO-USER-MODIFICATION" then fail |
| | | // unless this is an internal operation or is related to |
| | |
| | | { |
| | | for (Modification mod : modifications) |
| | | { |
| | | if (mod.getAttribute().getAttributeType().isObjectClass()) |
| | | if (mod.getAttribute().getAttributeDescription().getAttributeType().isObjectClass()) |
| | | { |
| | | return true; |
| | | } |
| | |
| | | { |
| | | Modification mod = m.toModification(); |
| | | Attribute attr = mod.getAttribute(); |
| | | AttributeType type = attr.getAttributeType(); |
| | | AttributeType type = attr.getAttributeDescription().getAttributeType(); |
| | | |
| | | if(type.getSyntax().isBEREncodingRequired()) |
| | | { |
| | |
| | | |
| | | if (removeAttrs != null) |
| | | { |
| | | removeAttrs.add(Attributes.create(a.getAttributeType(), v)); |
| | | removeAttrs.add(Attributes.create(a.getAttributeDescription().getAttributeType(), v)); |
| | | } |
| | | } |
| | | else |
| | |
| | | |
| | | if (removeAttrs != null) |
| | | { |
| | | removeAttrs.add(Attributes.create(a.getAttributeType(), v)); |
| | | removeAttrs.add(Attributes.create(a.getAttributeDescription().getAttributeType(), v)); |
| | | } |
| | | } |
| | | } |
| | |
| | | */ |
| | | public static boolean isSchemaAttribute(Attribute attribute) |
| | | { |
| | | String attributeOid = attribute.getAttributeType().getOID(); |
| | | String attributeOid = attribute.getAttributeDescription().getAttributeType().getOID(); |
| | | return attributeOid.equals("2.5.21.1") || |
| | | attributeOid.equals("2.5.21.2") || |
| | | attributeOid.equals("2.5.21.4") || |
| | |
| | | { |
| | | for (int j = i + minSubstringLength; j <= passwordLength; j++) |
| | | { |
| | | Attribute substring = Attributes.create(a.getAttributeType(), |
| | | Attribute substring = Attributes.create(a.getAttributeDescription().getAttributeType(), |
| | | password.substring(i, j)); |
| | | for (ByteString val : a) |
| | | { |
| | |
| | | DirectoryServer.getAttributeType(ATTR_DEFAULT_ROOT_PRIVILEGE_NAME); |
| | | for (Modification m : modifyOperation.getModifications()) |
| | | { |
| | | if (m.getAttribute().getAttributeType().equals(privType)) |
| | | if (m.getAttribute().getAttributeDescription().getAttributeType().equals(privType)) |
| | | { |
| | | if (! clientConnection.hasPrivilege(Privilege.PRIVILEGE_CHANGE, |
| | | modifyOperation)) |
| | |
| | | * CDDL HEADER END |
| | | * |
| | | * |
| | | * Portions Copyright 2012-2015 ForgeRock AS. |
| | | * Portions Copyright 2012-2016 ForgeRock AS. |
| | | */ |
| | | package org.opends.server.extensions; |
| | | |
| | |
| | | } |
| | | |
| | | // Ignore excluded attributes. |
| | | if (cfg.getExcludedAttribute().contains(attribute.getAttributeType())) |
| | | if (cfg.getExcludedAttribute().contains(attribute.getAttributeDescription().getAttributeType())) |
| | | { |
| | | return; |
| | | } |
| | |
| | | for (Modification mod : modifications) |
| | | { |
| | | Attribute attribute = mod.getAttribute(); |
| | | if (attribute.getAttributeType().equals(memberAttributeType)) |
| | | if (attribute.getAttributeDescription().getAttributeType().equals(memberAttributeType)) |
| | | { |
| | | switch (mod.getModificationType().asEnum()) |
| | | { |
| | |
| | | } |
| | | |
| | | // Verify that the value entry conforms to the filter. |
| | | SearchFilter filter = attrFiltMap.get(attr.getAttributeType()); |
| | | SearchFilter filter = attrFiltMap.get(attr.getAttributeDescription().getAttributeType()); |
| | | if (filter != null && !filter.matchesEntry(valueEntry)) |
| | | { |
| | | return PluginResult.PreOperation.stopProcessing(ResultCode.CONSTRAINT_VIOLATION, |
| | |
| | | rawAttr.getAttributeType(), le.getErrorMessage())); |
| | | } |
| | | |
| | | if (! config.getAttributeType().contains(a.getAttributeType())) |
| | | if (!config.getAttributeType().contains(a.getAttributeDescription().getAttributeType())) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | rawAttr.getAttributeType(), le.getErrorMessage())); |
| | | } |
| | | |
| | | if (! config.getAttributeType().contains(a.getAttributeType())) |
| | | if (!config.getAttributeType().contains(a.getAttributeDescription().getAttributeType())) |
| | | { |
| | | continue; |
| | | } |
| | |
| | | for (Modification m : modifyOperation.getModifications()) |
| | | { |
| | | Attribute a = m.getAttribute(); |
| | | AttributeType t = a.getAttributeType(); |
| | | AttributeType t = a.getAttributeDescription().getAttributeType(); |
| | | if (! config.getType().contains(t)) |
| | | { |
| | | // This modification isn't for a unique attribute. |
| | |
| | | for (Modification m : modifyOperation.getModifications()) |
| | | { |
| | | Attribute a = m.getAttribute(); |
| | | AttributeType t = a.getAttributeType(); |
| | | AttributeType t = a.getAttributeDescription().getAttributeType(); |
| | | if (! config.getType().contains(t)) |
| | | { |
| | | // This modification isn't for a unique attribute. |
| | |
| | | for (Modification m : modifyOperation.getModifications()) |
| | | { |
| | | Attribute a = m.getAttribute(); |
| | | AttributeType t = a.getAttributeType(); |
| | | AttributeType t = a.getAttributeDescription().getAttributeType(); |
| | | if (! config.getType().contains(t)) |
| | | { |
| | | // This modification isn't for a unique attribute. |
| | |
| | | ArrayList<ByteString> duplicateValues = new ArrayList<>(); |
| | | for (Attribute a : addRecord.getAttributes()) |
| | | { |
| | | if (a.getAttributeType().isObjectClass()) |
| | | if (a.getAttributeDescription().getAttributeType().isObjectClass()) |
| | | { |
| | | for (ByteString v : a) |
| | | { |
| | |
| | | */ |
| | | |
| | | Attribute modAttr = mod.getAttribute(); |
| | | AttributeType type = modAttr.getAttributeType(); |
| | | AttributeType type = modAttr.getAttributeDescription().getAttributeType(); |
| | | |
| | | switch (mod.getModificationType().asEnum()) |
| | | { |
| | |
| | | { |
| | | deleteTime = csn; |
| | | } |
| | | AttributeType type = modAttr.getAttributeType(); |
| | | AttributeType type = modAttr.getAttributeDescription().getAttributeType(); |
| | | if (!modifiedEntry.hasAttribute(type)) |
| | | { |
| | | conflict = true; |
| | |
| | | // to the current modifications of the operation |
| | | mods.add(new Modification(ModificationType.REPLACE, attr)); |
| | | // - update the already modified entry |
| | | modifiedEntry.removeAttribute(attr.getAttributeType()); |
| | | modifiedEntry.removeAttribute(attr.getAttributeDescription().getAttributeType()); |
| | | modifiedEntry.addAttribute(attr, null); |
| | | } |
| | | |
| | |
| | | AttrHistorical attrHist = attributesHistorical.get(attrDesc); |
| | | if (attrHist == null) |
| | | { |
| | | attrHist = AttrHistorical.createAttributeHistorical(modAttr.getAttributeType()); |
| | | attrHist = AttrHistorical.createAttributeHistorical(modAttr.getAttributeDescription().getAttributeType()); |
| | | attributesHistorical.put(attrDesc, attrHist); |
| | | } |
| | | return attrHist; |
| | |
| | | */ |
| | | public static boolean isHistoricalAttribute(Attribute attr) |
| | | { |
| | | AttributeType attrType = attr.getAttributeType(); |
| | | AttributeType attrType = attr.getAttributeDescription().getAttributeType(); |
| | | return HISTORICAL_ATTRIBUTE_NAME.equals(attrType.getNameOrOID()); |
| | | } |
| | | |
| | |
| | | { |
| | | Modification mod = modsIt.next(); |
| | | Attribute attr = mod.getAttribute(); |
| | | AttributeType attrType = attr.getAttributeType(); |
| | | AttributeType attrType = attr.getAttributeDescription().getAttributeType(); |
| | | // Fractional replication ignores operational attributes |
| | | if (attrType.isOperational() |
| | | || isMandatoryAttribute(entryClasses, attrType) |
| | |
| | | List<Modification> mods = op.getModifications(); |
| | | for (Modification mod : mods) |
| | | { |
| | | AttributeType modAttrType = mod.getAttribute().getAttributeType(); |
| | | AttributeType modAttrType = mod.getAttribute().getAttributeDescription().getAttributeType(); |
| | | if ((mod.getModificationType() == ModificationType.DELETE |
| | | || mod.getModificationType() == ModificationType.REPLACE) |
| | | && currentRDN.hasAttributeType(modAttrType)) |
| | |
| | | for (Modification mod : mods) |
| | | { |
| | | Attribute attr = mod.getAttribute(); |
| | | AttributeType type = attr.getAttributeType(); |
| | | AttributeType type = attr.getAttributeDescription().getAttributeType(); |
| | | if (type != null |
| | | && AttributeUsage.DSA_OPERATION.equals(type.getUsage()) ) |
| | | { |
| | |
| | | for (Modification m : modList) |
| | | { |
| | | Attribute a = m.getAttribute(); |
| | | AttributeBuilder builder = new AttributeBuilder(a |
| | | .getAttributeType(), a.getName()); |
| | | AttributeType attrType = a.getAttributeDescription().getAttributeType(); |
| | | AttributeBuilder builder = new AttributeBuilder(attrType, attrType.getNameOrOID()); |
| | | for (ByteString v : a) |
| | | { |
| | | String s = v.toString(); |
| | |
| | | |
| | | for (Attribute a : add.getAttributes()) |
| | | { |
| | | AttributeType t = a.getAttributeType(); |
| | | AttributeType t = a.getAttributeDescription().getAttributeType(); |
| | | if (t.isObjectClass()) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | String[] valueStrings = new String[] { v.toString() }; |
| | | Tag[] tags = new Tag[] { new StaticTextTag() }; |
| | | tags[0].initializeForBranch(templateFile, this, valueStrings, 0, warnings); |
| | | lineList.add(new TemplateLine(a.getAttributeType(), 0, tags)); |
| | | lineList.add(new TemplateLine(a.getAttributeDescription().getAttributeType(), 0, tags)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | String[] valueStrings = new String[] { v.toString() }; |
| | | Tag[] tags = new Tag[] { new StaticTextTag() }; |
| | | tags[0].initializeForBranch(templateFile, this, valueStrings, 0, warnings); |
| | | lineList.add(new TemplateLine(a.getAttributeType(), 0, tags)); |
| | | lineList.add(new TemplateLine(a.getAttributeDescription().getAttributeType(), 0, tags)); |
| | | } |
| | | catch (Exception e) |
| | | { |
| | |
| | | @Override |
| | | public String getName() |
| | | { |
| | | return getAttributeType().getNameOrOID(); |
| | | } |
| | | |
| | | @Override |
| | | public AttributeType getAttributeType() |
| | | { |
| | | return getAttributeDescription().getAttributeType(); |
| | | return getAttributeDescription().getAttributeType().getNameOrOID(); |
| | | } |
| | | |
| | | /** |
| | |
| | | @Override |
| | | public int hashCode() |
| | | { |
| | | int hashCode = getAttributeType().hashCode(); |
| | | AttributeType attrType = getAttributeDescription().getAttributeType(); |
| | | int hashCode = attrType.hashCode(); |
| | | for (ByteString value : this) |
| | | { |
| | | try |
| | | { |
| | | MatchingRule eqRule = getAttributeType().getEqualityMatchingRule(); |
| | | MatchingRule eqRule = attrType.getEqualityMatchingRule(); |
| | | hashCode += eqRule.normalizeAttributeValue(value).hashCode(); |
| | | } |
| | | catch (DecodeException e) |
| | |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | |
| | | /** |
| | | * This class defines a data structure for storing and interacting |
| | |
| | | boolean equals(Object o); |
| | | |
| | | /** |
| | | * Retrieves the attribute type for this attribute. |
| | | * |
| | | * @return The attribute type for this attribute. |
| | | */ |
| | | AttributeType getAttributeType(); |
| | | |
| | | /** |
| | | * Retrieves the attribute description for this attribute. |
| | | * |
| | | * @return The attribute description for this attribute. |
| | |
| | | import java.util.AbstractSet; |
| | | import java.util.Collection; |
| | | import java.util.Collections; |
| | | import java.util.HashSet; |
| | | import java.util.Iterator; |
| | | import java.util.LinkedHashSet; |
| | | import java.util.List; |
| | |
| | | this.values = values; |
| | | } |
| | | |
| | | private AttributeType getAttributeType() |
| | | { |
| | | return getAttributeDescription().getAttributeType(); |
| | | } |
| | | |
| | | @Override |
| | | public final ConditionResult approximatelyEqualTo(ByteString assertionValue) |
| | |
| | | return attributeDescription.hasOption(option); |
| | | } |
| | | |
| | | private Set<String> toSet(Iterable<String> options) |
| | | { |
| | | Set<String> results = new HashSet<>(); |
| | | for (String option : options) |
| | | { |
| | | results.add(option); |
| | | } |
| | | return results; |
| | | } |
| | | |
| | | @Override |
| | | public boolean hasOptions() |
| | | { |
| | |
| | | */ |
| | | public AttributeBuilder(Attribute attribute, boolean omitValues) |
| | | { |
| | | this(attribute.getAttributeType(), attribute.getName()); |
| | | this(attribute.getAttributeDescription().getAttributeType(), attribute.getName()); |
| | | |
| | | setOptions(attribute.getAttributeDescription().getOptions()); |
| | | if (!omitValues) |
| | |
| | | import org.forgerock.opendj.ldap.AttributeDescription; |
| | | import org.forgerock.opendj.ldap.ByteString; |
| | | import org.forgerock.opendj.ldap.ConditionResult; |
| | | import org.forgerock.opendj.ldap.schema.AttributeType; |
| | | |
| | | /** |
| | | * This class defines a collective virtual attribute, which is a |
| | |
| | | } |
| | | |
| | | @Override |
| | | public AttributeType getAttributeType() { |
| | | return attribute.getAttributeType(); |
| | | } |
| | | |
| | | @Override |
| | | public ConditionResult greaterThanOrEqualTo(ByteString assertionValue) { |
| | | return attribute.greaterThanOrEqualTo(assertionValue); |
| | | } |
| | |
| | | throws DirectoryException |
| | | { |
| | | Attribute a = mod.getAttribute(); |
| | | AttributeType t = a.getAttributeType(); |
| | | AttributeType t = a.getAttributeDescription().getAttributeType(); |
| | | |
| | | if (t.isObjectClass()) |
| | | { |
| | |
| | | List<Attribute> collectiveAttrList = subEntry.getCollectiveAttributes(); |
| | | for (Attribute collectiveAttr : collectiveAttrList) |
| | | { |
| | | AttributeType attributeType = collectiveAttr.getAttributeType(); |
| | | AttributeType attributeType = collectiveAttr.getAttributeDescription().getAttributeType(); |
| | | if (exclusionsNameSet.contains(attributeType.getNormalizedNameOrOID())) |
| | | { |
| | | continue; |
| | |
| | | } |
| | | // Decode the attribute. |
| | | Attribute a = config.getCompressedSchema().decodeAttribute(entryBuffer); |
| | | List<Attribute> attrList = attributes.get(a.getAttributeType()); |
| | | List<Attribute> attrList = attributes.get(a.getAttributeDescription().getAttributeType()); |
| | | if (attrList == null) |
| | | { |
| | | attrList = new ArrayList<>(1); |
| | | attributes.put(a.getAttributeType(), attrList); |
| | | attributes.put(a.getAttributeDescription().getAttributeType(), attrList); |
| | | } |
| | | attrList.add(a); |
| | | } |
| | |
| | | List<Attribute> subAttrList = entry.getAttributes(); |
| | | for (Attribute subAttr : subAttrList) |
| | | { |
| | | AttributeType attrType = subAttr.getAttributeType(); |
| | | AttributeType attrType = subAttr.getAttributeDescription().getAttributeType(); |
| | | if (attrType.isCollective()) |
| | | { |
| | | CollectiveVirtualAttribute collectiveAttr = |
| | |
| | | } |
| | | else if (subAttr.hasOption(ATTR_OPTION_COLLECTIVE)) |
| | | { |
| | | AttributeBuilder builder = new AttributeBuilder(subAttr.getAttributeType()); |
| | | AttributeBuilder builder = new AttributeBuilder(subAttr.getAttributeDescription().getAttributeType()); |
| | | builder.addAll(subAttr); |
| | | for (String option : subAttr.getAttributeDescription().getOptions()) |
| | | { |
| | |
| | | public void toString(StringBuilder buffer) |
| | | { |
| | | buffer.append("VirtualAttribute("); |
| | | buffer.append(getAttributeType().getNameOrOID()); |
| | | buffer.append(getAttributeDescription().getAttributeType().getNameOrOID()); |
| | | buffer.append(", {"); |
| | | Utils.joinAsString(buffer, ", ", this); |
| | | buffer.append("})"); |
| | |
| | | // Set the password changed time attribute. |
| | | Attribute changedTime = Attributes.create( |
| | | OP_ATTR_PWPOLICY_CHANGED_TIME, TimeThread.getGeneralizedTime()); |
| | | entry.putAttribute(changedTime.getAttributeType(), newArrayList(changedTime)); |
| | | entry.putAttribute(changedTime.getAttributeDescription().getAttributeType(), newArrayList(changedTime)); |
| | | |
| | | |
| | | // If we should force change on add, then set the appropriate flag. |
| | |
| | | addPWPolicyControl(PasswordPolicyErrorType.CHANGE_AFTER_RESET); |
| | | |
| | | Attribute reset = Attributes.create(OP_ATTR_PWPOLICY_RESET_REQUIRED, "TRUE"); |
| | | entry.putAttribute(reset.getAttributeType(), newArrayList(reset)); |
| | | entry.putAttribute(reset.getAttributeDescription().getAttributeType(), newArrayList(reset)); |
| | | } |
| | | } |
| | | |
| | |
| | | { |
| | | for (Attribute a : attrList) |
| | | { |
| | | Syntax syntax = a.getAttributeType().getSyntax(); |
| | | Syntax syntax = a.getAttributeDescription().getAttributeType().getSyntax(); |
| | | if (syntax != null) |
| | | { |
| | | for (ByteString v : a) |
| | |
| | | |
| | | // If the associated attribute type is marked NO-USER-MODIFICATION, then |
| | | // refuse the update. |
| | | if (a.getAttributeType().isNoUserModification() |
| | | if (a.getAttributeDescription().getAttributeType().isNoUserModification() |
| | | && !isInternalOperation() |
| | | && !isSynchronizationOperation()) |
| | | { |
| | |
| | | { |
| | | // If the associated attribute type is marked NO-USER-MODIFICATION, then |
| | | // refuse the update. |
| | | if (a.getAttributeType().isNoUserModification()) |
| | | if (a.getAttributeDescription().getAttributeType().isNoUserModification()) |
| | | { |
| | | if (!isInternalOperation() && !isSynchronizationOperation()) |
| | | { |
| | |
| | | for (Modification m : modifications) |
| | | { |
| | | Attribute a = m.getAttribute(); |
| | | AttributeType t = a.getAttributeType(); |
| | | AttributeType t = a.getAttributeDescription().getAttributeType(); |
| | | |
| | | |
| | | // If the attribute type is marked "NO-USER-MODIFICATION" then fail unless |
| | |
| | | |
| | | for (Modification m : modifications) |
| | | { |
| | | AttributeType t = m.getAttribute().getAttributeType(); |
| | | AttributeType t = m.getAttribute().getAttributeDescription().getAttributeType(); |
| | | |
| | | // If the modification is updating the password attribute, then perform |
| | | // any necessary password policy processing. This processing should be |
| | |
| | | { |
| | | for (Modification m : modifications) |
| | | { |
| | | if (isPassword(m.getAttribute().getAttributeType())) |
| | | if (isPassword(m.getAttribute().getAttributeDescription().getAttributeType())) |
| | | { |
| | | if (!selfChange && !clientConnection.hasPrivilege(Privilege.PASSWORD_RESET, this)) |
| | | { |
| | |
| | | |
| | | // 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(pwAttr.getAttributeType()); |
| | | List<Attribute> attrList = currentEntry.getAttribute(pwAttr.getAttributeDescription().getAttributeType()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, ERR_MODIFY_NO_EXISTING_VALUES.get()); |
| | |
| | | } |
| | | else |
| | | { |
| | | List<Attribute> attrList = currentEntry.getAttribute(pwAttr.getAttributeType()); |
| | | List<Attribute> attrList = currentEntry.getAttribute(pwAttr.getAttributeDescription().getAttributeType()); |
| | | if (attrList.isEmpty()) |
| | | { |
| | | throw new DirectoryException(ResultCode.NO_SUCH_ATTRIBUTE, ERR_MODIFY_NO_EXISTING_VALUES.get()); |
| | |
| | | |
| | | // If the attribute to be added is the object class attribute |
| | | // then make sure that all the object classes are known and not obsoleted. |
| | | if (attr.getAttributeType().isObjectClass()) |
| | | if (attr.getAttributeDescription().getAttributeType().isObjectClass()) |
| | | { |
| | | validateObjectClasses(attr); |
| | | } |
| | |
| | | Arg3<Object, Object, Object> invalidSyntaxNoValueErrorMsg) throws DirectoryException |
| | | { |
| | | AcceptRejectWarn syntaxPolicy = DirectoryServer.getSyntaxEnforcementPolicy(); |
| | | Syntax syntax = attr.getAttributeType().getSyntax(); |
| | | Syntax syntax = attr.getAttributeDescription().getAttributeType().getSyntax(); |
| | | |
| | | LocalizableMessageBuilder invalidReason = new LocalizableMessageBuilder(); |
| | | for (ByteString v : attr) |
| | |
| | | */ |
| | | private void validateObjectClasses(Attribute attr) throws DirectoryException |
| | | { |
| | | final AttributeType attrType = attr.getAttributeType(); |
| | | final AttributeType attrType = attr.getAttributeDescription().getAttributeType(); |
| | | Reject.ifFalse(attrType.isObjectClass()); |
| | | final MatchingRule eqRule = attrType.getEqualityMatchingRule(); |
| | | |
| | |
| | | { |
| | | if (missingValues.isEmpty()) |
| | | { |
| | | AttributeType t = attr.getAttributeType(); |
| | | AttributeType t = attr.getAttributeDescription().getAttributeType(); |
| | | |
| | | RDN rdn = modifiedEntry.getName().rdn(); |
| | | if (rdn != null |
| | |
| | | |
| | | // If the attribute to be replaced is the object class attribute |
| | | // then make sure that all the object classes are known and not obsoleted. |
| | | if (attr.getAttributeType().isObjectClass()) |
| | | if (attr.getAttributeDescription().getAttributeType().isObjectClass()) |
| | | { |
| | | validateObjectClasses(attr); |
| | | } |
| | |
| | | modifiedEntry.replaceAttribute(attr); |
| | | |
| | | // Make sure that the RDN attribute value(s) has not been removed. |
| | | AttributeType t = attr.getAttributeType(); |
| | | AttributeType t = attr.getAttributeDescription().getAttributeType(); |
| | | RDN rdn = modifiedEntry.getName().rdn(); |
| | | if (rdn != null |
| | | && rdn.hasAttributeType(t) |
| | |
| | | private void processIncrementModification(Attribute attr) throws DirectoryException |
| | | { |
| | | // The specified attribute type must not be an RDN attribute. |
| | | AttributeType t = attr.getAttributeType(); |
| | | AttributeType t = attr.getAttributeDescription().getAttributeType(); |
| | | RDN rdn = modifiedEntry.getName().rdn(); |
| | | if (rdn != null && rdn.hasAttributeType(t)) |
| | | { |
| | |
| | | ERR_MODIFY_INCREMENT_REQUIRES_SINGLE_VALUE.get(entryDN, attr.getName())); |
| | | } |
| | | |
| | | MatchingRule eqRule = attr.getAttributeType().getEqualityMatchingRule(); |
| | | MatchingRule eqRule = attr.getAttributeDescription().getAttributeType().getEqualityMatchingRule(); |
| | | ByteString v = attr.iterator().next(); |
| | | |
| | | long incrementValue; |
| | |
| | | org.forgerock.opendj.ldap.Attribute attribute = new LinkedAttribute("test", "value1"); |
| | | |
| | | org.opends.server.types.Attribute srvAttribute = toAttribute(attribute); |
| | | assertThat(srvAttribute.getAttributeType().getNameOrOID()).isEqualTo("test"); |
| | | assertThat(srvAttribute.getAttributeDescription().getAttributeType().getNameOrOID()).isEqualTo("test"); |
| | | assertThat(srvAttribute.size()).isEqualTo(1); |
| | | assertThat(srvAttribute.iterator().next().toString()).isEqualTo("value1"); |
| | | |
| | |
| | | new LinkedAttribute("Another", ByteString.valueOfUtf8("myValue")); |
| | | |
| | | org.opends.server.types.Attribute srvAttribute2 = toAttribute(attribute2); |
| | | assertThat(srvAttribute2.getAttributeType().getNameOrOID()).isEqualTo("Another"); |
| | | assertThat(srvAttribute2.getAttributeDescription().getAttributeType().getNameOrOID()).isEqualTo("Another"); |
| | | assertThat(srvAttribute2.size()).isEqualTo(1); |
| | | assertThat(srvAttribute2.iterator().next().toString()).isEqualTo("myValue"); |
| | | } |
| | |
| | | new LinkedAttribute("testMultiValuedAttribute", "value1", "value2"); |
| | | |
| | | org.opends.server.types.Attribute srvAttribute = toAttribute(attribute); |
| | | assertThat(srvAttribute.getAttributeType().getNameOrOID()) |
| | | assertThat(srvAttribute.getAttributeDescription().getAttributeType().getNameOrOID()) |
| | | .isEqualTo("testMultiValuedAttribute"); |
| | | assertThat(srvAttribute.size()).isEqualTo(2); |
| | | Iterator<ByteString> iter = srvAttribute.iterator(); |
| | |
| | | "value4"); |
| | | |
| | | org.opends.server.types.Attribute srvAttribute2 = toAttribute(attribute2); |
| | | assertThat(srvAttribute2.getAttributeType().getNameOrOID()) |
| | | assertThat(srvAttribute2.getAttributeDescription().getAttributeType().getNameOrOID()) |
| | | .isEqualTo("AnotherMultiValuedAttribute"); |
| | | assertThat(srvAttribute2.size()).isEqualTo(4); |
| | | iter = srvAttribute2.iterator(); |
| | |
| | | |
| | | org.opends.server.types.Modification srvModification = toModification(mod); |
| | | assertThat(srvModification.getModificationType()).isEqualTo(ModificationType.ADD); |
| | | assertThat(srvModification.getAttribute().getAttributeType().getNameOrOID()).isEqualTo("test"); |
| | | assertThat(srvModification.getAttribute().getAttributeDescription().getAttributeType().getNameOrOID()).isEqualTo("test"); |
| | | assertThat(srvModification.getAttribute().size()).isEqualTo(2); |
| | | |
| | | mod = new Modification(ModificationType.INCREMENT, attribute); |
| | |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | List<Attribute> attrList = e.getAttribute(a.getAttributeType()); |
| | | List<Attribute> attrList = e.getAttribute(a.getAttributeDescription()); |
| | | assertFalse(attrList.isEmpty()); |
| | | |
| | | boolean foundFoo = false; |
| | |
| | | retrieveCompletedOperationElements(addOperation); |
| | | |
| | | Entry e = DirectoryServer.getEntry(DN.valueOf("ou=People,o=test")); |
| | | assertThat(e.getAttribute(a.getAttributeType())).isNotEmpty(); |
| | | assertThat(e.getAttribute(a.getAttributeDescription().getAttributeType())).isNotEmpty(); |
| | | |
| | | UpdatePreOpPlugin.reset(); |
| | | } |
| | |
| | | |
| | | for (Attribute a : setAttributes) |
| | | { |
| | | addOperation.setAttribute(a.getAttributeType(), newArrayList(a)); |
| | | addOperation.setAttribute(a.getAttributeDescription().getAttributeType(), newArrayList(a)); |
| | | } |
| | | |
| | | for (ObjectClass oc : removeObjectClasses) |
| | |
| | | |
| | | private List<ByteString> getValues(Entry entry, Modification mod) |
| | | { |
| | | return getValues(entry.getAttribute(mod.getAttribute().getAttributeType())); |
| | | return getValues(entry.getAttribute(mod.getAttribute().getAttributeDescription())); |
| | | } |
| | | |
| | | private List<ByteString> getValues(List<Attribute> attributes) |
| | |
| | | * |
| | | * CDDL HEADER END |
| | | * |
| | | * Copyright 2015 ForgeRock AS |
| | | * Copyright 2015-2016 ForgeRock AS |
| | | */ |
| | | package org.opends.server.replication.plugin; |
| | | |
| | |
| | | |
| | | private ByteString getActualValue(Entry entry, Modification mod) |
| | | { |
| | | return getActualValue(entry.getAttribute(mod.getAttribute().getAttributeType())); |
| | | return getActualValue(entry.getAttribute(mod.getAttribute().getAttributeDescription())); |
| | | } |
| | | |
| | | private ByteString getActualValue(List<Attribute> attributes) |
| | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | List<Attribute> userAttributes = newArrayList(attr); |
| | | HashMap<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), userAttributes); |
| | | userAttList.put(attr.getAttributeDescription().getAttributeType(), userAttributes); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsName", "dc=creator"); |
| | | List<Attribute> operationalAttributes = newArrayList(attr); |
| | | HashMap<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), operationalAttributes); |
| | | opList.put(attr.getAttributeDescription().getAttributeType(), operationalAttributes); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | |
| | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | List<Attribute> userAttributes = newArrayList(attr); |
| | | Map<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), userAttributes); |
| | | userAttList.put(attr.getAttributeDescription().getAttributeType(), userAttributes); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsname", "dc=creator"); |
| | | List<Attribute> operationalAttributes = newArrayList(attr); |
| | | Map<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), operationalAttributes); |
| | | opList.put(attr.getAttributeDescription().getAttributeType(), operationalAttributes); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | |
| | |
| | | |
| | | Attribute attr = Attributes.create("o", "com"); |
| | | Map<AttributeType, List<Attribute>> userAttList = new HashMap<>(); |
| | | userAttList.put(attr.getAttributeType(), newArrayList(attr)); |
| | | userAttList.put(attr.getAttributeDescription().getAttributeType(), newArrayList(attr)); |
| | | |
| | | |
| | | attr = Attributes.create("creatorsname", "dc=creator"); |
| | | Map<AttributeType, List<Attribute>> opList = new HashMap<>(); |
| | | opList.put(attr.getAttributeType(), newArrayList(attr)); |
| | | opList.put(attr.getAttributeDescription().getAttributeType(), newArrayList(attr)); |
| | | |
| | | CSN csn = new CSN(TimeThread.getTime(), 123, 45); |
| | | DN dn = DN.valueOf(rawDN); |
| | |
| | | Assert.assertEquals(builder.getAttributeType(), cnType); |
| | | |
| | | Attribute a = builder.toAttribute(); |
| | | Assert.assertEquals(a.getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getName(), "cn"); |
| | | } |
| | | |
| | |
| | | Assert.assertEquals(builder.getAttributeType(), cnType); |
| | | |
| | | Attribute a = builder.toAttribute(); |
| | | Assert.assertEquals(a.getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getName(), "cn"); |
| | | } |
| | | |
| | |
| | | Assert.assertEquals(builder.getAttributeType(), cnType); |
| | | |
| | | Attribute a = builder.toAttribute(); |
| | | Assert.assertEquals(a.getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getName(), "CN"); |
| | | } |
| | | |
| | |
| | | Assert.assertEquals(builder.getAttributeType(), cnType); |
| | | |
| | | Attribute a = builder.toAttribute(); |
| | | Assert.assertEquals(a.getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getAttributeDescription().getAttributeType(), cnType); |
| | | Assert.assertEquals(a.getName(), "CN"); |
| | | } |
| | | |
| | |
| | | |
| | | |
| | | /** |
| | | * Tests {@link Attribute#getAttributeType()}. |
| | | * Tests {@link AttributeDescription#getAttributeType()}. |
| | | * |
| | | * @param testCase |
| | | * Test case index (useful for debugging). |
| | |
| | | throws Exception |
| | | { |
| | | // Check type and provided name. |
| | | Assert.assertEquals(a.getAttributeType(), type); |
| | | Assert.assertEquals(a.getAttributeDescription().getAttributeType(), type); |
| | | } |
| | | |
| | | |
| | |
| | | Assert.assertTrue(i.hasNext()); |
| | | |
| | | ByteString v = i.next(); |
| | | ByteString nv = a.getAttributeType().getEqualityMatchingRule().normalizeAttributeValue(v); |
| | | ByteString nv = a.getAttributeDescription().getAttributeType().getEqualityMatchingRule().normalizeAttributeValue(v); |
| | | Assert.assertEquals(nv, ByteString.valueOfUtf8(value)); |
| | | |
| | | try |
| | |
| | | |
| | | attribute = Attributes.create("cn", "hello world"); |
| | | attributes = new HashMap<>(); |
| | | attributes.put(attribute.getAttributeType(), newArrayList(attribute)); |
| | | attributes.put(attribute.getAttributeDescription().getAttributeType(), newArrayList(attribute)); |
| | | } |
| | | |
| | | /** |