use of org.alfresco.service.cmr.dictionary.CustomModelException.ModelExistsException in project alfresco-remote-api by Alfresco.
the class CustomModelsImpl method createCustomModelImpl.
private CustomModel createCustomModelImpl(CustomModel model, boolean basicModelOnly) {
M2Model m2Model = null;
if (basicModelOnly) {
m2Model = convertToM2Model(model, null, null, null);
} else {
m2Model = convertToM2Model(model, model.getTypes(), model.getAspects(), model.getConstraints());
}
boolean activate = ModelStatus.ACTIVE.equals(model.getStatus());
try {
CustomModelDefinition modelDefinition = customModelService.createCustomModel(m2Model, activate);
return new CustomModel(modelDefinition);
} catch (ModelExistsException me) {
throw new ConstraintViolatedException(me.getMessage());
} catch (CustomModelConstraintException ncx) {
throw new ConstraintViolatedException(ncx.getMessage());
} catch (InvalidCustomModelException iex) {
throw new InvalidArgumentException(iex.getMessage());
} catch (Exception e) {
throw new ApiException("cmm.rest_api.model_invalid", e);
}
}
Aggregations