001/**
002 * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
003 *
004 * Copyright (c) 2005 Sun Microsystems Inc. All Rights Reserved
005 *
006 * The contents of this file are subject to the terms
007 * of the Common Development and Distribution License
008 * (the License). You may not use this file except in
009 * compliance with the License.
010 *
011 * You can obtain a copy of the License at
012 * https://opensso.dev.java.net/public/CDDLv1.0.html or
013 * opensso/legal/CDDLv1.0.txt
014 * See the License for the specific language governing
015 * permission and limitations under the License.
016 *
017 * When distributing Covered Code, include this CDDL
018 * Header Notice in each file and include the License file
019 * at opensso/legal/CDDLv1.0.txt.
020 * If applicable, add the following below the CDDL Header,
021 * with the fields enclosed by brackets [] replaced by
022 * your own identifying information:
023 * "Portions Copyrighted [year] [name of copyright owner]"
024 *
025 * $Id: IdSearchOpModifier.java,v 1.3 2008/06/25 05:43:29 qcheng Exp $
026 *
027 */
028
029package com.sun.identity.idm;
030
031/**
032 * This is a helper class which can be in conjunction with the
033 * <code>IdSearchControl</code> class to make simple modifications to the
034 * basic search performed by each plugin. The two basic modifications allowed
035 * are OR and AND which are defined statically in this class.
036 *
037 * @supported.all.api
038 */
039public final class IdSearchOpModifier {
040    private int sOp;
041
042    private IdSearchOpModifier(int op) {
043        sOp = op;
044    }
045
046    /**
047     * The search modifier which will <code>OR</code> all the search
048     * attribute-value pairs passed to <code>IdSearchControl
049     * </code>
050     */
051    public final static IdSearchOpModifier OR = new IdSearchOpModifier(
052            IdRepo.OR_MOD);
053
054    /**
055     * The search modifier which will <code>AND</code> all the search
056     * attribute-value pairs passed to <code>IdSearchControl
057     * </code>
058     */
059    public final static IdSearchOpModifier AND = new IdSearchOpModifier(
060            IdRepo.AND_MOD);
061
062    /**
063     * Returns true if the object being checked is the same as this current one.
064     */
065    public boolean equals(Object o) {
066        boolean eq = false;
067        if (!(o instanceof IdSearchOpModifier)) {
068            eq = false;
069        } else {
070            IdSearchOpModifier soperation = (IdSearchOpModifier) o;
071            eq = (soperation.sOp == this.sOp);
072        }
073        return eq;
074    }
075
076    /*
077     * (non-Javadoc)
078     * 
079     * @see java.lang.Object#hashCode()
080     */
081    public int hashCode() {
082        return ((new Integer(sOp)).hashCode());
083    }
084
085    public String toString() {
086        String op = (this.sOp == IdRepo.OR_MOD) ? "OR" : "AND";
087        return ("IdSearchOpModifier = " + op);
088    }
089}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.