contentStream = cs;
}
// Now we are sure to have document type definition:
if (((DocumentTypeDefinition) typeDef).isVersionable()) {
VersionedDocument verDoc = fStoreManager.getObjectStore(repositoryId).createVersionedDocument(name);
verDoc.createSystemBasePropertiesWhenCreated(properties.getProperties(), user);
verDoc.setCustomProperties(properties.getProperties());
DocumentVersion version = verDoc.addVersion(contentStream, versioningState, user);
if (null != folder) {
folder.addChildDocument(verDoc); // add document to folder and
}
version.createSystemBasePropertiesWhenCreated(propMap, user);
version.setCustomProperties(propMap);
version.persist();
verDoc.persist();
so = version; // return the version and not the version series to
// caller
} else {
Document doc = fStoreManager.getObjectStore(repositoryId).createDocument(name);
doc.setContent(contentStream, false);