Search in sources :

Example 6 with AbstractResourceAttribute

use of com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.AbstractResourceAttribute in project entando-core by entando.

the class TestValidateResourceAttribute method testValidate_Single.

protected void testValidate_Single(String attributeName, String testResourceId) throws Throwable {
    try {
        String contentOnSessionMarker = this.executeCreateNewContent();
        Content content = this.getContentOnEdit(contentOnSessionMarker);
        AttributeTracer tracer = this.getTracer();
        AttributeInterface resourceAttribute = (AttributeInterface) content.getAttribute(attributeName);
        String formFieldName = tracer.getFormFieldName(resourceAttribute);
        String resourceFieldName = resourceAttribute.getType() + ":" + attributeName;
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, resourceFieldName);
        this.checkFieldErrors(0, formFieldName);
        this.initSaveContentAction(contentOnSessionMarker);
        this.addParameter(formFieldName, "resourceDescription");
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(1, resourceFieldName);
        content = this.getContentOnEdit(contentOnSessionMarker);
        AbstractResourceAttribute attachAttribute = (AbstractResourceAttribute) content.getAttribute(attributeName);
        ResourceInterface resource = this._resourceManager.loadResource(testResourceId);
        attachAttribute.setResource(resource, this.getLangManager().getDefaultLang().getCode());
        this.initSaveContentAction(contentOnSessionMarker);
        this.executeAction(Action.INPUT);
        this.checkFieldErrors(0, resourceFieldName);
    } catch (Throwable t) {
        this.deleteTestContent();
        throw t;
    }
}
Also used : AbstractResourceAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.AbstractResourceAttribute) AttributeTracer(com.agiletec.aps.system.common.entity.model.AttributeTracer) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ResourceInterface(com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Aggregations

AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)6 AbstractResourceAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.AbstractResourceAttribute)6 AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)4 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)4 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)4 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)4 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)3 AbstractComplexAttribute (com.agiletec.aps.system.common.entity.model.attribute.AbstractComplexAttribute)1 AbstractListAttribute (com.agiletec.aps.system.common.entity.model.attribute.AbstractListAttribute)1 ILangManager (com.agiletec.aps.system.services.lang.ILangManager)1 LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)1 ResourceAttributeInterface (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ResourceAttributeInterface)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1 HttpSession (javax.servlet.http.HttpSession)1