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: IdOperation.java,v 1.4 2008/06/25 05:43:28 qcheng Exp $
026 *
027 */
028
029package com.sun.identity.idm;
030
031/**
032 * The class <code>IdOperation</code> defines the types of operations
033 * supported on managed identities, and provides static constants for these
034 * operation. Currently defined operations on objects are
035 * <code>IdOperation.READ</code>, <code>
036 * IdOperation.EDIT</code>, <code>
037 * IdOperation.CREATE</code>,
038 * <code> IdOperation.DELETE
039 * </code> and <code> IdOperation.SERVICE </code>.
040 * The usage of the respective operations are defined along with their
041 * declaration.
042 *
043 * @supported.all.api
044 */
045public class IdOperation {
046
047    private String op;
048
049    /**
050     * Constructs an IdOperation of type string
051     */
052
053    public IdOperation(String operation) {
054        op = operation;
055    }
056
057    /**
058     * The <code> READ </code> operation is supported by default for all
059     * supported identities for all the plugins. This operation means that the
060     * <code> IdRepo SPI </code> for the configured plugins related to reading
061     * identity attributes will be invoked.
062     */
063    public static final IdOperation READ = new IdOperation("read");
064
065    /**
066     * The <code> EDIT </code> operation is supported only for the plugins
067     * configured for modifying and deleting attributes from the supported
068     * identities. This means that the <code> IdRepo SPI
069     * </code> for the
070     * configured plugins will be called for all modify attribute operations.
071     */
072
073    public static final IdOperation EDIT = new IdOperation("edit");
074
075    /**
076     * The <code> CREATE </code> operation is supported only for the plugins
077     * configured for creating identities. Not all the configured identities for
078     * a given <code> IdRepo plugin </code> might be supported. It is possible
079     * that a plugin might support read operations on all <code> IdType </code>
080     * but create operations only on the <code> IdType.USER </code>. In this
081     * case the create operation for that plugin is only called for user
082     * identities.
083     */
084    public static final IdOperation CREATE = new IdOperation("create");
085
086    /**
087     * The <code> DELETE </code> operation is supported only for the plugins
088     * configured for creating identities. Not all the configured identities for
089     * a given <code> IdRepo plugin </code> might be supported. It is possible
090     * that a plugin might support read operations on all <code> IdType </code>
091     * but create or delete operations only on the <code> IdType.USER </code>.
092     * In this case the delete operation for that plugin is only called for user
093     * identities.
094     */
095
096    public static final IdOperation DELETE = new IdOperation("delete");
097
098    /**
099     * The <code> SERVICE </code> operation is supported only for service
100     * related functions on an identity. Not all the configured identities for a
101     * plugin might support services for all identities. It is possible that
102     * service operations are supported only for one identity type for a plugin,
103     * say <code> IdType.USER </code>. In this case, all service related
104     * operations like assignService, unassignService, modifyService etc. are
105     * only called for user objects for that plugin.
106     */
107    public static final IdOperation SERVICE = new IdOperation("service");
108
109    /**
110     * The <code> equals </code> method compares the current IdOperation with
111     * the IdOperation passed in and returns true if the operations are same.
112     * it will return false if the operations are different.
113     *
114     * @param opObject 
115     *     an IdOperation
116     * @return
117     *     <code>true</code> if name opObject is same
118     *     else <code>false</code>
119     */
120
121    public boolean equals(Object opObject) {
122        if (opObject instanceof IdOperation) {
123            return (((IdOperation) opObject).op.equalsIgnoreCase(this.op));
124        }
125        return (false);
126    }
127
128    /**
129     * The <code> toString </code> method returns the same representation of 
130     * the current IdOperation. The string returned is preceeded by the 
131     * the substring "Operation: ". For example: if the current IdOperation 
132     * is "CREATE"  toString will return "Operation: create".
133     *
134     * @return
135     *     String representaton of IdOperation.
136     */
137
138    public String toString() {
139        return ("Operation: " + op);
140    }
141
142    /**
143     * Returns the hash code of the object
144     *
145     * @return
146     *     int hash code of IdOperation.
147     */
148    public int hashCode() {
149        return op.hashCode();
150    }
151
152    /**
153     * The <code> getName </code> method returns the name of the IdOperation 
154     * in string representaion. For example  if the current IdOperation 
155     * is "CREATE" getName will return "create".
156     *
157     * @return
158     *     String name of IdOperation.
159     */
160
161    public String getName() {
162        return op;
163    }
164
165}




























































Copyright © 2010-2017, ForgeRock All Rights Reserved.