|
Oracle® Information Rights Management Server Java API Reference 11g Release 1 (11.1.1) E12907-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
public interface DocumentRightOperationsEndpoint
Web Service end point interface for Document Right Operations. Document right operations include checking in rights, altering item restrictions, listing rights and checking items across sets of rights.
The WSDL for this end point interface can be downloaded from the server using the following URL:
http://irm.example.com/irm_services/document_right_operations?wsdl
Requests for this web service should be sent to the following URL:
https://irm.example.com/irm_services/document_right_operations
Method Summary | |
---|---|
DocumentRight[] |
assignRole(ContextInstanceRef context, DocumentRoleRef role, AccountRef[] accounts, ItemCode[] items) Assign a document role. |
DocumentRight[] |
checkInRightsForAccount(AccountRef account) Check all rights in use by an account. |
DocumentRight[] |
listRightsByAccount(AccountRef account) List rights for an account. |
DocumentRight[] |
listRightsByContext(ContextInstanceRef context, PageRange pageRange) List rights assigned within a context. |
DocumentRight[] |
reassignRole(DocumentRightRef[] rights, DocumentRoleRef role, ItemCode[] items) Alter role assignments. |
DocumentRight[] |
saveChangesToItems(DocumentRightRef[] rights, ItemCode[] itemCodes, ItemCode[] delta) Alter the item restrictions for a set of rights. |
void |
unassignRights(DocumentRightRef[] rights) Un-assign a set of rights. |
Method Detail |
---|
DocumentRight[] assignRole(ContextInstanceRef context, DocumentRoleRef role, AccountRef[] accounts, ItemCode[] items) throws AccountAlreadyAssignedFault, UnsupportedDocumentRoleFault, UnknownContextFault, UnknownDocumentRoleFault, AuthorizationDeniedFault
Context
. If any of the provided accounts already has the role assigned the account is silently ignored and the role is not re-assigned.
addContextManagers
method.
import static oracle.irm.j2ee.jws.rights.context.DocumentRightOperations.getDocumentRightOperationsEndpoint; import java.net.Authenticator; import java.net.PasswordAuthentication; import java.net.URLEncoder; import java.util.UUID; import oracle.irm.engine.types.core.account.AccountRef; import oracle.irm.engine.types.rights.context.ContextInstanceRef; import oracle.irm.engine.types.rights.context.DocumentRoleRef; import oracle.irm.engine.types.rights.context.DomainRef; import oracle.irm.j2ee.jws.rights.context.DocumentRightOperationsEndpoint; public class AssignRoleWS { public static void main(String[] args) throws Exception { final String hostPort = args[0]; final String username = args[1]; final String password = args[2]; // Configure an authenticator to provide the credentials // for the web service Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); // Domain UUID is fixed for sample code UUID domainUUID = UUID.fromString("6fab93fd-2858-461a-a0b3-34e261dbf8fd"); DomainRef domainRef = new DomainRef(domainUUID); // Document Role UUID is for the "Sample Role" role UUID documentRoleUUID = UUID.fromString("ee82c3f9-152b-440d-afd7-dbf36b0c8188"); DocumentRoleRef roleRef = new DocumentRoleRef(documentRoleUUID, domainRef); // Context UUID is fixed for sample code UUID contextUUID = UUID.fromString("46f910d9-dd30-476e-b060-4d01f88f8b05"); ContextInstanceRef contextInstanceRef = new ContextInstanceRef(contextUUID); // Get the document right operations endpoint DocumentRightOperationsEndpoint rightOperations = getDocumentRightOperationsEndpoint(hostPort); // Reference the account by user name AccountRef accountRef = new AccountRef("urn:user:" + URLEncoder.encode(username, "utf-8")); // Assign the role to the account rightOperations.assignRole( contextInstanceRef, roleRef, new AccountRef[] { accountRef }, null); // no item constraints } }
context
- the context.role
- the role.accounts
- the accounts. This parameter is optional, it is valid to pass null or an empty collection.items
- item restrictions. Can be empty. This parameter is optional, it is valid to pass null or an empty collection.AccountAlreadyAssignedFault
- an account is already assigned a role. An account can only be assigned one role within a Context
.UnsupportedDocumentRoleFault
- the Context
does not support the provided document role.UnknownContextFault
- the context does not exist.UnknownDocumentRoleFault
- the role does not exist.AuthorizationDeniedFault
- authorization denied. The authenticated user is not authorized to call this operation.DocumentRight[] reassignRole(DocumentRightRef[] rights, DocumentRoleRef role, ItemCode[] items) throws UnsupportedDocumentRoleFault, UnknownDocumentRoleFault, UnknownDocumentRightFault, AuthorizationDeniedFault
Context
this method can be used to alter the role assignment without a two-step unassign right and assign role.
addContextManagers
method.
reassignRole
method over web services. The sample code adds an item code exclusion to a role assignment. Typically this method is used to alter the role, but as the sample code only has one demonstration role it shows how to alter the item restrictions.
import static oracle.irm.j2ee.jws.rights.context.DocumentRightOperations.getDocumentRightOperationsEndpoint; import java.net.Authenticator; import java.net.PasswordAuthentication; import java.net.URLEncoder; import oracle.irm.engine.types.classifications.item.ItemCode; import oracle.irm.engine.types.core.account.AccountRef; import oracle.irm.engine.types.rights.context.DocumentRight; import oracle.irm.engine.types.rights.context.DocumentRightRef; import oracle.irm.engine.types.rights.context.DocumentRoleRef; import oracle.irm.engine.types.rights.context.DomainRef; import oracle.irm.j2ee.jws.rights.context.DocumentRightOperationsEndpoint; public class ReassignRoleWS { public static void main(String[] args) throws Exception { final String hostPort = args[0]; final String username = args[1]; final String password = args[2]; // Configure an authenticator to provide the credentials // for the web service Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); // Get the document right operations web service DocumentRightOperationsEndpoint rightOperations = getDocumentRightOperationsEndpoint(hostPort); // Reference the account by user name AccountRef accountRef = new AccountRef("urn:user:" + URLEncoder.encode(username, "utf-8")); // Get all rights assigned to the account DocumentRight[] rights = rightOperations.listRightsByAccount(accountRef); // Take the first one on the list DocumentRight right = rights[0]; DocumentRightRef rightRef = new DocumentRightRef(right.getUuid()); // Get a reference to the role to be reassigned DomainRef domainRef = right.getRole().getDomain(); DocumentRoleRef roleRef = new DocumentRoleRef(right.getRole().getUuid(), domainRef); // Change the item exclusion list to contain one sample item ItemCode itemCode = new ItemCode(); itemCode.setValue("sample-item-code"); // Reassign the role to the account rightOperations.reassignRole(new DocumentRightRef[] { rightRef }, roleRef, new ItemCode[] { itemCode }); } }
rights
- the rights. This parameter is optional, it is valid to pass null or an empty collection.role
- the role.items
- item restrictions. Can be empty. This parameter is optional, it is valid to pass null or an empty collection.UnsupportedDocumentRoleFault
- the role provided is not supported by a context associated by one of the supplied rights.UnknownDocumentRoleFault
- the role does not exist.UnknownDocumentRightFault
- at least one of the rights does not exist.AuthorizationDeniedFault
- authorization denied. The authenticated user is not authorized to call this operation.DocumentRight[] checkInRightsForAccount(AccountRef account) throws AuthorizationDeniedFault
account
- the account.AuthorizationDeniedFault
- if the authenticated user is not allowed to check in rights. This will typically indicate that the authenticated user no longer exists in the user store. e.g. session is still valid but the user has been deleted from the user store.DocumentRight[] saveChangesToItems(DocumentRightRef[] rights, ItemCode[] itemCodes, ItemCode[] delta) throws UnknownDocumentRightFault, AuthorizationDeniedFault
DocumentRight
. Changes are made to the list of item restrictions by comparing the two copies of the item codes provided and either removing or adding item restrictions by looking at the delta.ItemCode
instances then new items will be added to the rights. However, if the delta (as compared to the first list of items) does not contain an ItemCode
instance then the items will be removed from the rights.
addContextManagers
method.
import static oracle.irm.j2ee.jws.rights.context.DocumentRightOperations.getDocumentRightOperationsEndpoint; import java.net.Authenticator; import java.net.PasswordAuthentication; import java.net.URLEncoder; import java.util.Date; import oracle.irm.engine.types.classifications.item.ItemCode; import oracle.irm.engine.types.core.account.AccountRef; import oracle.irm.engine.types.rights.context.DocumentRight; import oracle.irm.engine.types.rights.context.DocumentRightRef; import oracle.irm.j2ee.jws.rights.context.DocumentRightOperationsEndpoint; public class SaveChangesToItemsWS { public static void main(String[] args) throws Exception { final String hostPort = args[0]; final String username = args[1]; final String password = args[2]; // Configure an authenticator to provide the credentials // for the web service Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); // Get the document right operations web service DocumentRightOperationsEndpoint rightOperations = getDocumentRightOperationsEndpoint(hostPort); // Reference the account by user name AccountRef accountRef = new AccountRef("urn:user:" + URLEncoder.encode(username, "utf-8")); // Get all rights assigned to the account DocumentRight[] rights = rightOperations.listRightsByAccount(accountRef); // Take the first one on the list DocumentRight right = rights[0]; DocumentRightRef rightRef = new DocumentRightRef(right.getUuid()); // The save change method allows items to be added and/or removed in the same call. // It does this be comparing two sets of items and applying the differences. // Item codes ItemCode sampleItemCode = new ItemCode(); sampleItemCode.setValue("sample-item-code"); ItemCode sampleItemCodeOne = new ItemCode(); sampleItemCodeOne.setValue("sample-item-code-one"); sampleItemCodeOne.setTime(new Date()); ItemCode sampleItemCodeTwo = new ItemCode(); sampleItemCodeTwo.setValue("sample-item-code-two"); sampleItemCodeTwo.setTime(new Date()); // This example shows a delta where item "sample-item-code" is removed // and items "sample-item-code-one" and "sample-item-code-two" are added. ItemCode[] itemCodes = new ItemCode[] { sampleItemCode }; ItemCode[] deltaItemCodes = new ItemCode[] { sampleItemCodeOne, sampleItemCodeTwo }; // Alter the items rightOperations.saveChangesToItems(new DocumentRightRef[] { rightRef },itemCodes, deltaItemCodes); } }
rights
- the rights to alter. This parameter is optional, it is valid to pass null or an empty collection.itemCodes
- the item codes. This parameter is optional, it is valid to pass null or an empty collection.delta
- the changes. This parameter is optional, it is valid to pass null or an empty collection.UnknownDocumentRightFault
- the document right does not exist.AuthorizationDeniedFault
- authorization denied. The authenticated user is not authorized to call this operation.void unassignRights(DocumentRightRef[] rights) throws AuthorizationDeniedFault
addContextManagers
method.
import static oracle.irm.j2ee.jws.rights.context.DocumentRightOperations.getDocumentRightOperationsEndpoint; import java.net.Authenticator; import java.net.PasswordAuthentication; import java.net.URLEncoder; import oracle.irm.engine.types.core.account.AccountRef; import oracle.irm.engine.types.rights.context.DocumentRight; import oracle.irm.engine.types.rights.context.DocumentRightRef; import oracle.irm.j2ee.jws.rights.context.DocumentRightOperationsEndpoint; public class UnassignRightsWS { public static void main(String[] args) throws Exception { final String hostPort = args[0]; final String username = args[1]; final String password = args[2]; // Configure an authenticator to provide the credentials // for the web service Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); // Get the document right operations web service DocumentRightOperationsEndpoint rightOperations = getDocumentRightOperationsEndpoint(hostPort); // Reference the account by user name AccountRef accountRef = new AccountRef("urn:user:" + URLEncoder.encode(username, "utf-8")); // Get all rights assigned to the account DocumentRight[] rights = rightOperations.listRightsByAccount(accountRef); DocumentRightRef[] rightRefs = new DocumentRightRef[rights.length]; for (int i = 0; i < rightRefs.length; ++i) { rightRefs[i] = new DocumentRightRef(rights[i].getUuid()); } // Unassign the rights rightOperations.unassignRights(rightRefs); } }
rights
- the rights to un-assign. This parameter is optional, it is valid to pass null or an empty collection.AuthorizationDeniedFault
- authorization denied. The authenticated user is not authorized to call this operation.DocumentRight[] listRightsByContext(ContextInstanceRef context, PageRange pageRange) throws UnknownContextFault, AuthorizationDeniedFault
addContextManagers
method. This method can be invoked by users that have the Inspector role in the related context. This role can be assigned using the addInspectors
method.context
- the context.pageRange
- page range for the search result.UnknownContextFault
- the context does not exist.AuthorizationDeniedFault
- authorization denied. The authenticated user is not authorized to call this operation.DocumentRight[] listRightsByAccount(AccountRef account) throws AuthorizationDeniedFault
import static oracle.irm.j2ee.jws.rights.context.DocumentRightOperations.getDocumentRightOperationsEndpoint; import java.net.Authenticator; import java.net.PasswordAuthentication; import java.net.URLEncoder; import oracle.irm.engine.types.classifications.item.ItemCode; import oracle.irm.engine.types.core.account.AccountRef; import oracle.irm.engine.types.rights.context.DocumentRight; import oracle.irm.j2ee.jws.rights.context.DocumentRightOperationsEndpoint; public class ListRightsByAccountWS { public static void main(String[] args) throws Exception { final String hostPort = args[0]; final String username = args[1]; final String password = args[2]; // Configure an authenticator to provide the credentials // for the web service Authenticator.setDefault(new Authenticator() { @Override protected PasswordAuthentication getPasswordAuthentication() { return new PasswordAuthentication(username, password.toCharArray()); } }); // Get the document right operations web service DocumentRightOperationsEndpoint rightOperations = getDocumentRightOperationsEndpoint(hostPort); // Reference the account by user name, allowed formats are // urn:user:xxxx // urn:group:xxxx // 00000000-0000-0000-0000-000000000000 AccountRef accountRef = new AccountRef("urn:user:" + URLEncoder.encode(username, "utf-8")); // Get all of the rights assigned to the account DocumentRight[] rights = rightOperations.listRightsByAccount(accountRef); // Display a summary of each right for (DocumentRight right : rights) { System.out.println("Account: " + right.getAccount().getUuid()); System.out.println(" Context: " + right.getContext().getUuid()); System.out.println(" Role: " + right.getRole().getUuid()); // Show items ItemCode[] itemCodes = right.getItemCodes(); if (itemCodes != null) { for (ItemCode itemCode : itemCodes) { System.out.println(" ItemCode: " + itemCode.getValue()); } } } } }
account
- the account.AuthorizationDeniedFault
- if the authenticated user is not allowed to list rights. This will typically indicate that the authenticated user no longer exists in the user store. e.g. session is still valid but the user has been deleted from the user store.
|
Oracle® Information Rights Management Server Java API Reference 11g Release 1 (11.1.1) E12907-02 |
|||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |