use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class UserProfileAction method edit.
@Override
public String edit() {
String username = this.getUsername();
try {
String checkUsernameResult = this.checkUsername(username, false);
if (null != checkUsernameResult)
return checkUsernameResult;
IUserProfile userProfile = (IUserProfile) this.getUserProfileManager().getProfile(username);
if (null == userProfile) {
List<IApsEntity> userProfileTypes = new ArrayList<IApsEntity>();
userProfileTypes.addAll(this.getUserProfileManager().getEntityPrototypes().values());
if (userProfileTypes.isEmpty()) {
throw new RuntimeException("Unexpected error - no one user profile types");
} else if (userProfileTypes.size() == 1) {
userProfile = (IUserProfile) userProfileTypes.get(0);
userProfile.setId(username);
} else {
return "chooseType";
}
}
this.getRequest().getSession().setAttribute(USERPROFILE_ON_SESSION, userProfile);
} catch (Throwable t) {
_logger.error("error in edit", t);
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class EntityTypeDOM method doParsing.
protected IApsEntity doParsing(Element element, Class entityClass, IApsEntityDOM entityDom) throws ApsSystemException {
IApsEntity entity = null;
try {
entity = this.createEntityType(element, entityClass);
entity.setEntityDOM(entityDom);
this.fillEntityType(entity, element);
entity.setDefaultLang(this.getLangManager().getDefaultLang().getCode());
_logger.debug("Entity Type '{}' defined", entity.getTypeCode());
} catch (Throwable t) {
_logger.error("Error extracting entity type", t);
throw new ApsSystemException("Configuration error of the Entity Type detected", t);
}
return entity;
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class TestJacmsEntityTypeConfigAction method testMoveAttribute.
public void testMoveAttribute() 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);
List<AttributeInterface> attributes = contentType.getAttributeList();
assertEquals(7, attributes.size());
assertEquals("VediAnche", attributes.get(2).getName());
assertEquals("CorpoTesto", attributes.get(3).getName());
this.initAction("/do/jacms/Entity", "moveAttribute");
this.addParameter("attributeIndex", "2");
this.addParameter("movement", ApsAdminSystemConstants.MOVEMENT_DOWN_CODE);
result = this.executeAction();
assertEquals(Action.SUCCESS, result);
contentType = (IApsEntity) this.getRequest().getSession().getAttribute(IEntityTypeConfigAction.ENTITY_TYPE_ON_EDIT_SESSION_PARAM);
assertNotNull(contentType);
attributes = contentType.getAttributeList();
assertEquals(7, attributes.size());
assertEquals("VediAnche", attributes.get(3).getName());
assertEquals("CorpoTesto", attributes.get(2).getName());
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class TestJacmsEntityTypeConfigAction method testRemoveAttribute.
public void testRemoveAttribute() 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);
List<AttributeInterface> attributes = contentType.getAttributeList();
assertEquals(7, attributes.size());
assertEquals("VediAnche", attributes.get(2).getName());
assertEquals("CorpoTesto", attributes.get(3).getName());
this.initAction("/do/jacms/Entity", "removeAttribute");
this.addParameter("attributeIndex", "2");
result = this.executeAction();
assertEquals(Action.SUCCESS, result);
contentType = (IApsEntity) this.getRequest().getSession().getAttribute(IEntityTypeConfigAction.ENTITY_TYPE_ON_EDIT_SESSION_PARAM);
assertNotNull(contentType);
attributes = contentType.getAttributeList();
assertEquals(6, attributes.size());
assertEquals("CorpoTesto", attributes.get(2).getName());
}
use of com.agiletec.aps.system.common.entity.model.IApsEntity in project entando-core by entando.
the class TestJacmsEntityTypeConfigAction method testEditEntityPrototype.
public void testEditEntityPrototype() 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);
List<AttributeInterface> attributes = contentType.getAttributeList();
assertEquals(7, attributes.size());
}
Aggregations