AnsweredAssumed Answered

Change made through a  webscript not reflected on ShareUI

Question asked by annakan on Apr 14, 2011
Latest reply on Apr 19, 2011 by annakan
Hello all,

I am trying to make changes to nodes through a webscript not although all API call are ok (not raising any error), NOTHING is translated in the shareUI.

The exact same thing happens when I run code into the debugger evaluate console
Taking a leaf from
% var props = new Array();
% props["cm:name"] = "node name4.txt";
% destNode.nodeRef
% var node5 = destNode.createNode(null, "cm:content", props, "cm:contains");
for(i in destNode.children) {logger.log(i +":"+destNode.children[i].name)}
The console output this
2:Bidon Folder
4:node name4.txt

but going into the folder shows nothing, the node name4.txt is not there.
The "Bidon folder" was created like this :
% destNode.createFolder("Bidon Folder")
Node Type: {}folder, Node Aspects: [{}auditable, {}referenceable]
and then doing
% destNode.createFolder("Bidon Folder")
Wrapped org.alfresco.service.cmr.model.FileExistsException: Existing file or folder Bidon Folder already exists
shows the folder exists.
but it does not shows up in the UI as a child of destNode ????
and in the  the node explorer examining the nodeDest folder shows that it has NONE of the children I just added, in fact looking for node5.nodeRef shows it as non existent, but trying to do
% var node5 = destNode.createNode(null, "cm:content", props, "cm:contains");
Wrapped org.alfresco.service.cmr.repository.DuplicateChildNodeNameException: Duplicate child name not allowed: node name4.txt

The debugger seems to operate in another transaction ? how can I merge the changes then ?

The root of the problem, why did I try this :

I tried this because I try to do this in my code to no avail :
if (String(curParent.qnamePath)===String(sourceFolder.qnamePath))
                           logger.log("Complexe MATCH : " + curParent.qnamePath );
                           //fileNode.parents[i]=sourceFolder // Too obvious DOES NOT WORK
                           logger.log("creating association to:" + destNode.qnamePath);
                           logger.log("removing association toward:" + sourceFolder.qnamePath);
                           //; //Does not change a thing

the code
logger.log("*********** parents AFTER ****************** ");
                     for(i=0;i < fileNode.parents.length; i+=1){
                     logger.log("*********** assoc contains AFTER ****************** ");
                     for(i=0;i < fileNode.parentAssocs["cm:contains"][0].length; i+=1){
Shows that NONE of the parents properties where updated/changed ??????

But the repository IS modified, I can see that because  the next time I run that code on the same "fileNode", Alfresco throw an exception for the duplicate items, but NOTHING happens in the UI, nowhere in my sight.

It is highly probable that I miss something obvious or misunderstand the "containment semantic" but right now I am at a loss.

Changing parents from java DOES work, and is reflected in the shareUI… (but I can't do what I am doing in JAVA for complex reasons tied to the current state of share (for the whole story see, and my goal is, but none of this matter for the problem at hand)

I am a few hours before declaring our proof of concept with alfresco a failure, so any help would be greatly appreciated :)

thanks a lot for your time.

What am I missing ?