TypeCache typeCache = new TypeCacheImpl(repositoryId, service);
ObjectData sourceDoc = getSimpleObject(service, repositoryId, sourceId);
PropertyData<?> sourceTypeId = sourceDoc.getProperties().getProperties().get(PropertyIds.OBJECT_TYPE_ID);
if (sourceTypeId == null || sourceTypeId.getFirstValue() == null) {
throw new CmisRuntimeException("Source object has no type!?!");
}
String newObjectId = service.createDocumentFromSource(repositoryId, sourceId,
createProperties(cp, sourceTypeId.getFirstValue().toString(), typeCache), folderId, versioningState,
createPolicies(cp), createAddAcl(cp), createRemoveAcl(cp), null);
ObjectData object = getSimpleObject(service, repositoryId, newObjectId);
if (object == null) {
throw new CmisRuntimeException("New document is null!");
}
// return object
JSONObject jsonObject = JSONConverter.convert(object, typeCache, false);