Search in sources :

Example 21 with SymbolicLink

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

the class TestContentLinkAction method testJoinContentLink_1.

public void testJoinContentLink_1() throws Throwable {
    String contentOnSessionMarker = this.extractSessionMarker("ART1", ApsAdminSystemConstants.EDIT);
    this.initJoinLinkTest("admin", "ART1", "VediAnche", "it");
    this.initContentAction("/do/jacms/Content/Link", "joinContentLink", contentOnSessionMarker);
    this.addParameter("contentId", "ART1");
    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);
    assertNull(symbolicLink.getPageDest());
    assertEquals("ART1", symbolicLink.getContentDest());
}
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 22 with SymbolicLink

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

the class TestUrlLinkAction method testJoinContentLink_1.

public void testJoinContentLink_1() throws Throwable {
    String contentOnSessionMarker = this.initJoinLinkTest("ART1", "VediAnche", "it");
    this.initContentAction("/do/jacms/Content/Link", "joinUrlLink", contentOnSessionMarker);
    this.addParameter("url", "http://www.japsportal.org");
    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);
    assertNull(symbolicLink.getPageDest());
    assertNull(symbolicLink.getContentDest());
    assertEquals("http://www.japsportal.org", symbolicLink.getUrlDest());
}
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 23 with SymbolicLink

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

the class LinkAttributeActionHelper method updateLink.

protected void updateLink(AttributeInterface currentAttribute, String[] destinations, int destType) {
    if (destinations.length != 3) {
        throw new RuntimeException("Destinazioni non riconosciute");
    }
    SymbolicLink symbolicLink = new SymbolicLink();
    switch(destType) {
        case (SymbolicLink.CONTENT_TYPE):
            symbolicLink.setDestinationToContent(destinations[1]);
            break;
        case (SymbolicLink.CONTENT_ON_PAGE_TYPE):
            symbolicLink.setDestinationToContentOnPage(destinations[1], destinations[2]);
            break;
        case SymbolicLink.PAGE_TYPE:
            symbolicLink.setDestinationToPage(destinations[2]);
            break;
        case SymbolicLink.URL_TYPE:
            symbolicLink.setDestinationToUrl(destinations[0]);
            break;
        default:
            symbolicLink.setDestinationToContent("");
            break;
    }
    ((LinkAttribute) currentAttribute).setSymbolicLink(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 24 with SymbolicLink

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

the class CmsHypertextAttribute method getReferences.

@Override
public List<CmsAttributeReference> getReferences(List<Lang> systemLangs) {
    List<CmsAttributeReference> refs = new ArrayList<>();
    for (Lang lang : systemLangs) {
        String text = this.getTextMap().get(lang.getCode());
        List<SymbolicLink> links = HypertextAttributeUtil.getSymbolicLinksOnText(text);
        if (null != links && !links.isEmpty()) {
            for (SymbolicLink symbLink : links) {
                if (symbLink.getDestType() != SymbolicLink.URL_TYPE) {
                    CmsAttributeReference ref = new CmsAttributeReference(symbLink.getPageDest(), symbLink.getContentDest(), symbLink.getResourceDest());
                    refs.add(ref);
                }
            }
        }
    }
    return refs;
}
Also used : ArrayList(java.util.ArrayList) Lang(com.agiletec.aps.system.services.lang.Lang) CmsAttributeReference(com.agiletec.plugins.jacms.aps.system.services.content.model.CmsAttributeReference) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 25 with SymbolicLink

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

the class LinkAttribute method getReferences.

@Override
public List<CmsAttributeReference> getReferences(List<Lang> systemLangs) {
    List<CmsAttributeReference> refs = new ArrayList<>();
    SymbolicLink symbLink = this.getSymbolicLink();
    if (null != symbLink && (symbLink.getDestType() != SymbolicLink.URL_TYPE)) {
        CmsAttributeReference ref = new CmsAttributeReference(symbLink.getPageDest(), symbLink.getContentDest(), null);
        refs.add(ref);
    }
    return refs;
}
Also used : ArrayList(java.util.ArrayList) CmsAttributeReference(com.agiletec.plugins.jacms.aps.system.services.content.model.CmsAttributeReference) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Aggregations

SymbolicLink (com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)27 LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)9 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)6 Lang (com.agiletec.aps.system.services.lang.Lang)3 CmsAttributeReference (com.agiletec.plugins.jacms.aps.system.services.content.model.CmsAttributeReference)3 SymbolicLinkValidator (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.util.SymbolicLinkValidator)3 ArrayList (java.util.ArrayList)3 AttributeFieldError (com.agiletec.aps.system.common.entity.model.AttributeFieldError)2 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)2 AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)1 FieldError (com.agiletec.aps.system.common.entity.model.FieldError)1 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)1 IPageManager (com.agiletec.aps.system.services.page.IPageManager)1 IReferenceableAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.IReferenceableAttribute)1 ActionSupport (com.opensymphony.xwork2.ActionSupport)1