use of com.agiletec.aps.system.common.entity.IEntityManager in project entando-core by entando.
the class AbstractBaseEntityAttributeConfigAction method getAttributePrototype.
public AttributeInterface getAttributePrototype(String typeCode) {
IEntityManager entityManager = this.getEntityManager();
Map<String, AttributeInterface> attributeTypes = entityManager.getEntityAttributePrototypes();
return attributeTypes.get(typeCode);
}
use of com.agiletec.aps.system.common.entity.IEntityManager in project entando-core by entando.
the class CompositeAttributeConfigAction method getAllowedAttributeElementTypes.
public List<AttributeInterface> getAllowedAttributeElementTypes() {
List<AttributeInterface> attributes = new ArrayList<AttributeInterface>();
try {
IEntityManager entityManager = this.getEntityManager();
Map<String, AttributeInterface> attributeTypes = entityManager.getEntityAttributePrototypes();
Iterator<AttributeInterface> attributeIter = attributeTypes.values().iterator();
while (attributeIter.hasNext()) {
AttributeInterface attribute = attributeIter.next();
if (attribute.isSimple()) {
attributes.add(attribute);
}
}
Collections.sort(attributes, new BeanComparator("type"));
} catch (Throwable t) {
_logger.error("Error extracting the allowed types of attribute elements", t);
// ApsSystemUtils.logThrowable(t, this, "getAllowedAttributeElementTypes");
throw new RuntimeException("Error extracting the allowed types of attribute elements", t);
}
return attributes;
}
use of com.agiletec.aps.system.common.entity.IEntityManager in project entando-core by entando.
the class EntityAttributeConfigAction method getAllowedNestedTypes.
public List<AttributeInterface> getAllowedNestedTypes(AttributeInterface listType) {
List<AttributeInterface> attributes = new ArrayList<AttributeInterface>();
try {
IEntityManager entityManager = this.getEntityManager();
Map<String, AttributeInterface> attributeTypes = entityManager.getEntityAttributePrototypes();
Iterator<AttributeInterface> attributeIter = attributeTypes.values().iterator();
while (attributeIter.hasNext()) {
AttributeInterface attribute = attributeIter.next();
boolean simple = attribute.isSimple();
boolean multiLanguage = attribute.isMultilingual();
if ((listType instanceof ListAttribute && simple && !multiLanguage) || (listType instanceof MonoListAttribute && !(attribute instanceof AbstractListAttribute))) {
attributes.add(attribute);
}
}
Collections.sort(attributes, new BeanComparator("type"));
} catch (Throwable t) {
_logger.error("Error while extracting Allowed Nested Types", t);
// ApsSystemUtils.logThrowable(t, this, "getAllowedNestedTypes");
throw new RuntimeException("Error while extracting Allowed Nested Types", t);
}
return attributes;
}
use of com.agiletec.aps.system.common.entity.IEntityManager in project entando-core by entando.
the class EntityTypeConfigAction method addAttribute.
@Override
public String addAttribute() {
this.updateEntityOnSession();
try {
IEntityManager entityManager = this.getEntityManager();
Map<String, AttributeInterface> attributeTypes = entityManager.getEntityAttributePrototypes();
if (null == attributeTypes.get(this.getAttributeTypeCode())) {
String[] args = { this.getAttributeTypeCode() };
this.addFieldError("attributeTypeCode", this.getText("error.attribute.not.exists", args));
return INPUT;
}
} catch (Throwable t) {
_logger.error("error in addAttribute", t);
// ApsSystemUtils.logThrowable(t, this, "addAttribute");
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.common.entity.IEntityManager in project entando-core by entando.
the class EntityTypeInfoTag method getMasterObject.
@Override
protected Object getMasterObject(String keyValue) throws Throwable {
String managerNameValue = (String) super.findValue(this.getEntityManagerName(), String.class);
try {
IEntityManager entityManager = (IEntityManager) ApsWebApplicationUtils.getBean(managerNameValue, this.pageContext);
if (null != entityManager) {
return entityManager.getEntityPrototype(keyValue);
}
} catch (Throwable t) {
String message = "Error extracting entity prototype : key '" + keyValue + "' - entity manager '" + managerNameValue + "'";
_logger.error("Error extracting entity prototype : key '{}' - entity manager '{}'", keyValue, managerNameValue, t);
// ApsSystemUtils.logThrowable(t, this, "getMasterObject", message);
throw new ApsSystemException(message, t);
}
_logger.debug("Null entity manager : service name '{}'", managerNameValue);
return null;
}
Aggregations