Search in sources :

Example 51 with IApsEntity

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

the class TestJacmsEntityTypeConfigAction method testEditAttribute.

public void testEditAttribute() throws Throwable {
    String result = this.executeEditEntityPrototype("ART", JacmsSystemConstants.CONTENT_MANAGER);
    assertEquals(Action.SUCCESS, result);
    IApsEntity contentType = (IApsEntity) this.getRequest().getSession().getAttribute(IEntityTypeConfigAction.ENTITY_TYPE_ON_EDIT_SESSION_PARAM);
    assertNotNull(contentType);
    assertTrue(contentType.getAttributeMap().containsKey("Data"));
    result = this.executeEditAttribute("Data");
    assertEquals(Action.SUCCESS, result);
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity)

Example 52 with IApsEntity

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

the class TestJacmsEntityTypeConfigAction method testEditNullEntityPrototype.

public void testEditNullEntityPrototype() throws Throwable {
    String result = this.executeEditEntityPrototype("WWW", JacmsSystemConstants.CONTENT_MANAGER);
    assertEquals(Action.INPUT, result);
    IApsEntity contentType = (IApsEntity) this.getRequest().getSession().getAttribute(IEntityTypeConfigAction.ENTITY_TYPE_ON_EDIT_SESSION_PARAM);
    assertNull(contentType);
    Map<String, List<String>> fieldErrors = this.getAction().getFieldErrors();
    assertEquals(1, fieldErrors.size());
    assertEquals(1, fieldErrors.get("entityTypeCode").size());
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity) List(java.util.List)

Example 53 with IApsEntity

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

the class TestJacmsEntityTypeConfigAction method testFailureEditAttribute.

public void testFailureEditAttribute() throws Throwable {
    String result = this.executeEditEntityPrototype("ART", JacmsSystemConstants.CONTENT_MANAGER);
    assertEquals(Action.SUCCESS, result);
    IApsEntity contentType = (IApsEntity) this.getRequest().getSession().getAttribute(IEntityTypeConfigAction.ENTITY_TYPE_ON_EDIT_SESSION_PARAM);
    assertNotNull(contentType);
    assertTrue(!contentType.getAttributeMap().containsKey("Abstract"));
    result = this.executeEditAttribute("Abstract");
    assertEquals(Action.INPUT, result);
    Map<String, List<String>> fieldErrors = this.getAction().getFieldErrors();
    assertEquals(1, fieldErrors.size());
    assertEquals(1, fieldErrors.get("attributeName").size());
    result = this.executeEditAttribute(null);
    assertEquals(Action.INPUT, result);
    fieldErrors = this.getAction().getFieldErrors();
    assertEquals(1, fieldErrors.size());
    assertEquals(1, fieldErrors.get("attributeName").size());
}
Also used : IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity) List(java.util.List)

Example 54 with IApsEntity

use of com.agiletec.aps.system.common.entity.model.IApsEntity 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 55 with IApsEntity

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

the class AbstractApsEntityFinderAction method getSearchableAttributes.

public List<AttributeInterface> getSearchableAttributes() {
    List<AttributeInterface> searchableAttributes = new ArrayList<AttributeInterface>();
    IApsEntity prototype = this.getEntityPrototype();
    if (null == prototype) {
        return searchableAttributes;
    }
    List<AttributeInterface> contentAttributes = prototype.getAttributeList();
    for (int i = 0; i < contentAttributes.size(); i++) {
        AttributeInterface attribute = contentAttributes.get(i);
        if (attribute.isActive() && attribute.isSearchable()) {
            searchableAttributes.add(attribute);
        }
    }
    return searchableAttributes;
}
Also used : ArrayList(java.util.ArrayList) IApsEntity(com.agiletec.aps.system.common.entity.model.IApsEntity) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

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