Uploaded image for project: 'CMS'
  1. CMS
  2. CMS-10175

CreateContentFunction : The mixin types are not setted at the begining

XMLWordPrintable

    • Icon: Bug Bug
    • Resolution: Fixed
    • Icon: Major Major
    • 4.3.0
    • 4.3.0
    • None
    • None
    • 4.3 M6

      ... and it can create side effects while calling the new API (content.setValue(...)) on an attribute from a mixin after calling content.setTitle(...).

      org.ametys.runtime.model.exception.UndefinedItemPathException: Unable to retrieve the model item at path 'myAttributeInTheAddedMixin'. This path is not defined by the model.
      	at org.ametys.runtime.model.ModelHelper.getModelItem(ModelHelper.java:109)
      	at org.ametys.plugins.repository.data.holder.impl.DefaultModelAwareDataHolder.getDefinition(DefaultModelAwareDataHolder.java:331)
      	at org.ametys.plugins.repository.data.holder.impl.DefaultModelAwareDataHolder.getValue(DefaultModelAwareDataHolder.java:214)
      	at org.ametys.plugins.repository.data.ametysobject.ModelAwareDataAwareAmetysObject.getValue(ModelAwareDataAwareAmetysObject.java:64)
      	at my.package.MyCreateContentFunction._populateContent(MyCreateContentFunction.java:291)
      	at my.package.MyCreateContentFunction.execute(MyCreateContentFunction.java:123)
      	at jdk.internal.reflect.GeneratedMethodAccessor45.invoke(Unknown Source)
      	at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
      	at java.base/java.lang.reflect.Method.invoke(Method.java:566)
      	at org.ametys.runtime.plugin.component.PluginsComponentManager$ComponentInvocationHandler.invoke(PluginsComponentManager.java:177)
      	at com.sun.proxy.$Proxy20.execute(Unknown Source)
      	at com.opensymphony.workflow.AbstractWorkflow.executeFunction(AbstractWorkflow.java:871)
      	at com.opensymphony.workflow.AbstractWorkflow.transitionWorkflow(AbstractWorkflow.java:1044)
      	at org.ametys.plugins.workflow.AbstractAmetysWorkflow.transitionWorkflow(AbstractAmetysWorkflow.java:212)
      	at com.opensymphony.workflow.AbstractWorkflow.initialize(AbstractWorkflow.java:618)
      	at org.ametys.plugins.workflow.AbstractAmetysWorkflow.initialize(AbstractAmetysWorkflow.java:99)
      	at org.ametys.cms.workflow.ContentWorkflowHelper._doInitialize(ContentWorkflowHelper.java:223)
      	at org.ametys.cms.workflow.ContentWorkflowHelper.createContent(ContentWorkflowHelper.java:191)
      [...]

      Where _populateContent(...) is :

          protected void _populateContent(Map transientVars, ModifiableContent content) throws WorkflowException
          {
              super._populateContent(transientVars, content);
              content.setValue("myAttributeInTheAddedMixin", MY_VALUE);
          }

      If I call the method content.setMixinTypes(...) before the content.setTitle(...) method, this exception doesn't occured.

            raphael Raphaël Franchet
            bmaurel Bérénice Maurel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: