/*
* The contents of this file are subject to the terms of the Common Development and
* Distribution License (the License). You may not use this file except in compliance with the
* License.
*
* You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
* specific language governing permission and limitations under the License.
*
* When distributing Covered Software, include this CDDL Header Notice in each file and include
* the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
* Header, with the fields enclosed by brackets [] replaced by your own identifying
* information: "Portions copyright [year] [name of copyright owner]".
*
* Copyright 2014-2015 ForgeRock AS.
*/
/**
* Responsible for parsing and generating SearchFilters.
*/
public class SearchFilterFactory {
public SearchFilterFactory() {
}
/**
* Returns a SearchFilter that matches the search string provided.
*
* Supports the following syntax:
* [attribute name][operator][attribute value]
*
* Where operator can be one of the following:
* Equals - =
* Less Than - <
* Greater Than - >
*
* @param filter Non null String representing a search filter.
* @return Non null parsed SearchFilter.
* @throws EntitlementException If there was an error pasing the filter.
*/
try {
} catch (NumberFormatException e) {
throw new EntitlementException(
}
} else { // Everything else is assumed to be equals.
}
}
/**
* Get the SearchAttribute instance for the specified policy attribute name.
* @param attributeName The name of the policy attribubte
* @return The SearchAttribute instance, as required by {@link SearchFilter}.
*/
switch(attributeName) {
case Privilege.NAME_ATTRIBUTE:
return Privilege.NAME_SEARCH_ATTRIBUTE;
return Privilege.CREATED_BY_SEARCH_ATTRIBUTE;
default:
}
}
/**
* Parses the SearchFilter formatted text into a tuple of sorts.
* @param filter Non null string.
* @return Name, Operator, Value.
* @throws EntitlementException If no operator was found.
*/
if (index != -1) {
return new Object[]{
}
}
}
return name.equals(Privilege.LAST_MODIFIED_DATE_ATTRIBUTE) || name.equals(Privilege.CREATION_DATE_ATTRIBUTE);
}
}