Search in sources :

Example 21 with IEntityManager

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

the class TestEntityManagersAction method executeEditAttribute.

private String executeEditAttribute(String username, String attributeName, String entityTypeCode, String entityManagerName) throws Throwable {
    this.setUserOnSession(username);
    this.initAction("/do/Entity/Attribute", "editAttribute");
    this.addParameter("attributeName", attributeName);
    IEntityManager entityManager = (IEntityManager) this.getApplicationContext().getBean(entityManagerName);
    IApsEntity entityType = entityManager.getEntityPrototype(entityTypeCode);
    this.getRequest().getSession().setAttribute(IEntityTypeConfigAction.ENTITY_TYPE_ON_EDIT_SESSION_PARAM, entityType);
    return this.executeAction();
}
Also used : IEntityManager(com.agiletec.aps.system.common.entity.IEntityManager) IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity)

Example 22 with IEntityManager

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

the class AbstractApsEntityFinderAction method getSearchResult.

@Override
public List<String> getSearchResult() {
    List<String> result = null;
    try {
        IEntityManager entityManager = this.getEntityManager();
        result = entityManager.searchId(this.getFilters());
    } catch (Throwable t) {
        _logger.error("Error while searching entity Ids", t);
        throw new RuntimeException("Error while searching entity Ids", t);
    }
    return result;
}
Also used : IEntityManager(com.agiletec.aps.system.common.entity.IEntityManager)

Example 23 with IEntityManager

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

the class AbstractApsEntityFinderAction method getEntity.

protected IApsEntity getEntity(String entityId) {
    IApsEntity entity = null;
    try {
        IEntityManager entityManager = this.getEntityManager();
        entity = entityManager.getEntity(entityId);
    } catch (Throwable t) {
        _logger.error("Error while extracting entity", t);
        throw new RuntimeException("Error while extracting entity", t);
    }
    return entity;
}
Also used : IEntityManager(com.agiletec.aps.system.common.entity.IEntityManager) IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity)

Example 24 with IEntityManager

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

the class EntityTypeConfigAction method getAttributeTypes.

public List<AttributeInterface> getAttributeTypes() {
    List<AttributeInterface> attributes = null;
    try {
        IEntityManager entityManager = this.getEntityManager();
        Map<String, AttributeInterface> attributeTypes = entityManager.getEntityAttributePrototypes();
        attributes = new ArrayList<AttributeInterface>(attributeTypes.values());
        Collections.sort(attributes, new BeanComparator("type"));
    } catch (Throwable t) {
        _logger.error("Error while extracting attribute Types", t);
        // ApsSystemUtils.logThrowable(t, this, "getAttributeTypes");
        throw new RuntimeException("Error while extracting attribute Types", t);
    }
    return attributes;
}
Also used : IEntityManager(com.agiletec.aps.system.common.entity.IEntityManager) BeanComparator(org.apache.commons.beanutils.BeanComparator) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 25 with IEntityManager

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

the class EntityInfoTag 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.getEntity(keyValue);
        }
    } catch (Throwable t) {
        String message = "Error extracting entity : key '" + keyValue + "' - entity manager '" + managerNameValue + "'";
        _logger.error("Error extracting entity : 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;
}
Also used : IEntityManager(com.agiletec.aps.system.common.entity.IEntityManager) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException)

Aggregations

IEntityManager (com.agiletec.aps.system.common.entity.IEntityManager)25 IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)12 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)7 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)7 ArrayList (java.util.ArrayList)7 IEntityTypesConfigurer (com.agiletec.aps.system.common.entity.IEntityTypesConfigurer)5 BeanComparator (org.apache.commons.beanutils.BeanComparator)5 RestServerError (org.entando.entando.aps.system.exception.RestServerError)3 IndexableAttributeInterface (com.agiletec.aps.system.common.searchengine.IndexableAttributeInterface)2 EntityAttributeConfigAction (com.agiletec.apsadmin.system.entity.type.EntityAttributeConfigAction)2 RestRourceNotFoundException (org.entando.entando.aps.system.exception.RestRourceNotFoundException)2 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)2 AbstractListAttribute (com.agiletec.aps.system.common.entity.model.attribute.AbstractListAttribute)1 ITextAttribute (com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute)1 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)1 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)1 SearcherDaoPaginatedResult (com.agiletec.aps.system.common.model.dao.SearcherDaoPaginatedResult)1 List (java.util.List)1 StringApiResponse (org.entando.entando.aps.system.services.api.model.StringApiResponse)1 StringListApiResponse (org.entando.entando.aps.system.services.api.model.StringListApiResponse)1