cancel
Showing results for 
Search instead for 
Did you mean: 

dumb question

ptstudent
Champ in-the-making
Champ in-the-making
hi everyone, i'm new here and trying to find my way around alfresco, let me start by appologising if this is not the right place to make this question, but i've been trying to understand how Alfresco works and came arround a sample code that doesn't work for me

var stagingFolder = companyhome.childByNamePath("Intranet/Staging");
var productionFolder = companyhome.childByNamePath("Intranet/Production");
if(stagingFolder != null)
{
   var i=0;
   var today = new Date();
   for each(n in stagingFolder.children)
   {
      child = stagingFolder.children;
      if(child.properties["cm:from"] <= today)
      {
         child.move(productionFolder);
      }
   }
}


I keep getting a multiplicity erron on the .move(…) line… can anyone explain me why??? Smiley Frustrated

I know it's a dumb question, but give me a brake Smiley Tongue pls…

thanks a lot in advance
6 REPLIES 6

jpfi
Champ in-the-making
Champ in-the-making
Hi,
please provide a stack trace or sth. similar. Do you have a Intranet/Production folder under company home?
cheers, jan

ptstudent
Champ in-the-making
Champ in-the-making
I have Intranet/Staging and etc. inside the company home, with a few files with effective aspect for testing, nothing else.
Just a simple test workspace

jpfi
Champ in-the-making
Champ in-the-making
Hi,
ok, your Stack trace?
I'm wondering if this really works:
child.properties["cm:from"] <= today
Cheers, Jan

ptstudent
Champ in-the-making
Champ in-the-making
Failed to run Actions due to error: Found 1 integrity violations: The association parent multiplicity has been violated: Target Node: workspace://SpacesStore/3551bd16-5712-11dd-b225-05ae40c09c66 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


(child.properties["cm:from"] <= today)
really works, if i comment out the move(..) line everything works fine

jpfi
Champ in-the-making
Champ in-the-making
hm,
there is another bug in your javascript. i is always =0.
It should be sth. like this:

var stagingFolder = companyhome.childByNamePath("Intranet/Staging");
var productionFolder = companyhome.childByNamePath("Intranet/Production");
if(stagingFolder != null)
{
var today = new Date();
for each(child in stagingFolder.children)
{
if(child.properties["cm:from"] <= today)
{
child.move(productionFolder);
}
}
}
Cheers, Jan

ptstudent
Champ in-the-making
Champ in-the-making
hm,
there is another bug in your javascript. i is always =0.
It should be sth. like this:

var stagingFolder = companyhome.childByNamePath("Intranet/Staging");
var productionFolder = companyhome.childByNamePath("Intranet/Production");
if(stagingFolder != null)
{
var today = new Date();
for each(child in stagingFolder.children)
{
if(child.properties["cm:from"] <= today)
{
child.move(productionFolder);
}
}
}
Cheers, Jan


mmm… that one was a left over after converting from "for (i = …" to "for each(…"
thanks for pointing that out… changed it, but it still gives the same error

sorry if I'm getting a little annoying…


here's a complete report from the tomcat windows if it helps anyone:

11:55:32,721 ERROR [node.integrity.IntegrityChecker] Found 1 integrity violation
s:
The association parent multiplicity has been violated:
   Target Node: workspace://SpacesStore/3551bd16-5712-11dd-b225-05ae40c09c66
   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
11:55:32,736 ERROR [ui.common.Utils] Failed to run Actions due to error: Found 1
integrity violations:
The association parent multiplicity has been violated:
   Target Node: workspace://SpacesStore/3551bd16-5712-11dd-b225-05ae40c09c66
   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
org.alfresco.repo.node.integrity.IntegrityException: Found 1 integrity violation
s:
The association parent multiplicity has been violated:
   Target Node: workspace://SpacesStore/3551bd16-5712-11dd-b225-05ae40c09c66
   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
        at org.alfresco.repo.node.integrity.IntegrityChecker.checkIntegrity(Inte
grityChecker.java:627)
        at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionS
ynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:615)
        at org.springframework.transaction.support.TransactionSynchronizationUti
ls.triggerBeforeCommit(TransactionSynchronizationUtils.java:48)
        at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:821)
        at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.processCommit(AbstractPlatformTransactionManager.java:637)
        at org.springframework.transaction.support.AbstractPlatformTransactionMa
nager.commit(AbstractPlatformTransactionManager.java:624)
        at org.springframework.transaction.interceptor.TransactionAspectSupport.
commitTransactionAfterReturning(TransactionAspectSupport.java:307)
        at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(Sprin
gAwareUserTransaction.java:431)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransacti
on(RetryingTransactionHelper.java:255)
        at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransacti
on(RetryingTransactionHelper.java:171)
        at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.jav
a:128)
        at org.alfresco.web.bean.wizard.WizardManager.finish(WizardManager.java:
540)
        at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.
java:39)
        at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAcces
sorImpl.java:25)
        at java.lang.reflect.Method.invoke(Method.java:597)
        at org.apache.myfaces.el.MethodBindingImpl.invoke(MethodBindingImpl.java
:132)
        at org.apache.myfaces.application.ActionListenerImpl.processAction(Actio
nListenerImpl.java:61)
        at javax.faces.component.UICommand.broadcast(UICommand.java:109)
        at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:9
7)
        at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:1
71)
        at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(Invoke
ApplicationExecutor.java:32)
        at org.apache.myfaces.lifecycle.LifecycleImpl.executePhase(LifecycleImpl
.java:95)
        at org.apache.myfaces.lifecycle.LifecycleImpl.execute(LifecycleImpl.java
:70)
        at javax.faces.webapp.FacesServlet.service(FacesServlet.java:139)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:269)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
        at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(Authentica
tionFilter.java:81)
        at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(Appl
icationFilterChain.java:215)
        at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationF
ilterChain.java:188)
        at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperV
alve.java:210)
        at org.apache.catalina.core.StandardContextValve.invoke(StandardContextV
alve.java:174)
        at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.j
ava:127)
        at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.j
ava:117)
        at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineVal
ve.java:108)
        at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.jav
a:151)
        at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java
:870)
        at org.apache.coyote.http11.Http11BaseProtocol$Http11ConnectionHandler.p
rocessConnection(Http11BaseProtocol.java:665)
        at org.apache.tomcat.util.net.PoolTcpEndpoint.processSocket(PoolTcpEndpo
int.java:528)
        at org.apache.tomcat.util.net.LeaderFollowerWorkerThread.runIt(LeaderFol
lowerWorkerThread.java:81)
        at org.apache.tomcat.util.threads.ThreadPool$ControlRunnable.run(ThreadP
ool.java:685)
        at java.lang.Thread.run(Thread.java:619)