private void addChildObject(StoredObject so) {
try {
fObjStore.lock();
String name = so.getName();
if (!NameValidator.isValidId(name)) {
throw new CmisInvalidArgumentException(NameValidator.ERROR_ILLEGAL_NAME);
}
boolean hasChild;
hasChild = hasChild(name);
if (hasChild) {
throw new CmisNameConstraintViolationException(
"Cannot create object: " + name + ". Name already exists in parent folder");
}
if (so instanceof SingleFiling) {
((SingleFiling) so).setParent(this);
} else if (so instanceof MultiFiling) {
((MultiFiling) so).addParent(this);
} else {
throw new CmisInvalidArgumentException("Cannot create document, object is not fileable.");
}
} finally {
fObjStore.unlock();
}