• Icon: Improvement Improvement
    • Resolution: Invalid
    • Icon: Major Major
    • 4.3.0
    • 4.2.1
    • None
    • None
    • 1 - Middle term
    • 2 - Normal

      I'm getting an array of ContentValue, then I'm filtering these values to remove one and I'm setting the metadata with the new setValue method with the new array of ContentValue.

      var coursePartsArray = course.getValue("courseParts");
      var coursePartsArrayNew = Arrays.stream(coursePartsArray)
          .filter(function(item) { return !item.getContentId().equals(coursePartId); })
          .toArray();
      course.setValue("courseParts", coursePartsArrayNew);

      Note : This is Nashorn so it's untyped.

      org.ametys.runtime.model.exception.BadItemTypeException: Try to set the non string value '[Ljava.lang.Object;@7afe6c09' to the string data 'courseParts' on 'org.ametys.plugins.repository.data.repositorydata.impl.JCRRepositoryData@2cb85016'
      	at org.ametys.cms.data.type.impl.ContentRepositoryElementType.write(ContentRepositoryElementType.java:112)
      	at org.ametys.plugins.repository.data.holder.impl.DefaultModifiableModelAwareDataHolder.setValue(DefaultModifiableModelAwareDataHolder.java:289)
      	at org.ametys.plugins.repository.data.ametysobject.ModifiableModelAwareDataAwareAmetysObject.setValue(ModifiableModelAwareDataAwareAmetysObject.java:63)
      [...]

            Unassigned Unassigned
            bmaurel Bérénice Maurel
            Votes:
            0 Vote for this issue
            Watchers:
            1 Start watching this issue

              Created:
              Updated:
              Resolved: