Transaction failed on custom operation ?

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!

0 votes

1 answers

2121 views

ANSWER

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/19/2013

Hi,

What's your initial error?

02/20/2013

Hello, The only error i get is related to CAS and is not relevant I think :

2013-02-20 11:52:45,510 ERROR [org.nuxeo.ecm.platform.ui.web.auth.cas2.Cas2Authenticator] pass by validStartUpPage 2013-02-20 11:52:45,557 ERROR [org.nuxeo.ecm.platform.ui.web.auth.cas2.Cas2Authenticator] pass by validStartUpPage

Everything else is INFO, standard warnings and my DEBUG.

I've cleaned up my job deleting everything about my specific transaction handling and i can even retrieve the output document title in the operation after, but its creation is still not effective. Thanks for your time,

02/20/2013



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.

0 votes