IndexTypeDescriptor.java revision eb4855e3f510e32c6034710868ef87e67081f921
/*
* CDDL HEADER START
*
* The contents of this file are subject to the terms of the
* Common Development and Distribution License, Version 1.0 only
* (the "License"). You may not use this file except in compliance
* with the License.
*
* You can obtain a copy of the license at legal-notices/CDDLv1_0.txt
* See the License for the specific language governing permissions
* and limitations under the License.
*
* When distributing Covered Code, include this CDDL HEADER in each
* file and include the License file at legal-notices/CDDLv1_0.txt.
* If applicable, add the following below this CDDL HEADER, with the
* fields enclosed by brackets "[]" replaced with your own identifying
* information:
* Portions Copyright [yyyy] [name of copyright owner]
*
* CDDL HEADER END
*
*
* Copyright 2015 ForgeRock AS
*/
/** Defines the set of values for the index type. */
public enum IndexTypeDescriptor
{
/**
* This index type is used to improve the efficiency of searches using
* approximate matching search filters.
*/
APPROXIMATE("approximate"),
/**
* This index type is used to improve the efficiency of searches using
* equality search filters.
*/
EQUALITY("equality"),
/**
* This index type is used to improve the efficiency of searches using
* extensible matching search filters.
*/
EXTENSIBLE("extensible"),
/**
* This index type is used to improve the efficiency of searches using
* "greater than or equal to" or "less then or equal to" search filters.
*/
ORDERING("ordering"),
/**
* This index type is used to improve the efficiency of searches using the
* presence search filters.
*/
PRESENCE("presence"),
/**
* This index type is used to improve the efficiency of searches using
* substring search filters.
*/
SUBSTRING("substring");
{
}
{
return name;
}
/**
* Convert the index type to the equivalent
* {@code BackendIndexCfgDefn.IndexType}.
*
* @return The index type to the equivalent
* {@code BackendIndexCfgDefn.IndexType}
*/
{
switch (this)
{
case APPROXIMATE:
case EQUALITY:
case EXTENSIBLE:
case ORDERING:
case PRESENCE:
case SUBSTRING:
default:
throw new IllegalArgumentException("No BackendIndexCfgDefn.IndexType corresponding to: " + this);
}
}
/**
* Convert the index type to the equivalent
* {@code LocalDBIndexCfgDefn.IndexType}.
*
* @return The index type to the equivalent
* {@code LocalDBIndexCfgDefn.IndexType}
*/
{
switch (this)
{
case APPROXIMATE:
case EQUALITY:
case EXTENSIBLE:
case ORDERING:
case PRESENCE:
case SUBSTRING:
default:
throw new IllegalArgumentException("No LocalDBIndexCfgDefn.IndexType corresponding to: " + this);
}
}
private static IndexTypeDescriptor fromBackendIndexType(final BackendIndexCfgDefn.IndexType indexType)
{
switch (indexType)
{
case APPROXIMATE:
return APPROXIMATE;
case EQUALITY:
return EQUALITY;
case EXTENSIBLE:
return EXTENSIBLE;
case ORDERING:
return ORDERING;
case PRESENCE:
return PRESENCE;
case SUBSTRING:
return SUBSTRING;
default:
}
}
private static IndexTypeDescriptor fromLocalDBIndexType(final LocalDBIndexCfgDefn.IndexType indexType)
{
switch (indexType)
{
case APPROXIMATE:
return APPROXIMATE;
case EQUALITY:
return EQUALITY;
case EXTENSIBLE:
return EXTENSIBLE;
case ORDERING:
return ORDERING;
case PRESENCE:
return PRESENCE;
case SUBSTRING:
return SUBSTRING;
default:
}
}
/**
* Convert the provided {@code Set<BackendIndexCfgDefn.IndexType>} to a
* {@code Set<IndexTypeDescriptor>}.
*
* @param indexTypes
* A set of {@code Set<BackendIndexCfgDefn.IndexType>}
* @return A set of {@code Set<IndexTypeDescriptor>} corresponding to the
* provided {@code Set<BackendIndexCfgDefn.IndexType>}
*/
public static Set<IndexTypeDescriptor> fromBackendIndexTypes(final Set<BackendIndexCfgDefn.IndexType> indexTypes)
{
{
}
return indexTypeDescriptors;
}
/**
* Convert the provided {@code Set<LocalDBIndexCfgDefn.IndexType} to a
* {@code Set<IndexTypeDescriptor>}.
*
* @param indexTypes
* A set of {@code Set<LocalDBIndexCfgDefn.IndexType>}
* @return A set of {@code Set<IndexTypeDescriptor>} corresponding to the
* provided {@code Set<LocalDBIndexCfgDefn.IndexType>}
*/
public static Set<IndexTypeDescriptor> fromLocalDBIndexTypes(final Set<LocalDBIndexCfgDefn.IndexType> indexTypes)
{
{
}
return indexTypeDescriptors;
}
/**
* Convert the provided {@code Set<IndexTypeDescriptor>} to a
* {@code Set<BackendIndexCfgDefn.IndexType>}.
*
* @param indexTypeDescriptors
* A set of {@code Set<IndexTypeDescriptor>}
* @return A set of {@code Set<BackendIndexCfgDefn.IndexType>} corresponding
* to the provided {@code Set<IndexTypeDescriptor>}
*/
{
final Set<BackendIndexCfgDefn.IndexType> indexTypes = new LinkedHashSet<BackendIndexCfgDefn.IndexType>();
{
}
return indexTypes;
}
/**
* Convert the provided {@code Set<IndexTypeDescriptor>} to a
* {@code Set<LocalDBIndexCfgDefn.IndexType>}.
*
* @param indexTypeDescriptors
* A set of {@code Set<IndexTypeDescriptor>}
* @return A set of {@code Set<LocalDBIndexCfgDefn.IndexType>} corresponding
* to the provided {@code Set<IndexTypeDescriptor>}
*/
{
final Set<LocalDBIndexCfgDefn.IndexType> indexTypes = new LinkedHashSet<LocalDBIndexCfgDefn.IndexType>();
{
}
return indexTypes;
}
}