All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.ow2.bonita.identity.IdentityServiceOp Maven / Gradle / Ivy

/**
 * Copyright (C) 2007  Bull S. A. S.
 * Bull, Rue Jean Jaures, B.P.68, 78340, Les Clayes-sous-Bois
 * This library is free software; you can redistribute it and/or modify it under the terms
 * of the GNU Lesser General Public License as published by the Free Software Foundation
 * version 2.1 of the License.
 * This library is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY;
 * without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
 * See the GNU Lesser General Public License for more details.
 * You should have received a copy of the GNU Lesser General Public License along with this
 * program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth
 * Floor, Boston, MA  02110-1301, USA.
 **/
package org.ow2.bonita.identity;

import java.util.Collection;

/**
 * This is the main interface for UserOp, GroupOp and Membership management.
 * 
 * @author "Pierre Vigneras"
 * @date Nov 27, 2007
 */
public interface IdentityServiceOp {
  /**
   * Create a UserOp in the identity service backing store and returns the
   * generated id.
   * 
   * @return the generated id
   */
  String createUser();

  /**
   * Delete the user mapped to the given id from this service.
   * 
   * @param id
   *          the user id
   * @throws UserNotFoundException
   *           if no user is currently mapped to the given id in this
   *           {@link IdentityServiceOp}
   */
  void deleteUser(String id) throws UserNotFoundException;

  /**
   * Modify the given user.
   * 
   * @param userOp
   *          the modified user
   * @return true if the given user has been successfully updated, false
   *         otherwise
   * @throws UserNotFoundException
   *           if the given user is not currently mapped in this
   *           {@link IdentityServiceOp}
   */
  boolean modifyUser(final UserOp userOp) throws UserNotFoundException;

  /**
   * Create a GroupOp in the identity service backing store and returns the
   * generated id.
   * 
   * The returned group, call it g, will be a child of its root
   * group. Formally, this means that the following expression: 
* g.getRoot().getChildren().contains(g) will return * true. * * @return the generated id */ String createGroup(); /** * Create a GroupOp in the identity service backing store and returns the * generated id. * * The returned group, call it g, will be a child of the given * group. Formally, this means that the following expression:
* g.getParent().getChildren().contains(g) will return * true. * * @return the generated id */ String createGroup(GroupOp parent); /** * Delete the group mapped to the given id from this service. * * @param id * the group id * @throws GroupNotFoundException * if no group is currently mapped to the given id in this * {@link IdentityServiceOp} */ void deleteGroup(String id) throws GroupNotFoundException; /** * Modify the given group. * * @param groupOp * the modified group * @return true if the given group has been successfully updated, false * otherwise * @throws GroupNotFoundException * if the given group is not currently mapped in this * {@link IdentityServiceOp} */ boolean modifyGroup(final GroupOp groupOp) throws GroupNotFoundException; /** * Returns a copy of the user mapped to the given id * * Modifications made on the return UserOp instance are not propagated to the * backing store * * @param id * @return a copy of the user mapped to the given id, null if no user is * currently mapped to the given id. * @throws UserNotFoundException * if no user is currently mapped to the given id in this * {@link IdentityServiceOp} */ UserOp getUser(String id) throws UserNotFoundException; /** * Returns a copy of the group mapped to the given id * * Modifications made on the return GroupOp instance are not propagated to the * backing store * * @param id * @return a copy of the group mapped to the given id * @throws UserNotFoundException * if no group is currently mapped to the given id in this * {@link IdentityServiceOp} * @throws GroupNotFoundException * if no group is currently mapped to the given id in this * {@link IdentityServiceOp} * */ GroupOp getGroup(String id) throws GroupNotFoundException; /** * Make the given user a member of the given group. * * @param userOp * the user * @param groupOp * the group * @return the new membership * @throws UserNotFoundException * if the given user is not currently mapped in this * {@link IdentityServiceOp} * @throws GroupNotFoundException * if the given group is not currently mapped in this * {@link IdentityServiceOp} * @see Membership */ Membership setMembership(UserOp user, GroupOp group) throws UserNotFoundException, GroupNotFoundException; /** * Returns a copy of all users present in the backing store * * Modifications made on the returned collection or on any of its contained * UserOp instances are not propagated to the backing store * * @return a copy of all users present in the backing store */ Collection getAllUsers(); /** * Returns a copy of all groupOps present in the backing store * * Modifications made on the returned collection or on any of its contained * GroupOp instances are not propagated to the backing store * * @return a copy of all groupOps present in the backing store * */ Collection getAllGroups(); /** * Commit all modifications to the backing store. * * @throws CommitException */ void commit() throws CommitException; }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy