use of com.agiletec.apsadmin.system.entity.attribute.manager.AttributeManagerInterface in project entando-core by entando.
the class EntityActionHelper method scanEntity.
@Override
public void scanEntity(IApsEntity currentEntity, ActionSupport action) {
try {
List<AttributeInterface> attributes = currentEntity.getAttributeList();
for (int i = 0; i < attributes.size(); i++) {
AttributeInterface entityAttribute = attributes.get(i);
if (entityAttribute.isActive()) {
List<AttributeFieldError> errors = entityAttribute.validate(new AttributeTracer());
if (null != errors && errors.size() > 0) {
for (int j = 0; j < errors.size(); j++) {
AttributeFieldError attributeFieldError = errors.get(j);
AttributeTracer tracer = attributeFieldError.getTracer();
AttributeInterface attribute = attributeFieldError.getAttribute();
String messageAttributePositionPrefix = this.createErrorMessageAttributePositionPrefix(action, attribute, tracer);
AttributeManagerInterface attributeManager = this.getManager(attribute);
String errorMessage = attributeManager.getErrorMessage(attributeFieldError, action);
String formFieldName = tracer.getFormFieldName(attributeFieldError.getAttribute());
action.addFieldError(formFieldName, messageAttributePositionPrefix + " " + errorMessage);
}
}
}
}
} catch (Throwable t) {
_logger.error("Error scanning Entity", t);
throw new RuntimeException("Error scanning Entity", t);
}
}
Aggregations