Please post the code sample to create ACl (Access control list) using DFC code in Documentum.
Thanks, Asfaque
Please post the code sample to create ACl (Access control list) using DFC code in Documentum.
Thanks, Asfaque
Try this dear Friend
Main class
public class Main {
static LoginSession obj = null;
static IDfSession idfSession = null;
public static void main(String[] args) throws Exception {
// TODO Auto-generated method stub
String userName = "userName";
String password = "password";
String docbaseName = "repository";
try {
obj = new LoginSession();
idfSession = obj.getDfSession(userName, password, docbaseName);
// Create ACL
CreateACL createACL = new CreateACL();
createACL.createACL(idfSession);
} finally {
if (idfSession != null) {
obj.getiDfSessionManager().release(idfSession);
System.out.println("Session released");
}
}
}
}
LoginSession
public class LoginSession {
private IDfSessionManager iDfSessionManager = null;
private IDfSession idfsession = null;
public IDfSessionManager getiDfSessionManager() {
return iDfSessionManager;
}
public void setiDfSessionManager(IDfSessionManager iDfSessionManager) {
this.iDfSessionManager = iDfSessionManager;
}
public IDfSession getIdfsession() {
return idfsession;
}
public void setIdfsession(IDfSession idfsession) {
this.idfsession = idfsession;
}
public IDfSession getDfSession(String userName, String password, String docbaseName) throws Exception {
IDfLoginInfo loginInfo = new DfLoginInfo();
loginInfo.setUser(userName);
loginInfo.setPassword(password);
IDfClient client = new DfClient();
iDfSessionManager = client.newSessionManager();
iDfSessionManager.setIdentity(docbaseName, loginInfo);
idfsession = iDfSessionManager.getSession(docbaseName);
if (idfsession != null)
System.out.println("Session created successfully");
return idfsession;
}
}
ACL Class
public class CreateACL {
String name = "bhuwan1_acl";
String description = "bhuwan_acl_descrip";
public void createACL(IDfSession idfSession) throws DfException {
IDfACL acl = (IDfACL) idfSession.newObject("dm_acl");
if (acl != null) {
acl.setObjectName(name);
acl.setDescription(description);
acl.save();
}
IDfPermit permit = new DfPermit();
if (permit != null) {
permit.setAccessorName("Bhuwan User");
permit.setPermitType(IDfPermit.DF_ACCESS_PERMIT);
permit.setPermitValue(IDfACL.DF_PERMIT_READ_STR);
acl.grantPermit(permit);
acl.save();
}
System.out.println("ACL created");
}
}