com.adobe.livecycle.rightsmanagement.client
Interface PolicyManager


public interface PolicyManager

The PolicyManager interface defines a mechanism to register policies with the Rights Management service and to search and modify policies that are already registered. The user account used to invoke Adobe Experience Manager Forms determines which policies can be accessed.

Registered policies reside in the Adobe Experience Manager Forms database. To modify a registered policy, you must first retrieve the policy. For information, see the Modifying a policy using the Java API quick start in Programming with Adobe Experience Manager Forms.


Method Summary
 void changePolicyOwner(java.lang.String policyName, User existingOwner, User newOwner)
          Changes the owner of the policy.
 java.lang.String createPolicySet(PolicySet policySet)
          This method creates a PolicySet, Creating a lot of PolicySets will have adverse performance effects.
 void deleteMyPolicy(java.lang.String policyName, java.lang.String ownerUsername, java.lang.String ownerDomain)
          Deletes the specified policy in My Policies.
 void deletePolicy(java.lang.String policySetName, java.lang.String policyName)
          Deletes the specified policy.
 java.util.HashMap deletePolicySets(java.util.List ids)
          This method deletes all policySets whose ids have been set as argument
 java.lang.String[] getAllPolicySetNames()
          Returns all policy set names that are available to user as a document publisher.
 Policy getMyPolicy(java.lang.String policyName, java.lang.String OwnerUsername, java.lang.String ownerDomain)
          Retrieves the specified policy in My Policies from the database.
 Policy[] getPolicies(PolicySearchFilter filter, int maxResults)
          Returns Policy objects based on the specified search criteria.
 Policy getPolicy(java.lang.String policyId)
          Retrieves the specified policy from the database.
 Policy getPolicy(java.lang.String policySetName, java.lang.String policyName)
          Retrieves the specified policy from the database.
 Policy getPolicyByAlternateId(java.lang.String alternateId)
          Retrieves the policy that corresponds with the specified alternate identification.
 java.lang.String[] getPolicyNames(java.lang.String policySetName)
          Returns all policy set names that are available to user as a document publisher.
 PolicySet getPolicySet(java.lang.String policySetId, boolean fetchPolicies)
          This method returns PolicySet details for the provided policySetId and if fetchPolicies is set to true, it bring details of all policies under it.
 java.lang.String getPolicySetIdByPolicySetName(java.lang.String policySetName)
          This method get the PolicySetId corresponding to the PolicySetName
 java.lang.String registerPolicy(Policy policy)
          Registers the specified policy with the Rights Management service as a user policy in My Policies policy set.
 java.lang.String registerPolicy(Policy policy, java.lang.String policySetName)
          Registers the provided policy with the Rights Management service.
 void updateCoordinatorPermission(java.lang.String userId, java.lang.String policySetId, java.util.ArrayList perms)
          This method helps update Coordinator's (userId) Permissions (perms) for a given policySetId
 void updatePolicy(Policy updatedPolicy)
          Updates an existing policy with the properties defined in a new policy definition.
 void updatePolicySetCoordinators(java.lang.String policysetId, java.util.ArrayList userIdAndPermsList, boolean add)
          This method helps add/remove Coordinators on a given policySet
 void updatePolicySetInfo(java.lang.String name, java.lang.String desc, java.lang.String policySetId)
          This method updates the information for the given PolicySetId
 void updatePolicySetPublishers(java.lang.String policysetId, java.util.ArrayList userIds, boolean add)
          This method helps add/remove Publishers on a given policySet
 void updatePolicySetVisibleUsersGroups(java.lang.String policysetId, java.util.ArrayList userIds, boolean add)
          This method helps add/remove VisibleUsersGroups on a given policySet
 

Method Detail

registerPolicy

java.lang.String registerPolicy(Policy policy)
                                throws SDKException
Registers the specified policy with the Rights Management service as a user policy in My Policies policy set. Policies that the registerPolicy method registers are enabled by default.

Parameters:
policy - A new policy to register with the Rights Management service.
Throws:
SDKException - if any of the following conditions occur:
  • The policy name is already used for an existing policy.
  • The policy is not valid.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.

