Search in sources :

Example 56 with IApsEntity

use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.

the class AbstractApsEntityFinderAction method checkDeletingEntity.

protected String checkDeletingEntity() throws Throwable {
    IApsEntity entity = this.getEntity(this.getEntityId());
    if (null == entity) {
        String[] args = { this.getEntityId() };
        this.addFieldError("entityId", this.getText("error.entity.null", args));
        return INPUT;
    }
    return null;
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity)

Example 57 with IApsEntity

use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.

the class EntityTypeConfigAction method saveEntityType.

@Override
public String saveEntityType() {
    try {
        IApsEntity entityType = this.getEntityType();
        entityType.setDefaultLang(this.getLangManager().getDefaultLang().getCode());
        if (this.getOperationId() == ApsAdminSystemConstants.ADD) {
            ((IEntityTypesConfigurer) this.getEntityManager()).addEntityPrototype(entityType);
        } else {
            ((IEntityTypesConfigurer) this.getEntityManager()).updateEntityPrototype(entityType);
        }
        String entityManagerName = (String) this.getRequest().getSession().getAttribute(ENTITY_TYPE_MANAGER_SESSION_PARAM);
        this.setEntityManagerName(entityManagerName);
    } catch (Throwable t) {
        _logger.error("error in saveEntityType", t);
        // ApsSystemUtils.logThrowable(t, this, "saveEntityType");
        return FAILURE;
    } finally {
        this.getRequest().getSession().removeAttribute(ENTITY_TYPE_MANAGER_SESSION_PARAM);
        this.getRequest().getSession().removeAttribute(ENTITY_TYPE_OPERATION_ID_SESSION_PARAM);
        this.getRequest().getSession().removeAttribute(ENTITY_TYPE_ON_EDIT_SESSION_PARAM);
    }
    return SUCCESS;
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity) IEntityTypesConfigurer(com.agiletec.aps.system.common.entity.IEntityTypesConfigurer)

Example 58 with IApsEntity

use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.

the class EntityTypeConfigAction method validate.

@Override
public void validate() {
    super.validate();
    IApsEntity entityType = this.updateEntityOnSession();
    if (this.getOperationId() == ApsAdminSystemConstants.ADD && !this.hasFieldErrors()) {
        if (null != this.getEntityPrototype(entityType.getTypeCode())) {
            String[] args = { entityType.getTypeCode() };
            this.addFieldError("entityTypeCode", this.getText("error.entity.alredy.exists", args));
        }
    }
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity)

Example 59 with IApsEntity

use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.

the class EntityTypeConfigAction method updateEntityOnSession.

protected IApsEntity updateEntityOnSession() {
    IApsEntity entityType = this.getEntityType();
    if (this.getOperationId() == ApsAdminSystemConstants.ADD && null != this.getEntityTypeCode()) {
        entityType.setTypeCode(this.getEntityTypeCode());
    }
    entityType.setTypeDescr(this.getEntityTypeDescription());
    return entityType;
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity)

Example 60 with IApsEntity

use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.

the class EntityTypeConfigAction method editAttribute.

@Override
public String editAttribute() {
    try {
        IApsEntity entityType = this.updateEntityOnSession();
        if (null == entityType.getAttribute(this.getAttributeName())) {
            String[] args = { this.getAttributeName() };
            this.addFieldError("attributeName", this.getText("error.attribute.not.exists", args));
            return INPUT;
        }
    } catch (Throwable t) {
        _logger.error("error in editAttribute", t);
        // ApsSystemUtils.logThrowable(t, this, "editAttribute");
        return FAILURE;
    }
    return SUCCESS;
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity)

Aggregations

IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)70 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)24 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)16 IEntityManager (com.agiletec.aps.system.common.entity.IEntityManager)12 IEntityTypesConfigurer (com.agiletec.aps.system.common.entity.IEntityTypesConfigurer)11 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)11 ArrayList (java.util.ArrayList)9 StringApiResponse (org.entando.entando.aps.system.services.api.model.StringApiResponse)6 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)5 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)4 Lang (com.agiletec.aps.system.services.lang.Lang)4 List (java.util.List)4 BeanComparator (org.apache.commons.beanutils.BeanComparator)4 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)3 ListAttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.ListAttributeInterface)3 ApiError (org.entando.entando.aps.system.services.api.model.ApiError)3 IUserProfile (org.entando.entando.aps.system.services.userprofile.model.IUserProfile)3 Widget (com.agiletec.aps.system.services.page.Widget)2 ApsProperties (com.agiletec.aps.util.ApsProperties)2 EntityAttributeConfigAction (com.agiletec.apsadmin.system.entity.type.EntityAttributeConfigAction)2