Search in sources :

Example 1 with LinkAttribute

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

the class LinkAttributeHandler method startLink.

private void startLink(Attributes attributes, String qName) throws SAXException {
    this._linkType = extractAttribute(attributes, "type", qName, true);
    ((LinkAttribute) this.getCurrentAttr()).setSymbolicLink(new SymbolicLink());
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 2 with LinkAttribute

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

the class LinkAttributeHandler method endLink.

private void endLink() {
    SymbolicLink symLink = ((LinkAttribute) this.getCurrentAttr()).getSymbolicLink();
    if (null != symLink && null != _linkType) {
        if (_linkType.equals("content")) {
            symLink.setDestinationToContent(_contentDest);
        } else if (_linkType.equals("external")) {
            symLink.setDestinationToUrl(_urlDest);
        } else if (_linkType.equals("page")) {
            symLink.setDestinationToPage(_pageDest);
        } else if (_linkType.equals("contentonpage")) {
            symLink.setDestinationToContentOnPage(_contentDest, _pageDest);
        }
    }
    _contentDest = null;
    _urlDest = null;
    _pageDest = null;
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 3 with LinkAttribute

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

the class TestLinkAttributeAction method testRemoveLink.

public void testRemoveLink() throws Throwable {
    String contentId = "ART102";
    String contentOnSessionMarker = this.extractSessionMarker(contentId, ApsAdminSystemConstants.EDIT);
    this.executeEdit(contentId, "admin");
    Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
    assertNotNull(currentContent);
    LinkAttribute linkAttribute = (LinkAttribute) currentContent.getAttribute("VediAnche");
    assertNotNull(linkAttribute);
    SymbolicLink symbolicLink = linkAttribute.getSymbolicLink();
    assertNotNull(symbolicLink);
    assertEquals("ART111", symbolicLink.getContentDest());
    this.initContentAction("/do/jacms/Content", "removeLink", contentOnSessionMarker);
    this.addParameter("attributeName", "VediAnche");
    this.addParameter("langCode", "it");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    currentContent = this.getContentOnEdit(contentOnSessionMarker);
    assertNotNull(currentContent);
    linkAttribute = (LinkAttribute) currentContent.getAttribute("VediAnche");
    assertNotNull(linkAttribute);
    symbolicLink = linkAttribute.getSymbolicLink();
    assertNull(symbolicLink);
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 4 with LinkAttribute

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

the class TestPageLinkAction method testJoinPageLink_1.

public void testJoinPageLink_1() throws Throwable {
    String contentOnSessionMarker = this.initJoinLinkTest("admin", "ART1", "VediAnche", "it");
    this.initContentAction("/do/jacms/Content/Link", "joinPageLink", contentOnSessionMarker);
    this.addParameter("linkType", String.valueOf(SymbolicLink.PAGE_TYPE));
    this.addParameter("selectedNode", "pagina_11");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    Content content = this.getContentOnEdit(contentOnSessionMarker);
    LinkAttribute attribute = (LinkAttribute) content.getAttribute("VediAnche");
    SymbolicLink symbolicLink = attribute.getSymbolicLink();
    assertNotNull(symbolicLink);
    assertEquals("pagina_11", symbolicLink.getPageDest());
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 5 with LinkAttribute

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

the class LinkAttributeActionHelper method removeLink.

protected void removeLink(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);
        removeLink(includedAttribute, request);
    } else if (attribute instanceof LinkAttribute) {
        ((LinkAttribute) attribute).setSymbolicLink(null);
        ((LinkAttribute) attribute).getTextMap().clear();
    } else if (attribute instanceof MonoListAttribute) {
        Integer elementIndex = (Integer) session.getAttribute(LIST_ELEMENT_INDEX_SESSION_PARAM);
        AttributeInterface attributeElement = ((MonoListAttribute) attribute).getAttribute(elementIndex.intValue());
        removeLink(attributeElement, request);
    }
}
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)

Aggregations

LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)15 SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)9 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)7 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)6 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)6 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)4 HttpSession (javax.servlet.http.HttpSession)4 FieldError (com.agiletec.aps.system.common.entity.model.FieldError)1 AbstractComplexAttribute (com.agiletec.aps.system.common.entity.model.attribute.AbstractComplexAttribute)1 AbstractListAttribute (com.agiletec.aps.system.common.entity.model.attribute.AbstractListAttribute)1 DateAttribute (com.agiletec.aps.system.common.entity.model.attribute.DateAttribute)1 HypertextAttribute (com.agiletec.aps.system.common.entity.model.attribute.HypertextAttribute)1 MonoTextAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoTextAttribute)1 TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)1 AbstractResourceAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.AbstractResourceAttribute)1 ResourceAttributeInterface (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ResourceAttributeInterface)1 ActionSupport (com.opensymphony.xwork2.ActionSupport)1 Iterator (java.util.Iterator)1 Map (java.util.Map)1