Search in sources :

Example 91 with AttributeInterface

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

the class LinkAttributeActionHelper method getLinkAttribute.

protected AttributeInterface getLinkAttribute(AttributeInterface attribute, HttpServletRequest request) {
    HttpSession session = request.getSession();
    if (attribute instanceof CompositeAttribute) {
        String includedAttributeName = (String) session.getAttribute(INCLUDED_ELEMENT_NAME_SESSION_PARAM);
        AttributeInterface includedAttribute = ((CompositeAttribute) attribute).getAttribute(includedAttributeName);
        return getLinkAttribute(includedAttribute, request);
    } else if (attribute instanceof MonoListAttribute) {
        Integer elementIndex = (Integer) session.getAttribute(LIST_ELEMENT_INDEX_SESSION_PARAM);
        AttributeInterface attributeElement = ((MonoListAttribute) attribute).getAttribute(elementIndex.intValue());
        return getLinkAttribute(attributeElement, request);
    } else if (attribute instanceof LinkAttribute) {
        return attribute;
    } else {
        throw new RuntimeException("Caso non gestito : Atttributo tipo " + attribute.getClass());
    }
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) CompositeAttribute(com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute) HttpSession(javax.servlet.http.HttpSession) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 92 with AttributeInterface

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

the class LinkAttributeActionHelper method removeLink.

@Override
public void removeLink(HttpServletRequest request) {
    HttpSession session = request.getSession();
    Content currentContent = getContent(request);
    String attributeName = (String) session.getAttribute(ATTRIBUTE_NAME_SESSION_PARAM);
    AttributeInterface attribute = (AttributeInterface) currentContent.getAttribute(attributeName);
    removeLink(attribute, request);
    removeSessionParams(session);
}
Also used : HttpSession(javax.servlet.http.HttpSession) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 93 with AttributeInterface

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

the class ListAttributeAction method addListElement.

@Override
public String addListElement() {
    try {
        super.addListElement();
        Content content = this.getContent();
        int index = -1;
        ListAttributeInterface currentAttribute = (ListAttributeInterface) content.getAttribute(this.getAttributeName());
        String nestedType = currentAttribute.getNestedAttributeTypeCode();
        if (!nestedType.equals("Attach") && !nestedType.equals("Image") && !nestedType.equals("Link")) {
            return SUCCESS;
        }
        if (currentAttribute instanceof MonoListAttribute) {
            List<AttributeInterface> attributes = ((MonoListAttribute) currentAttribute).getAttributes();
            index = attributes.size() - 1;
        } else if (currentAttribute instanceof ListAttribute) {
            List<AttributeInterface> attributes = ((ListAttribute) currentAttribute).getAttributeList(this.getListLangCode());
            index = attributes.size() - 1;
        }
        this.setElementIndex(index);
        if (nestedType.equals("Attach") || nestedType.equals("Image")) {
            this.setResourceTypeCode(nestedType);
            return "chooseResource";
        } else {
            return "chooseLink";
        }
    } catch (Throwable t) {
        _logger.error("error in addListElement", t);
        // ApsSystemUtils.logThrowable(t, this, "addListElement");
        return FAILURE;
    }
}
Also used : ListAttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.ListAttributeInterface) MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) List(java.util.List) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface) ListAttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.ListAttributeInterface) ListAttribute(com.agiletec.aps.system.common.entity.model.attribute.ListAttribute) MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)

Example 94 with AttributeInterface

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

the class ResourceAttributeActionHelper method removeResource.

public static void removeResource(HttpServletRequest request) {
    HttpSession session = request.getSession();
    String attributeName = (String) session.getAttribute(ATTRIBUTE_NAME_SESSION_PARAM);
    AttributeInterface attribute = (AttributeInterface) getContent(request).getAttribute(attributeName);
    removeResource(attribute, request);
    removeSessionParams(session);
}
Also used : HttpSession(javax.servlet.http.HttpSession) ResourceAttributeInterface(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ResourceAttributeInterface) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 95 with AttributeInterface

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

the class ResourceAttributeActionHelper method joinResource.

/**
 * Associa la risorsa all'attributo del contenuto o all'elemento dell'attributo lista
 * o all'elemento dell'attributo Composito (sia semplice che in lista).
 */
public static void joinResource(ResourceInterface resource, HttpServletRequest request) {
    HttpSession session = request.getSession();
    Content currentContent = ResourceAttributeActionHelper.getContent(request);
    String attributeName = (String) session.getAttribute(ATTRIBUTE_NAME_SESSION_PARAM);
    AttributeInterface attribute = (AttributeInterface) currentContent.getAttribute(attributeName);
    joinResource(attribute, resource, session);
    removeSessionParams(session);
}
Also used : HttpSession(javax.servlet.http.HttpSession) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ResourceAttributeInterface(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ResourceAttributeInterface) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Aggregations

AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)147 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)55 AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)38 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)37 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)27 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)22 ArrayList (java.util.ArrayList)18 IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)17 ITextAttribute (com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute)16 DateAttribute (com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)14 NumberAttribute (com.agiletec.aps.system.common.entity.model.attribute.NumberAttribute)12 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)11 BooleanAttribute (com.agiletec.aps.system.common.entity.model.attribute.BooleanAttribute)10 IndexableAttributeInterface (com.agiletec.aps.system.common.searchengine.IndexableAttributeInterface)10 HttpSession (javax.servlet.http.HttpSession)10 EntityAttributeIterator (com.agiletec.aps.system.common.util.EntityAttributeIterator)9 IEntityManager (com.agiletec.aps.system.common.entity.IEntityManager)7 MonoTextAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)7 Lang (com.agiletec.aps.system.services.lang.Lang)7 Date (java.util.Date)7