From b5e0d239808a91f2e480876c9ff9be1be6c5419d Mon Sep 17 00:00:00 2001
From: Jean-Noël Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Tue, 07 Jun 2016 10:54:25 +0000
Subject: [PATCH] SchemaBackend.java: code cleanup
---
opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java | 22 +++++++---------------
1 files changed, 7 insertions(+), 15 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
index 0fced9d..cb3ceb9 100644
--- a/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
+++ b/opendj-server-legacy/src/main/java/org/opends/server/backends/SchemaBackend.java
@@ -635,7 +635,7 @@
attrs.add(attribute);
}
- private void buildSchemaAttribute(Collection<?> elements,
+ private void buildSchemaAttribute(Collection<? extends SchemaElement> elements,
Map<AttributeType, List<Attribute>> userAttrs,
Map<AttributeType, List<Attribute>> operationalAttrs,
AttributeType schemaAttributeType, boolean includeSchemaFile,
@@ -648,18 +648,10 @@
}
AttributeBuilder builder = new AttributeBuilder(schemaAttributeType);
- for (Object element : elements)
+ for (SchemaElement element : elements)
{
/* Add the file name to the description of the element if this was requested by the caller. */
- String value;
- if (includeSchemaFile && element instanceof SchemaElement)
- {
- value = getDefinitionWithFileName((SchemaElement) element);
- }
- else
- {
- value = element.toString();
- }
+ String value = includeSchemaFile ? getDefinitionWithFileName(element) : element.toString();
if (stripSyntaxMinimumUpperBound && value.indexOf('{') != -1)
{
// Strip the minimum upper bound value from the attribute value.
@@ -669,15 +661,15 @@
}
Attribute attribute = builder.toAttribute();
- ArrayList<Attribute> attrList = newArrayList(attribute);
- if (attribute.getAttributeDescription().getAttributeType().isOperational()
+ AttributeType attrType = attribute.getAttributeDescription().getAttributeType();
+ if (attrType.isOperational()
&& (ignoreShowAllOption || !showAllAttributes))
{
- operationalAttrs.put(attribute.getAttributeDescription().getAttributeType(), attrList);
+ operationalAttrs.put(attrType, newArrayList(attribute));
}
else
{
- userAttrs.put(attribute.getAttributeDescription().getAttributeType(), attrList);
+ userAttrs.put(attrType, newArrayList(attribute));
}
}
--
Gitblit v1.10.0