private void _1_documentCreation(Folder folder) throws IOException {
    Map<String, Object> properties = new HashMap<>();
    properties.put("metadata", "contentMetadata");
    properties.put(PropertyIds.OBJECT_TYPE_ID, "cmis:document");
    Document cmisContent =
        folder.createDocument(properties, pdf1ContentStream(), VersioningState.MAJOR);
    Content content = recordServices.getDocumentById(zeRecord).get(zeSchema.contentMetadata());
    assertThat(cmisContent.getId())
        .isEqualTo("content_" + zeRecord + "_contentMetadata_" + content.getId() + "_1.0");
    zeRecordContentId = content.getId();

    cmisContent = getSingleContentOf(zeRecord);
    assertThatContentStreamIsSameAs(cmisContent, pdf1ContentStream(), pdf1Hash);
    assertThatVersionCreationInfoAre(cmisContent, aliceId, documentCreationOClock);
    assertThat(cmisContent.getId())
        .isEqualTo("content_" + zeRecord + "_contentMetadata_" + content.getId() + "_1.0");
    assertThat(cmisContent.getProperty(PropertyIds.PARENT_ID).getValue()).isEqualTo(zeRecord);
    assertThat(cmisContent.getVersionLabel()).isEqualTo("1.0");
    assertThat(cmisContent.getVersionSeriesCheckedOutBy()).isNull();
    //		assertThat(cmisContent.getVersionSeriesCheckedOutId()).isNull();
    assertThat(cmisContent.getVersionSeriesId())
        .isEqualTo("content_" + zeRecord + "_contentMetadata_" + content.getId());
    assertThat(cmisContent.isLatestMajorVersion()).isTrue();
    assertThat(cmisContent.isLatestVersion()).isTrue();
    assertThat(cmisContent.isMajorVersion()).isTrue();
    //		assertThat(cmisContent.isPrivateWorkingCopy()).isFalse();
    assertThat(cmisContent.isVersionSeriesCheckedOut()).isFalse();
    assertThat(cmisContent.getPropertyValue("metadata")).isEqualTo("contentMetadata");
  }
 private Document _2_firstDocumentModification() throws IOException {
   Document cmisContent = getContentsOf(zeRecord).get(0);
   cmisContent.setContentStream(docx1ContentStream(), true);
   recordServices.refresh(recordServices.getDocumentById(zeRecord));
   cmisContent = getContentsOf(zeRecord).get(0);
   assertThatContentStreamIsSameAs(cmisContent, docx1ContentStream(), docx1Hash);
   assertThatVersionCreationInfoAre(cmisContent, bobId, firstDocumentModificationOClock);
   assertThat(cmisContent.getId())
       .isEqualTo("content_" + zeRecord + "_contentMetadata_" + zeRecordContentId + "_1.1");
   assertThat(cmisContent.getProperty(PropertyIds.PARENT_ID).getValue()).isEqualTo(zeRecord);
   assertThat(cmisContent.getVersionLabel()).isEqualTo("1.1");
   assertThat(cmisContent.getVersionSeriesCheckedOutBy()).isNull();
   assertThat(cmisContent.getVersionSeriesCheckedOutId()).isNull();
   assertThat(cmisContent.getVersionSeriesId())
       .isEqualTo("content_" + zeRecord + "_contentMetadata_" + zeRecordContentId);
   assertThat(cmisContent.isLatestMajorVersion()).isFalse();
   assertThat(cmisContent.isLatestVersion()).isTrue();
   assertThat(cmisContent.isMajorVersion()).isFalse();
   //		assertThat(cmisContent.isPrivateWorkingCopy()).isFalse();
   assertThat(cmisContent.isVersionSeriesCheckedOut()).isFalse();
   assertThat(cmisContent.getPropertyValue("metadata")).isEqualTo("contentMetadata");
   return cmisContent;
 }
Пример #3
0
 void open(HttpServletRequest request, HttpServletResponse response, int serviceCall) {
   RecordServices recordServices =
       getConstellioFactories().getModelLayerFactory().newRecordServices();
   String idWithTooMuchZeros = "0000000000" + serviceCall % 1000000;
   recordServices.getDocumentById(idWithTooMuchZeros.substring(idWithTooMuchZeros.length() - 11));
 }