2 Replies Latest reply on Nov 13, 2014 8:51 AM by janpetzold

    Document hash via CMIS


      I'm now using CMIS to interact with my Modeshape repository. Doing that I automatically want to hash my documents, something that Modeshapoe supports when using the JCR API:


      String docHash = ((StoredBinaryValue) doc).getHexHash();


      Now I'm adding a document via CMIS and I am unable to add the property cmis:contentStreamHash:


      Map<String, Object> fileProperties = new HashMap<String, Object>();
      fileProperties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
      fileProperties.put(PropertyIds.NAME, fileName);
      fileProperties.put(PropertyIds.CONTENT_STREAM_HASH, getSha1ForFile(fileName));


      Doing that I get the Exception


      java.lang.IllegalArgumentException: Property 'cmis:contentStreamHash' is not valid for this type or one of the secondary types!


      However CMIS 1.0 should support this:




      Anything I'm doing wrong? How am I going to detect duplicate files effectively without hashing them?