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;
}
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;
}
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));
}
}
}
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;
}
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;
}
Aggregations