/** * DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER. * * Copyright (c) 2005 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 * https://opensso.dev.java.net/public/CDDLv1.0.html or * opensso/legal/CDDLv1.0.txt * 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: IdOperation.java,v 1.4 2008/06/25 05:43:28 qcheng Exp $ * */ package com.sun.identity.idm; /** * The class IdOperation defines the types of operations * supported on managed identities, and provides static constants for these * operation. Currently defined operations on objects are * IdOperation.READ, * IdOperation.EDIT, * IdOperation.CREATE, * IdOperation.DELETE * and IdOperation.SERVICE . * The usage of the respective operations are defined along with their * declaration. * * @supported.all.api */ public class IdOperation { private String op; /** * Constructs an IdOperation of type string */ public IdOperation(String operation) { op = operation; } /** * The READ operation is supported by default for all * supported identities for all the plugins. This operation means that the * IdRepo SPI for the configured plugins related to reading * identity attributes will be invoked. */ public static final IdOperation READ = new IdOperation("read"); /** * The EDIT operation is supported only for the plugins * configured for modifying and deleting attributes from the supported * identities. This means that the IdRepo SPI * for the * configured plugins will be called for all modify attribute operations. */ public static final IdOperation EDIT = new IdOperation("edit"); /** * The CREATE operation is supported only for the plugins * configured for creating identities. Not all the configured identities for * a given IdRepo plugin might be supported. It is possible * that a plugin might support read operations on all IdType * but create operations only on the IdType.USER . In this * case the create operation for that plugin is only called for user * identities. */ public static final IdOperation CREATE = new IdOperation("create"); /** * The DELETE operation is supported only for the plugins * configured for creating identities. Not all the configured identities for * a given IdRepo plugin might be supported. It is possible * that a plugin might support read operations on all IdType * but create or delete operations only on the IdType.USER . * In this case the delete operation for that plugin is only called for user * identities. */ public static final IdOperation DELETE = new IdOperation("delete"); /** * The SERVICE operation is supported only for service * related functions on an identity. Not all the configured identities for a * plugin might support services for all identities. It is possible that * service operations are supported only for one identity type for a plugin, * say IdType.USER . In this case, all service related * operations like assignService, unassignService, modifyService etc. are * only called for user objects for that plugin. */ public static final IdOperation SERVICE = new IdOperation("service"); /** * The equals method compares the current IdOperation with * the IdOperation passed in and returns true if the operations are same. * it will return false if the operations are different. * * @param opObject * an IdOperation * @return * true if name opObject is same * else false */ public boolean equals(Object opObject) { if (opObject instanceof IdOperation) { return (((IdOperation) opObject).op.equalsIgnoreCase(this.op)); } return (false); } /** * The toString method returns the same representation of * the current IdOperation. The string returned is preceeded by the * the substring "Operation: ". For example: if the current IdOperation * is "CREATE" toString will return "Operation: create". * * @return * String representaton of IdOperation. */ public String toString() { return ("Operation: " + op); } /** * Returns the hash code of the object * * @return * int hash code of IdOperation. */ public int hashCode() { return op.hashCode(); } /** * The getName method returns the name of the IdOperation * in string representaion. For example if the current IdOperation * is "CREATE" getName will return "create". * * @return * String name of IdOperation. */ public String getName() { return op; } }