02-18-2013 12:10 PM
Hello,
I'm trying to create a custom operation for the first time with nuxeo IDE.
This operation aims to duplicate current workspace hierarchy as a section hierarchy in the parent domain.
With provided studio operations, i managed easily to create a matching section as a workspace is created in the domain (Each of my domains have a sections root and a workspace root)...
But here i get a "transaction failed" error in the UI though what I get in the logs seems to assert my document hierarchy is somehow created.
This is how i try to create my sections hierarchy :
for(int i = nodes.size()-1; i >= 0; i --){
nodeName = nodes.get(i).get(0);
try {
logger.warn("--"+nodes.get(i).get(0)+"--"+nodes.get(i).get(1));
sectionRoot = session.getChild(ref, nodeName.trim());
} catch (ClientException e) {
sectionRoot = session.createDocumentModel(sectionRoot.getPathAsString(), nodeName.trim(), "Section");
logger.warn("--Section root Path : "+sectionRoot.getPathAsString()+"--");
sectionRoot.setPropertyValue("dc:title", nodeName);
sectionRoot = session.createDocument(sectionRoot);
}
ref = sectionRoot.getRef();
}
session.save();
return sectionRoot;
}
And here is what i get in the logs :
2013-02-18 16:40:49,235 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --MirrorSectionHierarchy --under test--
2013-02-18 16:40:49,237 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --First parent bound is test--
2013-02-18 16:40:49,239 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --workspaceName has value : Zone de fouilles--
2013-02-18 16:40:49,244 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --sectionRoot has value : Zone de publications
2013-02-18 16:40:49,245 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --Commandes--Folder
2013-02-18 16:40:49,247 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --Section root Path : /Université Lille 2/SI/GED - SI/Sections/Zone de fouilles/Commandes--
2013-02-18 16:40:49,253 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --test--OrderedFolder
2013-02-18 16:40:49,254 WARN [fr.univlille2.ecm.automation.MirrorSectionHierarchy] --Section root Path : /Université Lille 2/SI/GED - SI/Sections/Zone de fouilles/Commandes/test--
Can someone please help me with what is missing here ? Thanks!
02-19-2013 11:03 AM
Even trying to handle the operation in a dedicated transaction is useless, i don't get any error message but my section tree is still not created though i can get the path i expect to draw passing a getPathAsString() on the last document i'm trying to create
02-25-2013 05:49 AM
Finally worked with a work-around ie:
1/ Create this custom operation to push parents into context as a list
2/ Use a "Run for each" operation to evaluate if the child has to be created or not as a section, create the referring section if required.