Search in sources :

Example 26 with AttributeTracer

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

the class TestValidateBooleanAttributes method validateMonolistCompositeElement.

protected void validateMonolistCompositeElement(String monolistAttributeName, String attributeName) throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        MonoListAttribute monolist = (MonoListAttribute) content.getAttribute(monolistAttributeName);
        CompositeAttribute compositeElement = (CompositeAttribute) monolist.addAttribute();
        AttributeInterface attribute = compositeElement.getAttribute(attributeName);
        String monolistElementFieldPrefix = "Monolist:Composite:";
        String formFieldPrefix = monolistElementFieldPrefix + attribute.getType() + ":";
        tracer.setListIndex(monolist.getAttributes().size() - 1);
        tracer.setListLang(this.getLangManager().getDefaultLang());
        tracer.setMonoListElement(true);
        tracer.setCompositeElement(true);
        tracer.setParentAttribute(compositeElement);
        String formFieldName = tracer.getFormFieldName(attribute);
        assertEquals(formFieldPrefix + monolistAttributeName + "_" + attributeName + "_0", formFieldName);
        String monolistElementName = tracer.getMonolistElementFieldName(compositeElement);
        assertEquals(monolistElementFieldPrefix + monolistAttributeName + "_0", monolistElementName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, monolistElementName);
        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;
    }
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) CompositeAttribute(com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 27 with AttributeTracer

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

the class TestValidateDateAttribute method testValidate_Single_2.

public void testValidate_Single_2() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        AttributeInterface dateAttribute = (AttributeInterface) content.getAttribute("Date2");
        String formFieldName = tracer.getFormFieldName(dateAttribute);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: end range 25/11/2020
        this.addParameter(formFieldName, "10/10/2021");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: end range 25/11/2020
        this.addParameter(formFieldName, "10/10/2009");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: start range attribute "Date"
        this.addParameter("Date:Date", "10/12/2009");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 28 with AttributeTracer

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

the class TestValidateDateAttribute method testValidate_Single_1.

public void testValidate_Single_1() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        AttributeInterface dateAttribute = (AttributeInterface) content.getAttribute("Date");
        String formFieldName = tracer.getFormFieldName(dateAttribute);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "dateValue");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "25/07/2012");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 29 with AttributeTracer

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

the class TestValidateDateAttribute method testValidate_CompositeElement.

public void testValidate_CompositeElement() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        CompositeAttribute compositeAttribute = (CompositeAttribute) content.getAttribute("Composite");
        AttributeInterface attribute = compositeAttribute.getAttribute("Date");
        tracer.setCompositeElement(true);
        tracer.setParentAttribute(compositeAttribute);
        String formFieldName = tracer.getFormFieldName(attribute);
        String formFieldPrefix = "Composite:" + attribute.getType() + ":";
        assertEquals(formFieldPrefix + "Composite_Date", formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "wrongDateValue");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: end range 10/10/2030
        this.addParameter(formFieldName, "10/10/2041");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: end range 10/10/2030
        this.addParameter(formFieldName, "10/10/2008");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: start range attribute "Date"
        this.addParameter("Date:Date", "10/10/2009");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) CompositeAttribute(com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 30 with AttributeTracer

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

the class TestValidateDateAttribute method testValidate_MonolistCompositeElement.

public void testValidate_MonolistCompositeElement() throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        MonoListAttribute monolist = (MonoListAttribute) content.getAttribute("MonoLCom");
        CompositeAttribute compositeElement = (CompositeAttribute) monolist.addAttribute();
        AttributeInterface attribute = compositeElement.getAttribute("Date");
        String monolistElementFieldPrefix = "Monolist:Composite:";
        String formFieldPrefix = monolistElementFieldPrefix + attribute.getType() + ":";
        tracer.setListIndex(monolist.getAttributes().size() - 1);
        tracer.setListLang(this.getLangManager().getDefaultLang());
        tracer.setMonoListElement(true);
        tracer.setCompositeElement(true);
        tracer.setParentAttribute(compositeElement);
        String formFieldName = tracer.getFormFieldName(attribute);
        assertEquals(formFieldPrefix + "MonoLCom_Date_0", formFieldName);
        String monolistElementName = tracer.getMonolistElementFieldName(compositeElement);
        assertEquals(monolistElementFieldPrefix + "MonoLCom_0", monolistElementName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, monolistElementName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "wrongDateValue");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: start range 10/10/1971
        this.addParameter(formFieldName, "24/10/1961");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: start range 10/10/1971
        this.addParameter(formFieldName, "10/10/2008");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        // validation: end range attribute "Date"
        this.addParameter("Date:Date", "10/10/1999");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, formFieldName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) CompositeAttribute(com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Aggregations

AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)51 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)39 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)35 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)18 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)13 AttributeFieldError (com.agiletec.aps.system.common.entity.model.AttributeFieldError)9 Lang (com.agiletec.aps.system.services.lang.Lang)7 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)5 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)5 AbstractResourceAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.AbstractResourceAttribute)4 IndexableAttributeInterface (com.agiletec.aps.system.common.searchengine.IndexableAttributeInterface)3 ArrayList (java.util.ArrayList)3 AttributeSearchInfo (com.agiletec.aps.system.common.entity.model.AttributeSearchInfo)2 AttributeManagerInterface (com.agiletec.apsadmin.system.entity.attribute.manager.AttributeManagerInterface)1 SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)1 ResourceAttributeInterface (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ResourceAttributeInterface)1 SymbolicLinkValidator (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.util.SymbolicLinkValidator)1 Field (org.apache.lucene.document.Field)1 IntField (org.apache.lucene.document.IntField)1 StringField (org.apache.lucene.document.StringField)1