Hi,
My requirement is to select multiple files and use a custom menu to bulk import same set of files with new content and update some attributes. I m trying to do the same by doing a checkout and checkin inside a submit button and then calling ActionService. It works fine for 1 file but when multiple it fails.
Also any alternate suggestion where i can just select multiple files and replace content not like check out and check in one by one.
public void onInit(ArgumentList args)
{
//String[] strComponentArgs = null;
super.onInit(args);
try
{
String [] compArgs = args.getValues("componentArgs");
objIds = new String [compArgs.length];
for (int i=0; i < compArgs.length; i++){
//System.out.println("ComponentArgs = " + compArgs[i]);
ArgumentList temp = ArgumentList.decode(compArgs[i]);
objIds[i] = temp.get("objectId");
}
And on onSubmit event we have used the code like below. Looping one by one object on Submit.
public void onSubmit(Control button,ArgumentList args)throws Exception {
for (int i=0;i<objIds.length;i++){
try {
currSysObj=(IDfSysObject) getDfSession().getObject(new DfId(objIds[i]));
if(currSysObj!=null){
currSysObj.checkout();
iChronicleID = currSysObj.getChronicleId();
args.add("objectId",objIds[i]);
args.replace("objectId",objIds[i]);
if(ActionService.execute("checkin",args,getContext(),this, new CallbackDoneListener(this, "returnFromCheckin"))){ //returnFromCheckin method is below
displayStatus("Document(s) import successful");
}
else
{
System.out.println("Failed to import the file for vendor");
displayStatus("Failed to import the file for vendor. Please contact Documentum Support Team.");
}
}
}
catch (DfException e) {
}
}
}
public void returnFromCheckin(String strAction, boolean bSuccess, Map map) {
Set mapKeys = map.keySet();
Iterator itr = mapKeys.iterator();
String key = null;
while(itr.hasNext())
{
key = (String) itr.next();
}
try {
String query = "select r_object_id from netledoc where i_chronicle_id = '"
+ iChronicleID.getId() + "'";
IDfCollection col = execQuery(query, getDfSession());
String strRObjID = null;
while (col.next()) {
strRObjID = col.getString("r_object_id");
}
IDfSysObject newObj = (IDfSysObject) getDfSession().getObject(
new DfId(strRObjID));
String successVal = (String)map.get(CheckinContainer.SUCCESS_ON_RETURN);
if (successVal != null && successVal.equalsIgnoreCase("true")) {
newObj.setACLName("NE TLE Drawing");
newObj.save();
}
} catch (Exception e) {
}
}
Below is the exception in logs
08:11:40,310 ERROR [http-8080-2] com.documentum.web.common.Trace - invokeMethod() failed while calling: onSubmit
The action and action complete listener do not match that from previous calls.
java.lang.IllegalArgumentException: The action and action complete listener do not match that from previous calls.
at com.documentum.web.formext.action.LaunchComponent.execute(LaunchComponent.java:261)
at com.documentum.web.formext.action.LaunchComponentWithPermitCheck.execute(LaunchComponentWithPermitCheck.java:211)
at com.documentum.web.formext.action.ActionService.execute(ActionService.java:708)
at com.documentum.web.formext.action.ActionService.execute(ActionService.java:326)
at com.documentum.web.formext.action.ActionService.execute(ActionService.java:85)
at com.ng.custom.transmissionEng.ImportDrawings.onSubmit(ImportDrawings.java:226)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)