SearchFilter.java revision 402cd5da45d9182b81c16a13c3568faf78701827
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2009 Sun Microsystems Inc. All Rights Reserved
*
* 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
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/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 Copyrighted [year] [name of copyright owner]"
*
* $Id: SearchFilter.java,v 1.2 2009/10/14 03:18:41 veiming Exp $
*/
/*
* Portions Copyrighted 2014 ForgeRock AS.
*/
/**
* This class encapsulates the information required for searching
* of names.
*/
public class SearchFilter {
public static enum Operator {
}
private long longValue;
/**
* Constructor.
*
* @param attrName Attribute name.
* <code>CREATED_BY_ATTRIBUTE, LAST_MODIFIED_BY_ATTRIBUTE,
* CREATION_DATE_ATTRIBUTE, LAST_MODIFIED_DATE_ATTRIBUTE</code>.
* @param value Search filter.
*/
}
/**
* Constructor.
*
* @param attrName Attribute name
* <code>CREATED_BY_ATTRIBUTE, LAST_MODIFIED_BY_ATTRIBUTE,
* CREATION_DATE_ATTRIBUTE, LAST_MODIFIED_DATE_ATTRIBUTE</code>.
* @param value Search filter.
* @param operator Operator. Can be one of these
* <ul>
* <li>SearchFilter.EQUALS_OPERATOR</li>
* <li>SearchFilter.LESS_THAN_OPERATOR</li>
* <li>SearchFilter.GREATER_THAN_OPERATOR</li>
* </ul>
*/
}
/**
* Returns filter name.
*
* @return filter name.
*/
return attrName;
}
/**
* Returns filter value.
*
* @return filter value
*/
return value;
}
/**
* Returns filter operator.
*
* @return filter operator.
*/
public Operator getOperator() {
return operator;
}
/**
* Returns filter numeric value.
*
* @return filter numeric value.
*/
public long getNumericValue() {
return longValue;
}
/**
* Returns the LDAP search filter.
*
* @return LDAP search filter.
*/
}
/*
* We store numeric policy meta-data such as creationDate and lastModifiedDate as value-key pairs under 'ou'.
* All entries are stored twice; once with a "|" prefix added to the value-key and once without it.
* We use the pipe prefixed entry with >= and the non-prefixed entry with <=. Filtering fails to operate
* correctly if we do not pair up the operator with the pipe filter prefix in this way.
*
* Also, since LDAP does not support < or > natively, we need to invert >= and <=.
*/
switch (operator) {
case LESS_THAN_OPERATOR:
case GREATER_THAN_OPERATOR:
case EQUALS_OPERATOR:
default:
}
}
if (this == o) {
return true;
}
if (!(o instanceof SearchFilter)) {
return false;
}
}
public int hashCode() {
return result;
}
return "SearchFilter " + getFilter();
}
}