AnsweredAssumed Answered

[Error]The association source type is incorrect. [Question] How to start the creation of a folder hierarchy of a Site?

Question asked by mbel on Nov 30, 2016
Latest reply on Nov 30, 2016 by afaust

Hello,

I am trying to create a Site and folders hierarchy programmatically using Java API.

After the new Site is created, I get the groupName and find the NodeRef of the authority (GROUP_site)

String groupSite = this.siteService.getSiteGroup(newSite.getShortName());
NodeRef groupSiteNodeRef = this.authorityService.getAuthorityNodeRef(groupSite);

 

And after that start creating the folders as assign them first to groupSiteNodeRef :

this.nodeService.createNode

                  ( groupSiteNodeRef ,
                  ContentModel.ASSOC_CONTAINS,
                   QName.createQName(NamespaceService.CONTENT_MODEL_1_0_URI, name),
                   ContentModel.TYPE_FOLDER,
                   properties);

 

However, I receive the following ERROR:

 

ERROR [node.integrity.IntegrityChecker] [http-bio-8080-exec-2] Found 1 integrity violations:
The association source type is incorrect:
Source Node: workspace://SpacesStore/3c68c987-c9af-4baa-8b6c-e0720f534cbc
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/content/1.0}authorityContainer
at org.alfresco.repo.node.integrity.IntegrityChecker.checkIntegrity(IntegrityChecker.java:662)

 

So, obviously it doesn't like that I have a folder which is assign to the GROUP_site.

Could someone tells me what I did wrong?

How to start the creation of a folder hierarchy of a Site?

 

Thank you in advance.

Outcomes