registerPolicy

java.lang.String registerPolicy(Policy policy,
                                java.lang.String policySetName)
                                throws SDKException
Registers the provided policy with the Rights Management service. You can register the policy in the specified policy set. If the policySetName parameter is null, then the policy is registered in the My Policies policy set.

To see this method used in a code example, see the Creating a policy using the Java API quick start in Programming with Adobe Experience Manager Forms.

Parameters:
policy - A new policy to register with the Rights Management service.
policySetName - The name of the policy set that stores the policy.
Throws:
SDKException - if any of the following conditions occur:
  • The policy name is already used for an existing policy.
  • The policy you provided is not valid.
  • The policySetName is not valid or does not exist.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.

deletePolicy

void deletePolicy(java.lang.String policySetName,
                  java.lang.String policyName)
                  throws SDKException
Deletes the specified policy. Deleted policies can no longer be used to protect documents; however, they remain active for documents that they currently protect.

To see this method used within a code example, see the Deleting a policy using the Java API quick start in Programming with Adobe Experience Manager Forms.

Parameters:
policySetName - The name of the policy set that contains the policy. If this parameter is null, then the My Policies policy set is used.
policyName - The name of the policy to delete.
Throws:
SDKException - If any of the following conditions occur:
  • The policy is already deleted.
  • The policy identification is not valid.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.
See Also:
Policy

deleteMyPolicy

void deleteMyPolicy(java.lang.String policyName,
                    java.lang.String ownerUsername,
                    java.lang.String ownerDomain)
                    throws SDKException
Deletes the specified policy in My Policies. Deleted policies can no longer be used to protect documents; however, they remain active for documents that they currently protect.

Parameters:
policyName - The name of the policy to delete.
ownerUsername - The login identification of the policy owner of the policy to delete.
ownerDomain - The domain identification of the policy owner of the policy to delete.
Throws:
SDKException - If any of the following conditions occur:
  • The policy is already deleted.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.
See Also:
Policy

updatePolicy

void updatePolicy(Policy updatedPolicy)
                  throws SDKException
Updates an existing policy with the properties defined in a new policy definition. To update a policy, you must first retrieve the policy from the Rights Management service.

To see this method used within a code example, see the Modifying a policy using the Java API quick start in Programming with Adobe Experience Manager Forms.

Parameters:
updatedPolicy - A Policy object that represents the policy to update. The policy was previously retrieved and modified as required.
Throws:
SDKException - if any of the following conditions occur:
  • The policy you provided is not valid.
  • The operation is not permitted.
  • An error occurred while communicating with the Rights Management service.
See Also:
PolicyManager.getPolicy(java.lang.String, java.lang.String), PolicyManager.getPolicies(com.adobe.livecycle.rightsmanagement.client.infomodel.PolicySearchFilter, int)

getPolicy

Policy getPolicy(java.lang.String policySetName,
                 java.lang.String policyName)
                 throws SDKException
Retrieves the specified policy from the database.

To see this method used within a code example, see the Modifying a policy using the Java API quick start in Programming with Adobe Experience Manager Forms.

Parameters:
policySetName - The name of the policy set that contains the policy. If policySetName is null then the My Policies policy set is used.
policyName - The name of the policy to retrieve.
Returns:
The Policy object that corresponds to the specified policy name and policy set name.
Throws:
SDKException - if any of the following conditions occur:
  • The policy identification is not valid.
  • The policy was not found.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.

getMyPolicy

Policy getMyPolicy(java.lang.String policyName,
                   java.lang.String OwnerUsername,
                   java.lang.String ownerDomain)
                   throws SDKException
Retrieves the specified policy in My Policies from the database.

Parameters:
policyName - The name of the policy to retrieve.
OwnerUsername - The login identification of the policy owner of the policy to retrieve.
ownerDomain - The domain identification of the policy owner of the policy to retrieve.
Returns:
The Policy object that corresponds to the specified policy name, owner user name and owner domain.
Throws:
SDKException - if any of the following conditions occur:
  • The policy was not found.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.

