cancel
Showing results for 
Search instead for 
Did you mean: 

Copy of node

soeursourire
Champ in-the-making
Champ in-the-making
Hi!

I had a table in my DB: like for the nodes Person I have nodes Ps in ThePs in system. I am trying to copy one node Ps in these ThePs but get the following error:

ERROR [org.alfresco.repo.node.integrity.IntegrityChecker] Found 1 integrity violations:
The association source type is incorrect:
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/content/1.0}folder], name={http://www.alfresco.org/model/content/1.0}contains, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/content/1.0}folder
   Actual Source Type: {http://www.alfresco.org/model/system/1.0}container
2006-09-24 22:41:19,750 WARN  [org.hibernate.cache.ReadWriteCache] An item was expired by the cache while it was locked (increase your cache timeout): org.alfresco.repo.domain.hibernate.ChildAssocImpl#557
2006-09-24 22:41:19,765 WARN  [org.hibernate.cache.ReadWriteCache] An item was expired by the cache while it was locked (increase your cache timeout): org.alfresco.repo.domain.hibernate.NodeImpl.parentAssocs#562

I do not understand what can be the problem especially that my method to copy a node was working before, I didnt change it… Do you have ideas?

Thanks
2 REPLIES 2

andy
Champ on-the-rise
Champ on-the-rise
Hi

This means you have done something that violates the data model.

Regards

Andy

johnoct
Champ in-the-making
Champ in-the-making
Not that I'm saying that Andy's answer wasn't helpful, but I just solved a similar issue to this so I'll offer some detail on how I did it.

I was having what appears to be the opposite issue:

The association source type is incorrect:
   Source Node: workspace://SpacesStore/37753868-94a0-11dd-8295-af5f09b255f2
   Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/system/1.0}container], name={http://www.alfresco.org/model/system/1.0}children, target class={http://www.alfresco.org/model/system/1.0}base, source role=null, target role=null]
   Required Source Type: {http://www.alfresco.org/model/system/1.0}container
   Actual Source Type: {http://www.alfresco.org/model/content/1.0}folder
22:21:52,926 ERROR [[localhost].[/alfresco].[Faces Servlet]] Servlet.service() for servlet Faces Servlet threw exception
org.alfresco.repo.node.integrity.IntegrityException: Integrity failure

My eventual problem was that I was passing the wrong association type:

I changed this:

      params.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, location);
      params.put(CopyActionExecuter.PARAM_DEEP_COPY, new Boolean(false));
      params.put(CopyActionExecuter.PARAM_OVERWRITE_COPY, new Boolean(false));
      params.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME, ContentModel.ASSOC_CHILDREN);
      params.put(CopyActionExecuter.PARAM_ASSOC_QNAME, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
      
      Action action = this.actionService.createAction(CopyActionExecuter.NAME, params);
      
      this.actionService.executeAction(action, document);

To This:

      params.put(CopyActionExecuter.PARAM_DESTINATION_FOLDER, location);
      params.put(CopyActionExecuter.PARAM_DEEP_COPY, new Boolean(false));
      params.put(CopyActionExecuter.PARAM_OVERWRITE_COPY, new Boolean(false));
      params.put(CopyActionExecuter.PARAM_ASSOC_TYPE_QNAME, ContentModel.ASSOC_CONTAINS);
      params.put(CopyActionExecuter.PARAM_ASSOC_QNAME, QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, "copy"));
      
      Action action = this.actionService.createAction(CopyActionExecuter.NAME, params);
      
      this.actionService.executeAction(action, document);

The difference being that I used an association "contains" instead of "children"… it seems that a folder can contain things, but a container has children. Hard to imagine how I missed that with the wealth of documentation on executing actions via java code.

I apologize for the tone. I'm having a familiar Alfresco frustrated moment.

Am I being unfair, though? Is there any documentation on how to use the copy action or any action via the Java APIs like this? I've spent a good deal of guessing, sifting through source code, and trial and error to get anything to work here.