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