getPolicy

Policy getPolicy(java.lang.String policyId)
                 throws SDKException
Retrieves the specified policy from the database.

Parameters:
policyId - The unique identifier of the policy.
Returns:
The Policy object that corresponds to the specified policy identifier.
Throws:
SDKException - if any of the following conditions occur:
  • The policy identifier is not valid.
  • The policy was not found (or the authenticated user does not have access to it).
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.

getPolicies

Policy[] getPolicies(PolicySearchFilter filter,
                     int maxResults)
                     throws SDKException
Returns Policy objects based on the specified search criteria. You can specify the maximum number of policy objects to return. If USER_POLICY is specified in filter, getPolicies returns all policies for the user who is currently logged in. If no search criteria are specified, all organizational and user policies for the currently logged in user (up to the maximum number of results specified) are returned. That is, if for example, the value 5 is specified, then this method returns up to 5 user and 5 organizational policies.

If the maxResults value is an extremely large number, an exception may occur. Different databases have different limitations. For example, 50000000 is a limitation for the MySQL database.

Parameters:
filter - A PolicySearchFilter object that defines the search criteria.
maxResults - An integer that specifies the maximum number of objects to return.
Returns:
An array of Policy objects that match the search criteria. If there are no policies that match the search criteria, then this method returns only one element which is null.
Throws:
SDKException - if any of the following conditions occur:
  • A parameter you provided is not valid.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.
See Also:
PolicySearchFilter

getPolicyByAlternateId

Policy getPolicyByAlternateId(java.lang.String alternateId)
                              throws SDKException
Retrieves the policy that corresponds with the specified alternate identification.

Parameters:
alternateId - A string value that holds the alternate identification of a policy. The maximum length of the String you can use is 250 characters or errors can occur.
Returns:
The Policy object that corresponds with the specified alternateId. Returns null if no policy is found.
Throws:
SDKException - if any of the following conditions occur:
  • An alternate identification you provided is not valid.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.
See Also:
PolicySearchFilter

changePolicyOwner

void changePolicyOwner(java.lang.String policyName,
                       User existingOwner,
                       User newOwner)
                       throws SDKException
Changes the owner of the policy. Only administrators have permission to change policy owners. The user account used to log in must be an administrator account.

Parameters:
policyName - The name of the policy that will have its owner changed.
existingOwner - A User object that has current ownership of the policy.
newOwner - A User object to provide ownership of the policy.
Throws:
SDKException - if any of the following conditions occur:
  • A parameter you provided is not valid.
  • The operation was not permitted.
  • An error occurred while communicating with the Rights Management service.

getAllPolicySetNames

java.lang.String[] getAllPolicySetNames()
                                        throws SDKException
Returns all policy set names that are available to user as a document publisher.

Returns:
The java.lang.String[] that contains all available policy set names. If there are more than 1,000 policy sets, only the first 1,000 will be returned.
Throws:
SDKException - if any of the following conditions occur:
  • An error occurred while communicating with the Rights Management service.

getPolicyNames

java.lang.String[] getPolicyNames(java.lang.String policySetName)
                                  throws SDKException
Returns all policy set names that are available to user as a document publisher.

Parameters:
policySetName - The name of the policy set that will contain policies. "MyPolicies" should be passed if it's end user policies.
Returns:
The java.lang.String[] that contains all available policy set names. If there are more than 1,000 policies, only the first 1,000 will be returned.
Throws:
SDKException - if any of the following conditions occur:
  • The parameter you provided is not a valid policy set name (error code 0x50a - No such id).
  • The parameter policySetName is null or empty string (error code 0x501 - Invalid argument).
  • An error occurred while communicating with the Rights Management service.

getPolicySet

PolicySet getPolicySet(java.lang.String policySetId,
                       boolean fetchPolicies)
                       throws SDKException
This method returns PolicySet details for the provided policySetId and if fetchPolicies is set to true, it bring details of all policies under it.

