} 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();
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();
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();
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();
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();
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);