Hi,
We are using Taskspace 6.7 and I've customized the import component for importing documents.
TBO for custom type is used for attaching lifecycle on new document and sets the appropriate ACL on the document.
ACL is dependent on the properties of the document. So whenever the property of the document is changed, ACL is updated.
While importing the document, doSave() is called lifecycle is applied but no ACL is applied on the document (default dm_ acl is applied). No error is shown in the app server logs. Document is imported.
When I change the property of the document using Properties window, this time appropriate ACL on the document is applied.
I have cleared the app server cache. Checked the latest implementation and interface JAR is being used.
I'm posting the code for your reference. Pls let me know if I'm missing anything or need to do things in different manner.
public void doSave(boolean arg0, String arg1, Object[] arg2)
throws DfException {
System.out.println("doSave entered");
IDfQuery qry = new DfQuery();
IDfCollection col = null;
boolean bln = false;
IDfSession session = getObjectSession();
try {
session.addDynamicGroup("dm_superusers_dynamic");
super.doSave(arg0, arg1, arg2);
String strStatus = this.getStatus();
if (isNewDocument()) {
String object_name = this.getObjectName();
if (object_name.trim().equals("")) {
} else {
if ("IN-PROGRESS".equalsIgnoreCase(strStatus))
applyLifeCycle(0,session);
else if ("EFFECTIVE".equalsIgnoreCase(strStatus))
applyLifeCycle(1,session);
else if ("OBSOLETE".equalsIgnoreCase(strStatus))
applyLifeCycle(0,session);
}
}
System.out.println(session.getLoginUserName());
strStatus = this.getStatus();
}
try {
// Dummy acl
applyAcl("0160_ca_int_inp", getObjectSession());
} catch (Exception e) {
e.printStackTrace();
}
} finally{
session.removeDynamicGroup("dm_superusers_dynamic");
if (col != null)
try {
col.close();
} catch (DfException e) {
e.printStackTrace();
}
System.out.println("In finally block");
}
}
private void applyLifeCycle(int iState, IDfSession session) throws DfException {
StringBuffer bufQual = new StringBuffer();
bufQual.append("dm_policy where object_name='").append(LIFECYCLE_NAME)
.append("'");
IDfId policyId = session.getIdByQualification(bufQual.toString());
IDfSysObject policyObj = (IDfSysObject) session.getObject(policyId);
String stateName = policyObj.getRepeatingString("state_name", iState);
attachPolicy(policyId, stateName, "");
}
private void applyAcl(String aclName, IDfSession session){
IDfACL aclObj = null;
try {
getObjectSession().addDynamicGroup("dm_superusers_dynamic");
aclObj = (IDfACL) session.getObjectByQualification("dm_acl where object_name = '"+aclName+"'");
if (aclObj!=null){
aclObj.setDomain("dm_dbo");
setACL(aclObj);
System.out.println("applyACL111: "+getACLName());
}
} catch (DfException e) {
e.printStackTrace();
}
}
}
Thanks !!!!