From 8b3cd28204e15e0a98ce038b355f100cd7c44e3c Mon Sep 17 00:00:00 2001
From: Nicolas Capponi <capponi.nicolas@gmail.com>
Date: Thu, 28 Jan 2016 08:28:20 +0000
Subject: [PATCH] OPENDJ-1632 (PR-201) Migrate AttributeType in one shot
---
opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java | 20 +++++++++-----------
1 files changed, 9 insertions(+), 11 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
index 4346502..184669f 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/replication/plugin/LDAPReplicationDomain.java
@@ -92,6 +92,7 @@
import org.opends.server.replication.service.ReplicationDomain;
import org.opends.server.tasks.PurgeConflictsHistoricalTask;
import org.opends.server.tasks.TaskUtils;
+import org.forgerock.opendj.ldap.schema.AttributeType;
import org.opends.server.types.*;
import org.opends.server.types.operation.*;
import org.opends.server.util.LDIFReader;
@@ -879,7 +880,7 @@
{
// Get attribute from attributes1
AttributeType attributeType1 = schema.getAttributeType(attrName1);
- if (attributeType1 == null)
+ if (attributeType1.isPlaceHolder())
{
throw new ConfigException(
NOTE_ERR_FRACTIONAL_CONFIG_UNKNOWN_ATTRIBUTE_TYPE.get(attrName1));
@@ -889,7 +890,7 @@
for (String attrName2 : attributes2)
{
AttributeType attributeType2 = schema.getAttributeType(attrName2);
- if (attributeType2 == null)
+ if (attributeType2.isPlaceHolder())
{
throw new ConfigException(
NOTE_ERR_FRACTIONAL_CONFIG_UNKNOWN_ATTRIBUTE_TYPE.get(attrName2));
@@ -978,7 +979,7 @@
// Does the attribute exist ?
AttributeType attributeType = schema.getAttributeType(attrName);
- if (attributeType != null)
+ if (!attributeType.isPlaceHolder())
{
// No more checking for the extensibleObject class
if (!isExtensibleObjectClass
@@ -1296,7 +1297,7 @@
private static boolean isFractionalProhibited(AttributeType attrType)
{
- String attributeName = attrType.getPrimaryName();
+ String attributeName = attrType.getNameOrOID();
return (attributeName != null && isFractionalProhibitedAttr(attributeName))
|| isFractionalProhibitedAttr(attrType.getOID());
}
@@ -1304,12 +1305,11 @@
private static boolean canRemoveAttribute(AttributeType attributeType,
boolean fractionalExclusive, Set<String> fractionalConcernedAttributes)
{
- String attributeName = attributeType.getPrimaryName();
+ String attributeName = attributeType.getNameOrOID();
String attributeOid = attributeType.getOID();
// Is the current attribute part of the established list ?
- boolean foundAttribute =
- contains(fractionalConcernedAttributes, attributeName, attributeOid);
+ boolean foundAttribute = contains(fractionalConcernedAttributes, attributeName, attributeOid);
// Now remove the attribute or modification if:
// - exclusive mode and attribute is in configuration
// - inclusive mode and attribute is not in configuration
@@ -1323,11 +1323,9 @@
|| (!foundAttribute && !fractionalExclusive);
}
- private static boolean contains(Set<String> attrNames, String attrName,
- String attrOID)
+ private static boolean contains(Set<String> attrNames, String attrName, String attrOID)
{
- return attrNames.contains(attrOID)
- || (attrName != null && attrNames.contains(attrName.toLowerCase()));
+ return attrNames.contains(attrOID) || attrNames.contains(attrName.toLowerCase());
}
/**
--
Gitblit v1.10.0