Uploaded image for project: 'Chemistry (Retired)'
  1. Chemistry (Retired)
  2. CMIS-523

Inconsistency when updating properties

    XMLWordPrintableJSON

Details

    • Bug
    • Status: Closed
    • Major
    • Resolution: Incomplete
    • OpenCMIS 0.6.0
    • None
    • opencmis-server-jcr
    • None

    Description

      Is it possible that errors arise when updating the properties of documents or folders?

      For instance, DefaultDocumentTypeHandler makes use of the content node to set the property values ​​from the type definition at node's creation:

          public JcrNode createDocument(JcrFolder parentFolder, String name, Properties properties, ContentStream contentStream, VersioningState versioningState) {
              try {
                  Node fileNode = parentFolder.getNode().addNode(name, NodeType.NT_FILE);
                  if (versioningState != VersioningState.NONE) {
                      fileNode.addMixin(NodeType.MIX_SIMPLE_VERSIONABLE);
                  }
      
                  Node contentNode = fileNode.addNode(Node.JCR_CONTENT, NodeType.NT_RESOURCE);
                  contentNode.addMixin(NodeType.MIX_CREATED);
      
                  // compile the properties
                  JcrFolder.setProperties(contentNode, getTypeDefinition(), properties);
      

      In contrast, when the document properties are updated by the method updateProperties in JcrNode is updated 'node', not the context node:

                  // Are there properties to update?
                  PropertyUpdater propertyUpdater = PropertyUpdater.create(typeManager, getTypeId(), properties);
      
                  JcrVersionBase jcrVersion = isVersionable()
                          ? asVersion()
                          : null;
      
                  // Update properties. Checkout if required
                  boolean autoCheckout = false;
                  if (!propertyUpdater.isEmpty()) {
                      autoCheckout = jcrVersion != null && !jcrVersion.isCheckedOut();
                      if (autoCheckout) {
                          jcrVersion.checkout();
                      }
      
                      // update the properties
                      propertyUpdater.apply(node);
                  }
      

      Thus, when defining types derived from the base types with specific properties this causes errors since it indicates that the properties that must be updated are not defined in the node.

      Maybe it is necessary to override this functionality in the derived types?

      Attachments

        1. JcrServiceFactoryDecorator.java
          0.7 kB
          Ivan Vasyliev
        2. NodeSetNameInvocationHandler.java
          1.0 kB
          Ivan Vasyliev
        3. AttachmentDocumentTypeHandler.java
          9 kB
          Ivan Vasyliev
        4. jcr_properties.patch
          5 kB
          Ivan Vasyliev

        Issue Links

          Activity

            People

              mduerig Michael Dürig
              jccampanero Jose Carlos Campanero
              Votes:
              1 Vote for this issue
              Watchers:
              3 Start watching this issue

              Dates

                Created:
                Updated:
                Resolved: