use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class ListAttributeManager method updateAttribute.
@Override
protected void updateAttribute(AttributeInterface attribute, AttributeTracer tracer, HttpServletRequest request) {
List<Lang> langs = this.getLangManager().getLangs();
for (int i = 0; i < langs.size(); i++) {
Lang lang = langs.get(i);
List<AttributeInterface> attributeList = ((ListAttribute) attribute).getAttributeList(lang.getCode());
for (int j = 0; j < attributeList.size(); j++) {
AttributeInterface attributeElement = attributeList.get(j);
AttributeTracer elementTracer = (AttributeTracer) tracer.clone();
elementTracer.setListElement(true);
elementTracer.setListLang(lang);
elementTracer.setListIndex(j);
AbstractAttributeManager elementManager = (AbstractAttributeManager) this.getManager(attributeElement);
if (elementManager != null) {
elementManager.updateAttribute(attributeElement, elementTracer, request);
}
}
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class MonoListAttributeManager method updateAttribute.
@Override
protected void updateAttribute(AttributeInterface attribute, AttributeTracer tracer, HttpServletRequest request) {
List<AttributeInterface> attributes = ((MonoListAttribute) attribute).getAttributes();
for (int i = 0; i < attributes.size(); i++) {
AttributeInterface attributeElement = attributes.get(i);
AttributeTracer elementTracer = (AttributeTracer) tracer.clone();
elementTracer.setMonoListElement(true);
elementTracer.setListIndex(i);
AbstractAttributeManager elementManager = (AbstractAttributeManager) this.getManager(attributeElement);
if (elementManager != null) {
elementManager.updateAttribute(attributeElement, elementTracer, request);
}
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateBooleanAttributes method validateSingle.
protected void validateSingle(String attributeName) throws Throwable {
try {
String contentOnSessionMarker = this.executeCreateNewContent();
Content content = this.getContentOnEdit(contentOnSessionMarker);
AttributeTracer tracer = this.getTracer();
AttributeInterface booleanAttribute = (AttributeInterface) content.getAttribute(attributeName);
String formFieldName = tracer.getFormFieldName(booleanAttribute);
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "true");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "false");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateBooleanAttributes method validateListElement.
protected void validateListElement(String listAttributeName) throws Throwable {
try {
String contentOnSessionMarker = this.executeCreateNewContent();
Content content = this.getContentOnEdit(contentOnSessionMarker);
AttributeTracer tracerIT = this.getTracer();
ListAttribute list = (ListAttribute) content.getAttribute(listAttributeName);
AttributeInterface attributeIT = list.addAttribute("it");
assertEquals(0, list.getAttributeList("en").size());
assertEquals(1, list.getAttributeList("it").size());
tracerIT.setListIndex(list.getAttributeList("it").size() - 1);
tracerIT.setListLang(this.getLangManager().getLang("it"));
tracerIT.setListElement(true);
String formFieldItName = tracerIT.getFormFieldName(attributeIT);
String formFieldPrefix = "List:" + attributeIT.getType() + ":";
assertEquals(formFieldPrefix + "it_" + listAttributeName + "_0", formFieldItName);
AttributeTracer tracerEN = tracerIT.clone();
tracerEN.setLang(this.getLangManager().getLang("en"));
tracerEN.setListLang(this.getLangManager().getLang("en"));
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldItName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldItName, "true");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldItName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldItName, "false");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldItName);
AttributeInterface attribute2 = list.addAttribute("it");
tracerIT.setListIndex(list.getAttributes().size() - 1);
formFieldItName = tracerIT.getFormFieldName(attribute2);
assertEquals(formFieldPrefix + "it_" + listAttributeName + "_1", formFieldItName);
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldItName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldItName, "true");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldItName);
AttributeInterface attributeEN = list.addAttribute("en");
String formFieldEnName = tracerEN.getFormFieldName(attributeEN);
assertEquals(formFieldPrefix + "en_" + listAttributeName + "_0", formFieldEnName);
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldEnName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldEnName, "true");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldEnName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
use of com.agiletec.aps.system.common.entity.model.AttributeTracer in project entando-core by entando.
the class TestValidateBooleanAttributes method validateCompositeElement.
protected void validateCompositeElement(String compositeAttributeName, String attributeName) throws Throwable {
try {
String contentOnSessionMarker = this.executeCreateNewContent();
Content content = this.getContentOnEdit(contentOnSessionMarker);
AttributeTracer tracer = this.getTracer();
CompositeAttribute compositeAttribute = (CompositeAttribute) content.getAttribute(compositeAttributeName);
AttributeInterface attribute = compositeAttribute.getAttribute(attributeName);
tracer.setCompositeElement(true);
tracer.setParentAttribute(compositeAttribute);
String formFieldName = tracer.getFormFieldName(attribute);
String formFieldPrefix = "Composite:" + attribute.getType() + ":";
assertEquals(formFieldPrefix + compositeAttributeName + "_" + attributeName, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "true");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
this.initSaveContentAction(contentOnSessionMarker);
this.addParameter(formFieldName, "false");
this.executeAction(Action.INPUT);
this.checkFieldErrors(0, formFieldName);
} catch (Throwable t) {
this.deleteTestContent();
throw t;
}
}
Aggregations