From ad85b8dfd8775fa342dcf6d0deaa380be53d080f Mon Sep 17 00:00:00 2001
From: Jean-Noel Rouvignac <jean-noel.rouvignac@forgerock.com>
Date: Mon, 20 Apr 2015 09:32:50 +0000
Subject: [PATCH] Code cleanup: Extracted methods, used ternary operator.
---
opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java | 31 +++++++++++++++++++++----------
1 files changed, 21 insertions(+), 10 deletions(-)
diff --git a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
index 22fb8be..0a413d6 100644
--- a/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
+++ b/opendj-server-legacy/src/main/java/org/opends/guitools/controlpanel/datamodel/IndexDescriptor.java
@@ -24,9 +24,11 @@
* Copyright 2008-2010 Sun Microsystems, Inc.
* Portions Copyright 2015 ForgeRock AS
*/
-
package org.opends.guitools.controlpanel.datamodel;
+import static org.opends.server.backends.pluggable.SuffixContainer.*;
+
+import java.util.Collections;
import java.util.Set;
import java.util.SortedSet;
import java.util.TreeSet;
@@ -40,7 +42,8 @@
public class IndexDescriptor extends AbstractIndexDescriptor
{
- private static final String[] DATABASE_INDEXES = new String[] {"dn2id", "id2children", "id2subtree"};
+ private static final String[] DATABASE_INDEXES = new String[] {
+ DN2ID_INDEX_NAME, ID2CHILDREN_INDEX_NAME, ID2SUBTREE_INDEX_NAME };
private final SortedSet<IndexTypeDescriptor> types = new TreeSet<IndexTypeDescriptor>();
private final boolean isDatabaseIndex;
@@ -51,6 +54,17 @@
/**
* Constructor of the index descriptor.
*
+ * @param indexName
+ * name of the index.
+ */
+ public IndexDescriptor(String indexName)
+ {
+ this(indexName, null, null, Collections.EMPTY_SET, -1);
+ }
+
+ /**
+ * Constructor of the index descriptor.
+ *
* @param name
* name of the index.
* @param attr
@@ -62,9 +76,8 @@
* @param entryLimit
* the entry limit for the index.
*/
- public IndexDescriptor(String name, AttributeType attr,
- BackendDescriptor backend,
- Set<IndexTypeDescriptor> types, int entryLimit)
+ public IndexDescriptor(
+ String name, AttributeType attr, BackendDescriptor backend, Set<IndexTypeDescriptor> types, int entryLimit)
{
super(name, backend);
this.attr = attr;
@@ -134,7 +147,6 @@
return true;
}
}
-
return false;
}
@@ -159,9 +171,9 @@
private boolean backendIdEqual(IndexDescriptor index)
{
- return getBackend() != null
- && index.getBackend() != null
- && getBackend().getBackendID().equals(index.getBackend().getBackendID());
+ BackendDescriptor backend1 = getBackend();
+ BackendDescriptor backend2 = index.getBackend();
+ return backend1 != null && backend2 != null && backend1.getBackendID().equals(backend2.getBackendID());
}
/**
@@ -188,5 +200,4 @@
}
hashCode = (getName()+sb+entryLimit).hashCode();
}
-
}
--
Gitblit v1.10.0