Parameters:
policySetId - Id of the PolicySet whose information needs to be fetched
fetchPolicies - if set to true, it will bring details of all policies under it
Returns:
PolicySet this object encapsulates all details related to PolicySet including policies
Throws:
SDKException

createPolicySet

java.lang.String createPolicySet(PolicySet policySet)
                                 throws SDKException
This method creates a PolicySet, Creating a lot of PolicySets will have adverse performance effects. Please use Cautiously

Parameters:
PolicySet - this object encapsulates all details related to PolicySet minus policies under it
Returns:
policySetId of the newly created PolicySet
Throws:
SDKException

updatePolicySetInfo

void updatePolicySetInfo(java.lang.String name,
                         java.lang.String desc,
                         java.lang.String policySetId)
                         throws SDKException
This method updates the information for the given PolicySetId

Parameters:
name - Updated Name of PolicySet
description - Updated description of the PolicySet
policySetId - of the PolicySet whose information needs to be updated
Throws:
SDKException

getPolicySetIdByPolicySetName

java.lang.String getPolicySetIdByPolicySetName(java.lang.String policySetName)
                                               throws SDKException
This method get the PolicySetId corresponding to the PolicySetName

Parameters:
policySetName - name of the PolicySet
Returns:
policySetId of the policySet
Throws:
SDKException

deletePolicySets

java.util.HashMap deletePolicySets(java.util.List ids)
                                   throws SDKException
This method deletes all policySets whose ids have been set as argument

Parameters:
policySetIds - of the policySets which needs to be deleted, if a policySetId does not exist the system will throw SDKException
Returns:
A map which contains all those policySetIds (which existed in the system) as keys which were not deleted and reasons for same as values, This would not let a user delete any policySet which has policies under it
Throws:
SDKException

updatePolicySetPublishers

void updatePolicySetPublishers(java.lang.String policysetId,
                               java.util.ArrayList userIds,
                               boolean add)
                               throws SDKException
This method helps add/remove Publishers on a given policySet

Parameters:
policySetId - id of the policySet whose publishers need to be modified
userIds - list of userIds which need to be added/removed from the policySet as publishers
add, - a boolean which if set to true will add users as publishers, if set to false will delete those as publishers
Throws:
SDKException

updatePolicySetVisibleUsersGroups

void updatePolicySetVisibleUsersGroups(java.lang.String policysetId,
                                       java.util.ArrayList userIds,
                                       boolean add)
                                       throws SDKException
This method helps add/remove VisibleUsersGroups on a given policySet

Parameters:
policySetId - id of the policySet whose VisibleUsersGroups need to be modified
userIds - list of userIds which need to be added/removed from the policySet as VisibleUsersGroups
add, - a boolean which if set to true will add users as VisibleUsersGroups, if set to false will delete those as VisibleUsersGroups
Throws:
SDKException

updatePolicySetCoordinators

void updatePolicySetCoordinators(java.lang.String policysetId,
                                 java.util.ArrayList userIdAndPermsList,
                                 boolean add)
                                 throws SDKException
This method helps add/remove Coordinators on a given policySet

Parameters:
policySetId - id of the policySet whose Coordinators need to be modified
userIdAndPermsList - list of userIds and their permissions (com.adobe.livecycle.rightsmanagement.client.infomodel.PolicySetCoordinatorAndPerms) which need to be added/removed from the policySet as Coordinators
add, - a boolean which if set to true will add users as Coordinators, if set to false will delete those as Coordinators
Throws:
SDKException

updateCoordinatorPermission

void updateCoordinatorPermission(java.lang.String userId,
                                 java.lang.String policySetId,
                                 java.util.ArrayList perms)
                                 throws SDKException
This method helps update Coordinator's (userId) Permissions (perms) for a given policySetId

Parameters:
userId - which will be added as co-ordinator
policySetId - id of the policySet on which the user will we added as co-ordinator
perms, - an ArrayList to be set as permissions for the co-ordinator (userId). These would be amongst com.adobe.edc.server.constants.PolicyServerConstants.PolicySetAggregatePermissions, else it would throw an exception.
Throws:
SDKException