String typeId = pd == null ? null : pd.getFirstValue();
if (null == typeId)
throw new RuntimeException(
"Cannot create object, without a type (no property with id CMIS_OBJECT_TYPE_ID).");
TypeDefinitionContainer typeDefC = fStoreManager.getTypeById(repositoryId, typeId);
if (typeDefC == null)
throw new RuntimeException("Cannot create object, a type with id " + typeId + " is unknown");
// check if the given type is a document type
BaseTypeId typeBaseId = typeDefC.getTypeDefinition().getBaseTypeId();
StoredObject so = null;
String user = context.getUsername();
if (typeBaseId.equals(InMemoryDocumentTypeDefinition.getRootDocumentType().getBaseTypeId())) {
so = createDocumentIntern(repositoryId, properties, folderId, contentStream, versioningState, null, null,
null, null, user);
} else if (typeBaseId.equals(InMemoryFolderTypeDefinition.getRootFolderType().getBaseTypeId())) {
so = createFolderIntern(repositoryId, properties, folderId, null, null, null, null, user);
} else if (typeBaseId.equals(InMemoryPolicyTypeDefinition.getRootPolicyType().getBaseTypeId())) {
so = createPolicyIntern(repositoryId, properties, folderId, null, null, null, null);
} else if (typeBaseId.equals(InMemoryRelationshipTypeDefinition.getRootRelationshipType().getBaseTypeId())) {
so = createRelationshipIntern(repositoryId, properties, null, null, null, null);
} else
LOG.error("The type contains an unknown base object id, object can't be created");
// Make a call to getObject to convert the resulting id into an
// ObjectData
TypeDefinition td = typeDefC.getTypeDefinition();
ObjectData od = PropertyCreationHelper.getObjectData(td, so, null, user, false,
IncludeRelationships.NONE, null, false, false, extension);
if (context.isObjectInfoRequired()) {
ObjectInfoImpl objectInfo = new ObjectInfoImpl();