Package org.apache.chemistry.opencmis.client.api

Examples of org.apache.chemistry.opencmis.client.api.Document


                                results,
                                createResult(FAILURE,
                                        "Document object has CAN_CHECK_OUT and CAN_CANCEL_CHECK_OUT allowable actions!"));
                    }

                    Document doc = (Document) object;
                    DocumentTypeDefinition docType = (DocumentTypeDefinition) doc.getType();
                    if (doc.isVersionSeriesCheckedOut() != null) {
                        if (doc.isVersionSeriesCheckedOut()) {
                            f = createResult(WARNING, "Document is checked out and has CAN_CHECK_OUT allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_OUT, null, f));

                            if (doc.getVersionSeriesCheckedOutId() == null) {
                                addResult(
                                        results,
                                        createResult(WARNING,
                                                "Document is checked out and but the property cmis:versionSeriesCheckedOutId is not set!"));
                            } else {
                                if (doc.getVersionSeriesCheckedOutId().equals(object.getId())) {
                                    // object is PWC
                                    f = createResult(FAILURE, "PWC doesn't have CAN_CHECK_IN allowable action!");
                                    addResult(results, assertAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                                    f = createResult(FAILURE, "PWC doesn't have CAN_CANCEL_CHECK_OUT allowable action!");
                                    addResult(results,
                                            assertAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));
                                } else {
                                    // object is not PWC
                                    f = createResult(WARNING, "Non-PWC has CAN_CHECK_IN allowable action!");
                                    addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                                    f = createResult(WARNING, "Non-PWC has CAN_CANCEL_CHECK_OUT allowable action!");
                                    addResult(results,
                                            assertNotAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));
                                }
                            }
                        } else {
                            f = createResult(FAILURE,
                                    "Document is not checked out and has CAN_CHECK_IN allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_IN, null, f));

                            f = createResult(FAILURE,
                                    "Document is not checked out and has CAN_CANCEL_CHECK_OUT allowable action!");
                            addResult(results, assertNotAllowableAction(object, Action.CAN_CANCEL_CHECK_OUT, null, f));

                            // versionable check
                            if (docType.isVersionable()) {
                                if (Boolean.TRUE.equals(doc.isLatestVersion())) {
                                    f = createResult(WARNING,
                                            "Document is versionable and not checked but has no CAN_CHECK_OUT allowable action!");
                                    addResult(results, assertAllowableAction(object, Action.CAN_CHECK_OUT, null, f));
                                }
                            } else {
                                f = createResult(FAILURE,
                                        "Document is not versionable but has CAN_CHECK_OUT allowable action!");
                                addResult(results, assertNotAllowableAction(object, Action.CAN_CHECK_OUT, null, f));
                            }
                        }
                    } else {
                        addResult(results, createResult(WARNING, "Property cmis:isVersionSeriesCheckedOut is not set!"));
                    }

                    // immutable check
                    if (Boolean.TRUE.equals(doc.isImmutable())) {
                        f = createResult(FAILURE,
                                "Document is immutable and has CAN_UPDATE_PROPERTIES allowable action!");
                        addResult(results, assertNotAllowableAction(object, Action.CAN_UPDATE_PROPERTIES, null, f));

                        f = createResult(FAILURE, "Document is immutable and has CAN_DELETE_OBJECT allowable action!");
View Full Code Here


            return;
        }

        CmisTestResult f;

        Document doc = (Document) object;
        DocumentTypeDefinition type = (DocumentTypeDefinition) doc.getType();

        // check ContentStreamAllowed flag
        boolean hasContentProperties = (doc.getContentStreamFileName() != null) || (doc.getContentStreamId() != null)
                || (doc.getContentStreamLength() > -1) || (doc.getContentStreamMimeType() != null);

        if (hasContentProperties) {
            if (type.getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED) {
                addResult(
                        results,
                        createResult(FAILURE,
                                "Content properties have values but the document type doesn't allow content!"));
            }
        } else {
            if (type.getContentStreamAllowed() == ContentStreamAllowed.REQUIRED) {
                addResult(results,
                        createResult(FAILURE, "Content properties are not set but the document type demands content!"));
            }
        }

        // get the content stream
        ContentStream contentStream = doc.getContentStream();

        if (contentStream == null) {
            if (hasContentProperties && doc.getContentStreamLength() > 0) {
                addResult(results,
                        createResult(FAILURE, "Content properties have values but the document has no content!"));
            }

            if (type.getContentStreamAllowed() == ContentStreamAllowed.REQUIRED) {
                addResult(results,
                        createResult(FAILURE, "The document type demands content but the document has no content!"));
            }

            return;
        }

        if (type.getContentStreamAllowed() == ContentStreamAllowed.NOTALLOWED) {
            addResult(results, createResult(FAILURE, "Document type doesn't allow content but document has content!"));
        }

        // file name check
        f = createResult(FAILURE, "Content file names don't match!");
        addResult(results, assertEquals(doc.getContentStreamFileName(), contentStream.getFileName(), null, f));

        if (doc.getContentStreamLength() > -1 && contentStream.getLength() > -1) {
            f = createResult(FAILURE, "Content lengths don't match!");
            addResult(results, assertEquals(doc.getContentStreamLength(), contentStream.getLength(), null, f));
        }

        // MIME type check
        String docMimeType = doc.getContentStreamMimeType();
        if (docMimeType != null) {
            int x = docMimeType.indexOf(';');
            if (x > -1) {
                docMimeType = docMimeType.substring(0, x);
            }
            docMimeType = docMimeType.trim();
        }

        String contentMimeType = contentStream.getMimeType();
        if (contentMimeType != null) {
            int x = contentMimeType.indexOf(';');
            if (x > -1) {
                contentMimeType = contentMimeType.substring(0, x);
            }
            contentMimeType = contentMimeType.trim();
        }

        f = createResult(FAILURE, "Content MIME types don't match!");
        addResult(results, assertEquals(docMimeType, contentMimeType, null, f));

        if (contentStream.getMimeType() != null) {
            if (contentMimeType.equals(docMimeType)) {
                f = createResult(WARNING, "Content MIME types don't match!");
                addResult(results, assertEquals(doc.getContentStreamMimeType(), contentStream.getMimeType(), null, f));
            }

            f = createResult(FAILURE, "Content MIME types is invalid: " + contentStream.getMimeType());
            addResult(
                    results,
                    assertIsTrue(contentStream.getMimeType().length() > 2
                            && contentStream.getMimeType().indexOf('/') > 0, null, f));
        }

        // check stream
        InputStream stream = contentStream.getStream();
        if (stream == null) {
            addResult(results, createResult(FAILURE, "Docuemnt has no content stream!"));
            return;
        }

        try {
            long bytes = 0;
            byte[] buffer = new byte[64 * 1024];
            int b = stream.read(buffer);
            while (b > -1) {
                bytes += b;
                b = stream.read(buffer);
            }
            stream.close();

            // check content length
            if (doc.getContentStreamLength() > -1) {
                f = createResult(FAILURE,
                        "Content stream length property value doesn't match the actual content length!");
                addResult(results, assertEquals(doc.getContentStreamLength(), bytes, null, f));
            }

            if (contentStream.getLength() > -1) {
                f = createResult(FAILURE, "Content length value doesn't match the actual content length!");
                addResult(results, assertEquals(contentStream.getLength(), bytes, null, f));
View Full Code Here

        if (!Boolean.TRUE.equals(((DocumentTypeDefinition) object.getType()).isVersionable())) {
            // skip non-versionable types
            return null;
        }

        Document doc = (Document) object;

        // check version series id
        String versionSeriesId = doc.getVersionSeriesId();

        f = createResult(FAILURE, "Versionable document has no version series id property!");
        addResult(results, assertStringNotEmpty(versionSeriesId, null, f));
        if (versionSeriesId == null) {
            CmisTestResultImpl result = createResult(getWorst(results), message);
            result.getChildren().addAll(results);
            return result;
        }

        // get version history
        List<Document> versions = doc.getAllVersions(SELECT_ALL_NO_CACHE_OC);

        f = createResult(FAILURE, "Version history is null!");
        addResult(results, assertNotNull(versions, null, f));
        if (versions == null) {
            CmisTestResultImpl result = createResult(getWorst(results), message);
            result.getChildren().addAll(results);
            return result;
        }

        f = createResult(FAILURE, "Version history must have at least one version!");
        addResult(results, assertIsTrue(versions.size() > 0, null, f));

        if (versions.size() > 0) {
            // get latest version
            Document lastestVersion = doc.getObjectOfLatestVersion(false, SELECT_ALL_NO_CACHE_OC);
            addResult(results,
                    checkObject(session, lastestVersion, properties, "Latest version check: " + lastestVersion.getId()));

            f = createResult(FAILURE, "Latest version is not flagged as latest version! Id: " + lastestVersion.getId());
            addResult(results, assertIsTrue(lastestVersion.isLatestVersion(), null, f));

            // get latest major version
            Document lastestMajorVersion = null;
            try {
                lastestMajorVersion = doc.getObjectOfLatestVersion(true, SELECT_ALL_NO_CACHE_OC);

                f = createResult(FAILURE, "getObjectOfLatestVersion returned an invalid object!");
                addResult(results, assertNotNull(lastestMajorVersion, null, f));
            } catch (CmisObjectNotFoundException e) {
                // no latest major version
            }
            if (lastestMajorVersion != null) {
                addResult(
                        results,
                        checkObject(session, lastestMajorVersion, properties, "Latest major version check: "
                                + lastestMajorVersion.getId()));

                f = createResult(FAILURE, "Latest major version is not flagged as latest major version! Id: "
                        + lastestMajorVersion.getId());
                addResult(results, assertIsTrue(lastestMajorVersion.isLatestMajorVersion(), null, f));
            }

            // iterate through the version history and test each version
            // document
            long creatationDate = Long.MAX_VALUE;
            int latestVersion = 0;
            int latestMajorVersion = 0;
            long latestModificationDate = Long.MAX_VALUE;
            int latestModifictaionIndex = Integer.MIN_VALUE;
            Set<String> versionLabels = new HashSet<String>();
            boolean found = false;
            boolean foundLastestVersion = false;
            boolean foundLastestMajorVersion = false;
            for (int i = 0; i < versions.size(); i++) {
                Document version = versions.get(i);

                f = createResult(FAILURE, "Version " + i + " is null!");
                addResult(results, assertNotNull(version, null, f));
                if (version == null) {
                    continue;
                }

                addResult(results, checkObject(session, version, properties, "Version check: " + version.getId()));

                // check first entry
                if (i == 0) {
                    if (version.isVersionSeriesCheckedOut()) {
                        f = createResult(
                                WARNING,
                                "Version series is checked-out and the PWC is not the latest version! Id: "
                                        + version.getId()
                                        + " (Note: The words of the CMIS specification define that the PWC is the latest version."
                                        + " But that is not the intention of the spec and will be changed in CMIS 1.1."
                                        + " Thus this a warning, not an error.)");
                        addResult(results, assertIsTrue(version.isLatestVersion(), null, f));
                    } else {
                        f = createResult(FAILURE,
                                "Version series is not checked-out and first version history entry is not the latest version! Id: "
                                        + version.getId());
                        addResult(results, assertIsTrue(version.isLatestVersion(), null, f));
                    }
                }

                // check version id
                f = createResult(FAILURE, "Version series id does not match! Id: " + version.getId());
                addResult(results, assertEquals(versionSeriesId, version.getVersionSeriesId(), null, f));

                // check creation date
                if (creatationDate == version.getCreationDate().getTimeInMillis()) {
                    addResult(results, createResult(WARNING, "Two or more versions have the same creation date!"));
                } else {
                    f = createResult(FAILURE, "Version history order incorrect! Must be sorted bei creation date!");
                    addResult(results,
                            assertIsTrue(version.getCreationDate().getTimeInMillis() <= creatationDate, null, f));
                }
                version.getCreationDate().getTimeInMillis();

                // count latest versions and latest major versions
                if (version.isLatestVersion()) {
                    latestVersion++;
                }

                if (version.isLatestMajorVersion()) {
                    latestMajorVersion++;
                }

                // find latest modification date
                if (latestModificationDate == version.getLastModificationDate().getTimeInMillis()) {
                    addResult(results,
                            createResult(WARNING, "Two or more versions have the same last modification date!"));
                } else if (latestModificationDate < version.getLastModificationDate().getTimeInMillis()) {
                    latestModificationDate = version.getLastModificationDate().getTimeInMillis();
                    latestModifictaionIndex = i;
                }

                // check for version label duplicates
                String versionLabel = version.getVersionLabel();
                f = createResult(WARNING, "More than one version have this version label: " + versionLabel);
                addResult(results, assertIsFalse(versionLabels.contains(versionLabel), null, f));

                versionLabels.add(versionLabel);

                // check PWC
                if (version.getId().equals(version.getVersionSeriesCheckedOutId())) {
                    f = createResult(FAILURE, "PWC must not be flagged as latest major version! Id: " + version.getId());
                    addResult(results, assertIsFalse(version.isLatestMajorVersion(), null, f));
                }

                // check checked out
                if (Boolean.TRUE.equals(doc.isVersionSeriesCheckedOut())) {
                    f = createResult(WARNING,
                            "Version series is marked as checked out but cmis:versionSeriesCheckedOutId is not set! Id: "
                                    + version.getId());
                    addResult(results, assertStringNotEmpty(doc.getVersionSeriesCheckedOutId(), null, f));

                    f = createResult(WARNING,
                            "Version series is marked as checked out but cmis:versionSeriesCheckedOutBy is not set! Id: "
                                    + version.getId());
                    addResult(results, assertStringNotEmpty(doc.getVersionSeriesCheckedOutBy(), null, f));
                } else if (Boolean.FALSE.equals(doc.isVersionSeriesCheckedOut())) {
                    f = createResult(FAILURE,
                            "Version series is not marked as checked out but cmis:versionSeriesCheckedOutId is set! Id: "
                                    + version.getId());
                    addResult(results, assertNull(doc.getVersionSeriesCheckedOutId(), null, f));

                    f = createResult(FAILURE,
                            "Version series is not marked as checked out but cmis:versionSeriesCheckedOutIdBy is set! Id: "
                                    + version.getId());
                    addResult(results, assertNull(doc.getVersionSeriesCheckedOutBy(), null, f));
                }

                // found origin object?
                if (version.getId().equals(object.getId())) {
                    found = true;
                }

                // found latest version?
                if (version.getId().equals(lastestVersion.getId())) {
                    foundLastestVersion = true;
                }

                // found latest major version?
                if (lastestMajorVersion != null && version.getId().equals(lastestMajorVersion.getId())) {
                    foundLastestMajorVersion = true;
                }
            }

            // check latest versions
View Full Code Here

      } else if(baseTypeId.equals(CMIS_DOCUMENT_BASE_TYPE)){

        // content ingestion

        Document document = (Document) cmisObject;
        long fileLength = document.getContentStreamLength();

        InputStream is = document.getContentStream().getStream();

        try {
          RepositoryDocument rd = new RepositoryDocument();
         
          //binary
          rd.setBinary(is, fileLength);

          //properties
          List<Property<?>> properties = document.getProperties();
          String id = StringUtils.EMPTY;
          for (Property<?> property : properties) {
            String propertyId = property.getId();
            Object propertyValue = property.getValue();
            if (propertyId.endsWith(Constants.PARAM_OBJECT_ID))
              id = (String) propertyValue;

            if (propertyValue != null) {
              PropertyType propertyType = property.getType();

              switch (propertyType) {

              case STRING:
              case ID:
              case URI:
              case HTML:
                String stringValue = (String) propertyValue;
                rd.addField(propertyId, stringValue);
                break;

              case BOOLEAN:
                Boolean booleanValue = (Boolean) propertyValue;
                rd.addField(propertyId, booleanValue.toString());
                break;

              case INTEGER:
                BigInteger integerValue = (BigInteger) propertyValue;
                rd.addField(propertyId, integerValue.toString());
                break;

              case DECIMAL:
                BigDecimal decimalValue = (BigDecimal) propertyValue;
                rd.addField(propertyId, decimalValue.toString());
                break;

              case DATETIME:
                GregorianCalendar dateValue = (GregorianCalendar) propertyValue;
                rd.addField(propertyId,
                    ISO8601_DATE_FORMATTER.format(dateValue.getTime()));
                break;

              default:
                break;
              }
            }
          }
         
          //ingestion
          String version = document.getVersionLabel();
          String documentURI = endpoint+"/"+id+"/"+version;
          activities.ingestDocument(id, version, documentURI, rd);

        } finally {
          try {
View Full Code Here

    String[] rval = new String[documentIdentifiers.length];
    int i = 0;
    while (i < rval.length){
      CmisObject cmisObject = session.getObject(documentIdentifiers[i]);
      if (cmisObject.getBaseType().getId().equals(CMIS_DOCUMENT_BASE_TYPE)) {
        Document document = (Document) cmisObject;
       
        //we have to check if this CMIS repository support versioning
        // or if the versioning is disabled for this content
        if(StringUtils.isNotEmpty(document.getVersionLabel())){
          rval[i] = document.getVersionLabel();
        } else {
        //a CMIS document that doesn't contain versioning information will always be processed
          rval[i] = StringUtils.EMPTY;
        }
      } else {
View Full Code Here

      } else if(baseTypeId.equals(CMIS_DOCUMENT_BASE_TYPE)){

        // content ingestion

        Document document = (Document) cmisObject;
        long fileLength = document.getContentStreamLength();
        InputStream is = null;
       
        try {
          RepositoryDocument rd = new RepositoryDocument();
         
          //binary
          if(fileLength>0 && document.getContentStream()!=null){
            is = document.getContentStream().getStream();
            rd.setBinary(is, fileLength);
          }

          //properties
          List<Property<?>> properties = document.getProperties();
          String id = StringUtils.EMPTY;
          for (Property<?> property : properties) {
            String propertyId = property.getId();
            if (propertyId.endsWith(Constants.PARAM_OBJECT_ID))
              id = (String) property.getValue();

            if (property.getValue() !=null
                || property.getValues() != null) {
              PropertyType propertyType = property.getType();

              switch (propertyType) {

              case STRING:
              case ID:
              case URI:
              case HTML:
                if(property.isMultiValued()){
                  List<String> htmlPropertyValues = (List<String>) property.getValues();
                  for (String htmlPropertyValue : htmlPropertyValues) {
                    rd.addField(propertyId, htmlPropertyValue);
                  }
                } else {
                  String stringValue = (String) property.getValue();
                  if(StringUtils.isNotEmpty(stringValue)){
                    rd.addField(propertyId, stringValue);
                  }
                }
                break;
    
              case BOOLEAN:
                if(property.isMultiValued()){
                  List<Boolean> booleanPropertyValues = (List<Boolean>) property.getValues();
                  for (Boolean booleanPropertyValue : booleanPropertyValues) {
                    rd.addField(propertyId, booleanPropertyValue.toString());
                  }
                } else {
                  Boolean booleanValue = (Boolean) property.getValue();
                  if(booleanValue!=null){
                    rd.addField(propertyId, booleanValue.toString());
                  }
                }
                break;

              case INTEGER:
                if(property.isMultiValued()){
                  List<BigInteger> integerPropertyValues = (List<BigInteger>) property.getValues();
                  for (BigInteger integerPropertyValue : integerPropertyValues) {
                    rd.addField(propertyId, integerPropertyValue.toString());
                  }
                } else {
                  BigInteger integerValue = (BigInteger) property.getValue();
                  if(integerValue!=null){
                    rd.addField(propertyId, integerValue.toString());
                  }
                }
                break;

              case DECIMAL:
                if(property.isMultiValued()){
                  List<BigDecimal> decimalPropertyValues = (List<BigDecimal>) property.getValues();
                  for (BigDecimal decimalPropertyValue : decimalPropertyValues) {
                    rd.addField(propertyId, decimalPropertyValue.toString());
                  }
                } else {
                  BigDecimal decimalValue = (BigDecimal) property.getValue();
                  if(decimalValue!=null){
                    rd.addField(propertyId, decimalValue.toString());
                  }
                }
                break;

              case DATETIME:
                if(property.isMultiValued()){
                  List<GregorianCalendar> datePropertyValues = (List<GregorianCalendar>) property.getValues();
                  for (GregorianCalendar datePropertyValue : datePropertyValues) {
                    rd.addField(propertyId,
                        ISO8601_DATE_FORMATTER.format(datePropertyValue.getTime()));
                  }
                } else {
                  GregorianCalendar dateValue = (GregorianCalendar) property.getValue();
                  if(dateValue!=null){
                    rd.addField(propertyId, ISO8601_DATE_FORMATTER.format(dateValue.getTime()));
                  }
                }
                break;

              default:
                break;
              }
            }
          }
         
          //ingestion
         
          //version label
          String version = document.getVersionLabel();
          if(StringUtils.isEmpty(version))
            version = StringUtils.EMPTY;
         
          //documentURI
          String documentURI = CmisRepositoryConnectorUtils.getDocumentURL(document, session);
View Full Code Here

    String[] rval = new String[documentIdentifiers.length];
    int i = 0;
    while (i < rval.length){
      CmisObject cmisObject = session.getObject(documentIdentifiers[i]);
      if (cmisObject.getBaseType().getId().equals(CMIS_DOCUMENT_BASE_TYPE)) {
        Document document = (Document) cmisObject;
       
        //we have to check if this CMIS repository support versioning
        // or if the versioning is disabled for this content
        if(StringUtils.isNotEmpty(document.getVersionLabel())){
          rval[i] = document.getVersionLabel();
        } else {
        //a CMIS document that doesn't contain versioning information will always be processed
          rval[i] = StringUtils.EMPTY;
        }
      } else {
View Full Code Here

    }

    byte[] newContentByteArray = newContent.getBytes();
    InputStream stream = new ByteArrayInputStream(newContentByteArray);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(newContentByteArray), "text/plain", stream);
    Document documentToUpdate = (Document) session.getObject(objectId);
    documentToUpdate.setContentStream(contentStream, true);
  }
View Full Code Here

    }
   
    byte[] newContentByteArray = newContent.getBytes();
    InputStream stream = new ByteArrayInputStream(newContentByteArray);
    ContentStream contentStream = new ContentStreamImpl(name, new BigInteger(newContentByteArray), "text/plain", stream);
    Document documentToUpdate = (Document) session.getObject(objectId);
    documentToUpdate.setContentStream(contentStream, true);
  }
View Full Code Here

      } else if(baseTypeId.equals(CMIS_DOCUMENT_BASE_TYPE)){

        // content ingestion

        Document document = (Document) cmisObject;
        long fileLength = document.getContentStreamLength();
        InputStream is = null;
       
        try {
          RepositoryDocument rd = new RepositoryDocument();
          Date createdDate = document.getCreationDate().getTime();
          Date modifiedDate = document.getLastModificationDate().getTime();
         
          rd.setFileName(document.getContentStreamFileName());
          rd.setMimeType(document.getContentStreamMimeType());
          rd.setCreatedDate(createdDate);
          rd.setModifiedDate(modifiedDate);
         
          //binary
          if(fileLength>0 && document.getContentStream()!=null){
            is = document.getContentStream().getStream();
            rd.setBinary(is, fileLength);
          }

          //properties
          List<Property<?>> properties = document.getProperties();
          String id = StringUtils.EMPTY;
          for (Property<?> property : properties) {
            String propertyId = property.getId();
            if (propertyId.endsWith(Constants.PARAM_OBJECT_ID))
              id = (String) property.getValue();

            if (property.getValue() !=null
                || property.getValues() != null) {
              PropertyType propertyType = property.getType();

              switch (propertyType) {

              case STRING:
              case ID:
              case URI:
              case HTML:
                if(property.isMultiValued()){
                  List<String> htmlPropertyValues = (List<String>) property.getValues();
                  for (String htmlPropertyValue : htmlPropertyValues) {
                    rd.addField(propertyId, htmlPropertyValue);
                  }
                } else {
                  String stringValue = (String) property.getValue();
                  if(StringUtils.isNotEmpty(stringValue)){
                    rd.addField(propertyId, stringValue);
                  }
                }
                break;
    
              case BOOLEAN:
                if(property.isMultiValued()){
                  List<Boolean> booleanPropertyValues = (List<Boolean>) property.getValues();
                  for (Boolean booleanPropertyValue : booleanPropertyValues) {
                    rd.addField(propertyId, booleanPropertyValue.toString());
                  }
                } else {
                  Boolean booleanValue = (Boolean) property.getValue();
                  if(booleanValue!=null){
                    rd.addField(propertyId, booleanValue.toString());
                  }
                }
                break;

              case INTEGER:
                if(property.isMultiValued()){
                  List<BigInteger> integerPropertyValues = (List<BigInteger>) property.getValues();
                  for (BigInteger integerPropertyValue : integerPropertyValues) {
                    rd.addField(propertyId, integerPropertyValue.toString());
                  }
                } else {
                  BigInteger integerValue = (BigInteger) property.getValue();
                  if(integerValue!=null){
                    rd.addField(propertyId, integerValue.toString());
                  }
                }
                break;

              case DECIMAL:
                if(property.isMultiValued()){
                  List<BigDecimal> decimalPropertyValues = (List<BigDecimal>) property.getValues();
                  for (BigDecimal decimalPropertyValue : decimalPropertyValues) {
                    rd.addField(propertyId, decimalPropertyValue.toString());
                  }
                } else {
                  BigDecimal decimalValue = (BigDecimal) property.getValue();
                  if(decimalValue!=null){
                    rd.addField(propertyId, decimalValue.toString());
                  }
                }
                break;

              case DATETIME:
                if(property.isMultiValued()){
                  List<GregorianCalendar> datePropertyValues = (List<GregorianCalendar>) property.getValues();
                  for (GregorianCalendar datePropertyValue : datePropertyValues) {
                    rd.addField(propertyId,
                        ISO8601_DATE_FORMATTER.format(datePropertyValue.getTime()));
                  }
                } else {
                  GregorianCalendar dateValue = (GregorianCalendar) property.getValue();
                  if(dateValue!=null){
                    rd.addField(propertyId, ISO8601_DATE_FORMATTER.format(dateValue.getTime()));
                  }
                }
                break;

              default:
                break;
              }
            }
          }
         
          //ingestion
         
          //version label
          String version = document.getVersionLabel();
          if(StringUtils.isEmpty(version))
            version = StringUtils.EMPTY;
         
          //documentURI
          String documentURI = CmisRepositoryConnectorUtils.getDocumentURL(document, session);
View Full Code Here

TOP

Related Classes of org.apache.chemistry.opencmis.client.api.Document

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.