cancel
Showing results for 
Search instead for 
Did you mean: 

Integrity Violations

yusuf
Champ in-the-making
Champ in-the-making
Hi all,

I've been reading a book about Alfresco Enterprise Content Management by Munwar Shariff. In this book a scripting example is given:
——————————————————————————————
var stagingFolder = companyhome.childByNamePath("Intranet/Marketing
Communications/Website Documents/Staging");
var productionFolder = companyhome.childByNamePath("Intranet/Marketing
Communications/Website Documents/Production");
if(stagingFolder != null)
{
var i=0;
var today = new Date();
stagingChildren = stagingFolder.children;
stagingTotal = stagingChildren.length;
for(i=0; i<stagingTotal;i++)
{
child = stagingChildren;
if(child.properties["cm:from"] <= today)
{
child.move(productionFolder);
}
}
}

——————————————————————————————

when I try to implement this script I get the following error:
——————————————————————————————
Failed to run Actions due to error: Found 1 integrity violations: The association parent multiplicity has been violated: Target Node: workspace://SpacesStore/b5b0189a-1487-11dd-b98a-a3150a38c112 Association: Association[ class=ClassDef[name={http://www.alfresco.org/model/rule/1.0}rules], name={http://www.alfresco.org/model/rule/1.0}ruleFolder, target class={http://www.alfresco.org/model/content/1.0}systemfolder, source role=null, target role=null] Required parent Multiplicity: 1..1 Actual parent Multiplicity: 0
——————————————————————————————
What's the problem here. How can this be solved?
Thanks in advance,
Yusuf
2 REPLIES 2

dgenard
Champ on-the-rise
Champ on-the-rise
The problem is that the script tries to moves the rules system folder attached to the staging folder, which is not permitted.
You should add a condition on the children to move.
In example :

if(child.isDocument && child.properties["cm:from"] <= today)
{
child.move(productionFolder);
}

Denis

yusuf
Champ in-the-making
Champ in-the-making
Hi Denis,

Thank you for the solution. It worked great.
Been using scripting from version 1.4 and i geuss they have changed a lot in version 2.1