04-14-2011 01:46 PM
% var props = new Array();
% props["cm:name"] = "node name4.txt";
% destNode.nodeRef
workspace://SpacesStore/2ce29180-ea37-4511-a754-fd3a6f6f5fab
% destNode.name
AutreAutreDossier
% 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 1:599_2.jpg
2:Bidon Folder
3:47dae0d4-1b44-4208-bbe9-e9965b4f9a77
4:node name4.txt
% destNode.createFolder("Bidon Folder")
Node Type: {http://www.alfresco.org/model/content/1.0}folder, Node Aspects: [{http://www.alfresco.org/model/content/1.0}auditable, {http://www.alfresco.org/model/system/1.0}referenceable]
and then doing % destNode.name
AutreAutreDossier
% destNode.createFolder("Bidon Folder")
Wrapped org.alfresco.service.cmr.model.FileExistsException: Existing file or folder Bidon Folder already exists
shows the folder exists.% 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
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);
destNode.createAssociation(fileNode,"cm:contains");
logger.log("removing association toward:" + sourceFolder.qnamePath);
fileNode.removeAssociation(sourceFolder,"cm:contains");
//fileNode.save(); //Does not change a thing
break;
}
};
logger.log("*********** parents AFTER ****************** ");
for(i=0;i < fileNode.parents.length; i+=1){
curParent=fileNode.parents[i];
logger.log("curParent"+curParent);
logger.log("Parent["+i+"]:"+curParent.qnamePath+"**"+curParent.id);
};
logger.log("*********** assoc contains AFTER ****************** ");
for(i=0;i < fileNode.parentAssocs["cm:contains"][0].length; i+=1){
curParent=fileNode.parentAssocs["cm:contains"][0][i];
logger.log("curParent"+curParent);
logger.log("Parent["+i+"]:"+curParent.qnamePath+"**"+curParent.id);
};
Shows that NONE of the parents properties where updated/changed ??????04-14-2011 03:40 PM
Caused by: com.ibatis.common.jdbc.exception.NestedSQLException:
— The error occurred in alfresco/ibatis/#resource.dialect#/node-insert-SqlMap.xml.
— The error occurred while applying a parameter map.
— Check the alfresco.node.insert_ChildAssoc-InlineParameterMap.
— Check the statement (update failed).
— Cause: com.mysql.jdbc.exceptions.jdbc4.MySQLIntegrityConstraintViolationException: Duplicate entry '4958-33-2164579964-c4_small.jpg' for key 'parent_node_id'
at com.ibatis.sqlmap.engine.mapping.statement.MappedStatement.executeUpdate(MappedStatement.java:107)
at com.ibatis.sqlmap.engine.impl.SqlMapExecutorDelegate.insert(SqlMapExecutorDelegate.java:393)
at com.ibatis.sqlmap.engine.impl.SqlMapSessionImpl.insert(SqlMapSessionImpl.java:82)
at org.springframework.orm.ibatis.SqlMapClientTemplate$8.doInSqlMapClient(SqlMapClientTemplate.java:366)
at org.springframework.orm.ibatis.SqlMapClientTemplate.execute(SqlMapClientTemplate.java:200)
… 129 more
I don't know if it is an alfresco bug for being "on the fringe" with multiple parents, or something I induce by mis-using the API.04-15-2011 04:03 AM
04-19-2011 10:41 AM
Tags
Find what you came for
We want to make your experience in Hyland Connect as valuable as possible, so we put together some helpful links.