AnsweredAssumed Answered

Questions about relationship multiplicity

Question asked by robertmarkbram on Jun 30, 2010
Latest reply on Jul 1, 2010 by robertmarkbram
I have two questions about multiplicity in relationships (Alfresco-Community-3.3).

First question: what does the source's mandatory attribute mean? It doesn't seem to make a difference whether I make it false or true.
<type name="yourCo:product5">
   <title>Product</title>
   <parent>cm:content</parent>
   <associations>
      <!– one to one –>
      <association name="yourCo:productGraphicLink">
         <title>Product Graphic</title>
         <source>
            <mandatory>false</mandatory>
            <many>true</many>
         </source>
         <target>
            <class>yourCo:productGraphic</class>
            <mandatory>false</mandatory>
            <many>false</many>
         </target>
      </association>
   </associations>
</type>

Second question: is it broken to have target mandatory = true and many = true or do I just not understand it? My understanding is that you can't make an instance of the below unless you first have more than 1 instances of the target.

<type name="yourCo:product">
   <title>Product</title>
   <parent>cm:content</parent>
   <associations>
      <!– one to one –>
      <association name="yourCo:productGraphicLink">
         <title>Product Graphic</title>
         <source>
            <mandatory>false</mandatory>
            <many>false</many>
         </source>
         <target>
            <class>yourCo:productGraphic</class>
            <mandatory>true</mandatory>
            <many>true</many>
         </target>
      </association>
   </associations>
</type>

But whenever I try to make this I get:
16:10:05,199 ERROR [org.alfresco.repo.node.integrity.IntegrityChecker] Found 1 integrity violations:
The association target multiplicity has been violated:
   Source Node: workspace://SpacesStore/d903f15e-4034-422c-8cf6-e6d4990ce3cf
   Association: Association[ class=ClassDef[name={http://www.yourCo.com.au/model/content/1.0}product], name={http://www.yourCo.com.au/model/content/1.0}productGraphicLink, target class={http://www.yourCo.com.au/model/content/1.0}productGraphic, source role=null, target role=null]
   Required target Multiplicity: 1..*
   Actual target Multiplicity: 0
16:10:05,215 ERROR [org.alfresco.web.ui.common.Utils] Failed to create content due to error: 05300004 Found 1 integrity violations:
The association target multiplicity has been violated:
   Source Node: workspace://SpacesStore/d903f15e-4034-422c-8cf6-e6d4990ce3cf
   Association: Association[ class=ClassDef[name={http://www.yourCo.com.au/model/content/1.0}product], name={http://www.yourCo.com.au/model/content/1.0}productGraphicLink, target class={http://www.yourCo.com.au/model/content/1.0}productGraphic, source role=null, target role=null]
   Required target Multiplicity: 1..*
   Actual target Multiplicity: 0
org.alfresco.repo.node.integrity.IntegrityException: 05300004 Found 1 integrity violations:
The association target multiplicity has been violated:
   Source Node: workspace://SpacesStore/d903f15e-4034-422c-8cf6-e6d4990ce3cf
   Association: Association[ class=ClassDef[name={http://www.yourCo.com.au/model/content/1.0}product], name={http://www.yourCo.com.au/model/content/1.0}productGraphicLink, target class={http://www.yourCo.com.au/model/content/1.0}productGraphic, source role=null, target role=null]
   Required target Multiplicity: 1..*
   Actual target Multiplicity: 0
   at org.alfresco.repo.node.integrity.IntegrityChecker.checkIntegrity(IntegrityChecker.java:661)
   at org.alfresco.repo.transaction.AlfrescoTransactionSupport$TransactionSynchronizationImpl.beforeCommit(AlfrescoTransactionSupport.java:683)
   at org.springframework.transaction.support.TransactionSynchronizationUtils.triggerBeforeCommit(TransactionSynchronizationUtils.java:95)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.triggerBeforeCommit(AbstractPlatformTransactionManager.java:927)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:737)
   at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:723)
   at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:394)
   at org.alfresco.util.transaction.SpringAwareUserTransaction.commit(SpringAwareUserTransaction.java:472)
   at org.alfresco.repo.transaction.RetryingTransactionHelper.doInTransaction(RetryingTransactionHelper.java:343)
   at org.alfresco.web.bean.dialog.BaseDialogBean.finish(BaseDialogBean.java:124)
   at org.alfresco.web.bean.content.CreateContentWizard.finish(CreateContentWizard.java:115)
   at org.alfresco.web.bean.wizard.WizardManager.finish(WizardManager.java:593)
   at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
   at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.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(ActionListenerImpl.java:61)
   at javax.faces.component.UICommand.broadcast(UICommand.java:109)
   at javax.faces.component.UIViewRoot._broadcastForPhase(UIViewRoot.java:97)
   at javax.faces.component.UIViewRoot.processApplication(UIViewRoot.java:171)
   at org.apache.myfaces.lifecycle.InvokeApplicationExecutor.execute(InvokeApplicationExecutor.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(ApplicationFilterChain.java:290)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.web.app.servlet.AuthenticationFilter.doFilter(AuthenticationFilter.java:104)
   at sun.reflect.GeneratedMethodAccessor482.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy232.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.alfresco.repo.web.filter.beans.NullFilter.doFilter(NullFilter.java:68)
   at sun.reflect.GeneratedMethodAccessor482.invoke(Unknown Source)
   at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
   at java.lang.reflect.Method.invoke(Method.java:597)
   at org.alfresco.repo.management.subsystems.ChainingSubsystemProxyFactory$1.invoke(ChainingSubsystemProxyFactory.java:116)
   at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:172)
   at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:202)
   at $Proxy232.doFilter(Unknown Source)
   at org.alfresco.repo.web.filter.beans.BeanProxyFilter.doFilter(BeanProxyFilter.java:82)
   at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:235)
   at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:206)
   at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:233)
   at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:191)
   at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:128)
   at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:102)
   at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:109)
   at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:286)
   at org.apache.coyote.http11.Http11Processor.process(Http11Processor.java:845)
   at org.apache.coyote.http11.Http11Protocol$Http11ConnectionHandler.process(Http11Protocol.java:583)
   at org.apache.tomcat.util.net.JIoEndpoint$Worker.run(JIoEndpoint.java:447)
   at java.lang.Thread.run(Thread.java:619)


Thanks for any advice!

Rob
:)

Outcomes