The following code fragment
shows how the ApplyACTToObj method is issued in a Java environment:
public void applyAccessControlTemplateToObj(String transCtxt, String resource,
int options, String ACTspec ) throws Exception {
try
{
SecurityAdmin.ApplyACTToObj(transCtxt, resource, options, ACTspec);
}
catch (Exception e)
{
System.out.println("ApplyACTToObj: Exceptions");
e.printStackTrace();
throw e;
}
}
The following example
issues the ApplyACTToObj method to apply a predefined ACT to an existing
Tree object that represents a folder. The ACT is identified by ACTSPEC:
public void ApplyACTToObj() throws Exception {
// Define an object variable for the Tree
Tree_URN = "OMSOBJ:Tree/metadata-identifier";
// Apply the ACT to a Tree. Because resource is used, the tCtxt parameter is null.
iSecurityAdmin.ApplyAccessControlTemplateToObj("",Tree_URN, 0, ACTspec);
//If we had submitted a tCtxt value, resource would be null.
}
catch (Exception e)
{
throw e;
}
}