use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class AbstractApsEntityFinderAction method createBaseFilters.
protected void createBaseFilters() {
try {
int initSize = this.getFilters().length;
EntitySearchFilter[] roleFilters = this.getEntityActionHelper().getRoleFilters(this);
this.addFilters(roleFilters);
IApsEntity prototype = this.getEntityPrototype();
if (null != prototype) {
EntitySearchFilter filterToAdd = new EntitySearchFilter(IEntityManager.ENTITY_TYPE_CODE_FILTER_KEY, false, prototype.getTypeCode(), false);
this.addFilter(filterToAdd);
EntitySearchFilter[] filters = this.getEntityActionHelper().getAttributeFilters(this, prototype);
this.addFilters(filters);
}
this.setAddedAttributeFilter(this.getFilters().length > initSize);
} catch (Throwable t) {
_logger.error("Error while creating entity filters", t);
// ApsSystemUtils.logThrowable(t, this, "createBaseFilters");
throw new RuntimeException("Error while creating entity filters", t);
}
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class ListAttributeAction method moveListElement.
@Override
public String moveListElement() {
IApsEntity entity = this.getCurrentApsEntity();
try {
int elementIndex = this.getElementIndex();
ListAttributeInterface currentAttribute = (ListAttributeInterface) entity.getAttribute(this.getAttributeName());
if (currentAttribute instanceof MonoListAttribute) {
List<AttributeInterface> monoList = ((MonoListAttribute) currentAttribute).getAttributes();
this.moveListElement(monoList, elementIndex, this.getMovement());
} else if (currentAttribute instanceof ListAttribute) {
List<AttributeInterface> list = ((ListAttribute) currentAttribute).getAttributeList(this.getListLangCode());
this.moveListElement(list, elementIndex, this.getMovement());
}
_logger.debug("Moved element of type {} of the list {} in the position {} with a '{}' movement ", currentAttribute.getNestedAttributeTypeCode(), currentAttribute.getName(), elementIndex, this.getMovement());
} catch (Throwable t) {
_logger.error("error in moveListElement", t);
// ApsSystemUtils.logThrowable(t, this, "moveListElement");
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class ListAttributeAction method removeListElement.
@Override
public String removeListElement() {
IApsEntity entity = this.getCurrentApsEntity();
try {
int elementIndex = this.getElementIndex();
ListAttributeInterface currentAttribute = (ListAttributeInterface) entity.getAttribute(this.getAttributeName());
if (currentAttribute instanceof MonoListAttribute) {
((MonoListAttribute) currentAttribute).removeAttribute(elementIndex);
} else if (currentAttribute instanceof ListAttribute) {
((ListAttribute) currentAttribute).removeAttribute(this.getListLangCode(), elementIndex);
}
_logger.debug("Element oy type {} removed fomr the list {}", currentAttribute.getNestedAttributeTypeCode(), currentAttribute.getName());
} catch (Throwable t) {
_logger.error("error in removeListElement", t);
// ApsSystemUtils.logThrowable(t, this, "removeListElement");
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class ListAttributeAction method addListElement.
@Override
public String addListElement() {
IApsEntity entity = this.getCurrentApsEntity();
try {
ListAttributeInterface currentAttribute = (ListAttributeInterface) entity.getAttribute(this.getAttributeName());
if (currentAttribute instanceof MonoListAttribute) {
((MonoListAttribute) currentAttribute).addAttribute();
} else if (currentAttribute instanceof ListAttribute) {
((ListAttribute) currentAttribute).addAttribute(this.getListLangCode());
}
_logger.debug("Added element of type {} to the list {}", currentAttribute.getNestedAttributeTypeCode(), currentAttribute.getName());
} catch (Throwable t) {
_logger.error("error in addListElement", t);
// ApsSystemUtils.logThrowable(t, this, "addListElement");
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class CompositeAttributeConfigAction method saveCompositeAttribute.
@Override
public String saveCompositeAttribute() {
try {
CompositeAttribute composite = this.getCompositeAttributeOnEdit();
IApsEntity entityType = this.getEntityType();
AttributeInterface attribute = (AttributeInterface) entityType.getAttribute(composite.getName());
if (attribute instanceof MonoListAttribute) {
((MonoListAttribute) attribute).setNestedAttributeType(composite);
} else if (!attribute.getName().equals(composite.getName())) {
throw new ApsSystemException("Attribute Name '" + attribute.getName() + "' incompatible with composite Attribute name '" + composite.getName() + "'");
} else if (!attribute.getType().equals(composite.getType())) {
throw new ApsSystemException("Attribute Type '" + attribute.getType() + "' incompatible with composite Attribute type '" + composite.getType() + "'");
}
this.getRequest().getSession().removeAttribute(COMPOSITE_ATTRIBUTE_ON_EDIT_SESSION_PARAM);
} catch (Throwable t) {
_logger.error("error in saveAttribute", t);
// ApsSystemUtils.logThrowable(t, this, "saveAttribute");
return FAILURE;
}
return SUCCESS;
}
Aggregations