IPrivilegeManager.java revision 6844ba67b94a6962decb2128480f6b8a29053949
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/*
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * The contents of this file are subject to the terms of the Common Development and
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Distribution License (the License). You may not use this file except in compliance with the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * You can obtain a copy of the License at legal/CDDLv1.0.txt. See the License for the
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * specific language governing permission and limitations under the License.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * When distributing Covered Software, include this CDDL Header Notice in each file and include
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * the License file at legal/CDDLv1.0.txt. If applicable, add the following below the CDDL
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Header, with the fields enclosed by brackets [] replaced by your own identifying
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * information: "Portions copyright [year] [name of copyright owner]".
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Copyright 2014 ForgeRock AS.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpackage com.sun.identity.entitlement;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport com.sun.identity.entitlement.util.SearchFilter;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterimport java.util.Set;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster/**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Defines Create Read Update Delete operations for implementation of IPrivilege.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Fosterpublic interface IPrivilegeManager<T extends IPrivilege> {
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
fd21d481e26774c37a197c7cc8ab56096a21e7aaPhill Cunnington /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Checks if a privilege with the specified name can be found.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param name name of the privilege.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws com.sun.identity.entitlement.EntitlementException if search failed.
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden */
87d68743726585ee101ba2e7be2cf06cd34ebb80Neil Madden boolean canFindByName(String name) throws EntitlementException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * Finds a privilege by its unique name.
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott *
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * @param name name of the privilege to be returned
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott * @throws com.sun.identity.entitlement.EntitlementException if privilege is not found.
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott */
01a939641aeb0a095851921879620c3fab295cb2Robert Wapshott T findByName(String name) throws EntitlementException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Add a privilege.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param privilege privilege to add.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws EntitlementException if privilege cannot be added.
01a939641aeb0a095851921879620c3fab295cb2Robert Wapshott */
01a939641aeb0a095851921879620c3fab295cb2Robert Wapshott void add(T privilege) throws EntitlementException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Remove a privilege.
01a939641aeb0a095851921879620c3fab295cb2Robert Wapshott *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param name name of the privilege to be removed.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws EntitlementException if privilege cannot be removed.
01a939641aeb0a095851921879620c3fab295cb2Robert Wapshott */
72450cb9c2ca854c6d3479832c2738196c1d3282Robert Wapshott void remove(String name) throws EntitlementException;
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott /**
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * Modify a privilege.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott *
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * @param privilege the privilege to be modified
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott * @throws com.sun.identity.entitlement.EntitlementException if privilege cannot be modified.
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott */
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott void modify(T privilege) throws EntitlementException;
35ab1c5bca11317474fe12bdd8d22c17cdaf2697Robert Wapshott
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns a set of privilege names for a given search criteria.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
01a939641aeb0a095851921879620c3fab295cb2Robert Wapshott * @param filter Set of search filter.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param searchSizeLimit Search size limit.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param searchTimeLimit Search time limit in seconds.
01a939641aeb0a095851921879620c3fab295cb2Robert Wapshott * @return a set of privilege names for a given search criteria.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws EntitlementException if search failed.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Set<String> searchNames(Set<SearchFilter> filter, int searchSizeLimit, int searchTimeLimit)
cc7c18212481f5e9ee508afe2ffcaecb6b9330f5Craig McDonnell throws EntitlementException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster /**
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * Returns a set of privilege names for a given search criteria.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster *
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @param filter Set of search filter.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @return a set of privilege names for a given search criteria.
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster * @throws EntitlementException if search failed.
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford */
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster Set<String> searchNames(Set<SearchFilter> filter) throws EntitlementException;
8af80418ba1ec431c8027fa9668e5678658d3611Allan Foster}
0c893a059f84246bf91e2f0fbf63e4c92f8e5165Tony Bamford