use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class AbstractListViewerWidgetValidator method validate.
@Override
public BeanPropertyBindingResult validate(WidgetConfigurationRequest widget, IPage page) {
BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(widget, widget.getClass().getSimpleName());
try {
logger.debug("validating widget {} for page {}", widget.getCode(), page.getCode());
WidgetValidatorCmsHelper.validateTitle(widget, getLangManager(), bindingResult);
WidgetValidatorCmsHelper.validateLink(widget, getLangManager(), getPageManager(), bindingResult);
} catch (Throwable e) {
logger.error("error in validate wiget {} in page {}", widget.getCode(), page.getCode());
throw new RestServerError("error in widget config validation", e);
}
return bindingResult;
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class DataObjectModelService method addDataObjectModel.
@Override
public DataModelDto addDataObjectModel(DataObjectModelRequest dataObjectModelRequest) {
try {
DataObjectModel dataModel = this.createDataObjectModel(dataObjectModelRequest);
this.getDataObjectModelManager().addDataObjectModel(dataModel);
return this.getDtoBuilder().convert(dataModel);
} catch (ApsSystemException e) {
logger.error("Error adding DataObjectModel", e);
throw new RestServerError("error add DataObjectModel", e);
}
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class AbstractEntityService method deleteEntityType.
protected void deleteEntityType(String entityManagerCode, String entityTypeCode) {
IEntityManager entityManager = this.extractEntityManager(entityManagerCode);
try {
IApsEntity entityType = entityManager.getEntityPrototype(entityTypeCode);
if (null == entityType) {
return;
}
List<String> ids = entityManager.searchId(entityTypeCode, null);
if (null != ids && ids.size() > 0) {
BeanPropertyBindingResult bindingResult = new BeanPropertyBindingResult(entityType, "entityType");
bindingResult.reject(EntityTypeValidator.ERRCODE_ENTITY_TYPE_REFERENCES, new Object[] { entityTypeCode }, "entityType.cannot.delete.references");
throw new ValidationConflictException(bindingResult);
}
((IEntityTypesConfigurer) entityManager).removeEntityPrototype(entityTypeCode);
} catch (ApsSystemException e) {
logger.error("Error in delete entityType {}", entityTypeCode, e);
throw new RestServerError("error in delete entityType", e);
}
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class AbstractEntityService method filterObjects.
protected boolean filterObjects(Object bean, Filter[] filters, Map<String, String> mapping) {
try {
if (null == filters) {
return true;
}
Map<String, Object> properties = BeanUtils.describe(bean);
for (Filter filter : filters) {
String fieldName = this.getFieldName(filter.getAttribute(), mapping);
String value = (null != properties.get(fieldName)) ? properties.get(fieldName).toString() : null;
if (null == value) {
continue;
}
if (!value.toLowerCase().contains(filter.getValue().toLowerCase())) {
return false;
}
}
} catch (IllegalAccessException | InvocationTargetException | NoSuchMethodException e) {
logger.error("error filtering bean " + bean.getClass().getName(), e);
throw new RestServerError("error filtering bean " + bean.getClass().getName(), e);
}
return true;
}
use of org.entando.entando.aps.system.exception.RestServerError in project entando-core by entando.
the class GroupService method updateGroup.
@Override
public GroupDto updateGroup(String groupCode, String descr) {
Group group = this.getGroupManager().getGroup(groupCode);
if (null == group) {
throw new RestRourceNotFoundException(GroupValidator.ERRCODE_GROUP_NOT_FOUND, "group", groupCode);
}
group.setDescription(descr);
try {
this.getGroupManager().updateGroup(group);
return this.getDtoBuilder().convert(group);
} catch (ApsSystemException e) {
logger.error("Error updating group {}", groupCode, e);
throw new RestServerError("error in update group", e);
}
}
Aggregations