Search in sources :

Example 16 with SymbolicLink

use of com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink 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 17 with SymbolicLink

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

the class TestValidateContent method testValidate_2.

public void testValidate_2() throws Throwable {
    try {
        Content content = this._contentManager.loadContent("EVN191", true);
        content.setId(null);
        // Valorizzo il gruppo proprietario
        content.setMainGroup(Group.FREE_GROUP_NAME);
        content.getGroups().add("customers");
        MonoListAttribute linksCorrelati = (MonoListAttribute) content.getAttribute("LinkCorrelati");
        LinkAttribute linkAttribute = (LinkAttribute) linksCorrelati.addAttribute();
        List<FieldError> errors = content.validate(this._groupManager);
        assertNotNull(errors);
        assertEquals(1, errors.size());
        FieldError error = errors.get(0);
        // Verifica obbligatorietà attributo "Titolo"
        assertEquals("Monolist:Link:LinkCorrelati_0", error.getFieldCode());
        assertEquals(FieldError.INVALID, error.getErrorCode());
        // AGGIUNGO LINK SU PAGINA COACH
        linkAttribute.setText("Descrizione link", "it");
        SymbolicLink symbolicLink = new SymbolicLink();
        // Contenuto di coach
        symbolicLink.setDestinationToContent("EVN103");
        linkAttribute.setSymbolicLink(symbolicLink);
        errors = content.validate(this._groupManager);
        assertNotNull(errors);
        assertEquals(1, errors.size());
        error = errors.get(0);
        assertEquals("Monolist:Link:LinkCorrelati_0", error.getFieldCode());
        assertEquals(ICmsAttributeErrorCodes.INVALID_CONTENT_GROUPS, error.getErrorCode());
    } catch (Throwable t) {
        throw t;
    }
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) FieldError(com.agiletec.aps.system.common.entity.model.FieldError) SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 18 with SymbolicLink

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

the class TestLinkResolverManager method testResolveResourceLink.

public void testResolveResourceLink() throws Throwable {
    SymbolicLink link = new SymbolicLink();
    link.setDestinationToResource("44");
    String text = "The link is: '" + link.getSymbolicDestination() + "'; end";
    String expected = "The link is: '/Entando/resources/cms/images/lvback_d0.jpg'; end";
    String resolvedText = _resolver.resolveLinks(text, null, _reqCtx);
    assertEquals(expected, resolvedText);
    link = new SymbolicLink();
    link.setDestinationToResource("82");
    text = "The second resource link is: '" + link.getSymbolicDestination() + "'; end";
    expected = "The second resource link is: '/Entando/protected/82/0/def/ref/ART122/'; end";
    resolvedText = _resolver.resolveLinks(text, "ART122", _reqCtx);
    assertEquals(expected, resolvedText);
}
Also used : SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 19 with SymbolicLink

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

the class TestLinkResolverManager method testResolveWithNoise.

public void testResolveWithNoise() {
    SymbolicLink link = new SymbolicLink();
    link.setDestinationToContentOnPage("ART1", "homepage");
    String text = "Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_PREFIX + " - Qui c'è un link: ''" + link.getSymbolicDestination() + "'; " + "altro Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_POSTFIX + " fine";
    String expected = "Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_PREFIX + " - Qui c'è un link: ''/Entando/it/homepage.page?contentId=ART1'; " + "altro Trabocchetto: " + SymbolicLink.SYMBOLIC_DEST_POSTFIX + " fine";
    String resolvedText = _resolver.resolveLinks(text, null, _reqCtx);
    assertEquals(expected, resolvedText);
    text = text + text;
    expected = expected + expected;
    resolvedText = _resolver.resolveLinks(text, null, _reqCtx);
    assertEquals(expected, resolvedText);
}
Also used : SymbolicLink(com.agiletec.plugins.jacms.aps.system.services.content.model.SymbolicLink)

Example 20 with SymbolicLink

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

the class TestContentAction method testValidate_2.

public void testValidate_2() throws Throwable {
    String insertedDescr = "XXX Prova Validazione XXX";
    try {
        Content contentForTest = this.getContentManager().loadContent("EVN191", true);
        String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(contentForTest, ApsAdminSystemConstants.EDIT);
        contentForTest.setId(null);
        contentForTest.setDescription(insertedDescr);
        // Valorizzo il gruppo proprietario
        contentForTest.setMainGroup("coach");
        contentForTest.getGroups().add("customers");
        // AGGIUNGO LINK SU PAGINA COACH
        MonoListAttribute linksCorrelati = (MonoListAttribute) contentForTest.getAttribute("LinkCorrelati");
        LinkAttribute linkAttribute = (LinkAttribute) linksCorrelati.addAttribute();
        linkAttribute.setText("Descrizione link", "it");
        SymbolicLink symbolicLink = new SymbolicLink();
        // Contenuto di coach
        symbolicLink.setDestinationToContent("EVN103");
        linkAttribute.setSymbolicLink(symbolicLink);
        this.getRequest().getSession().setAttribute(ContentActionConstants.SESSION_PARAM_NAME_CURRENT_CONTENT_PREXIX + contentOnSessionMarker, contentForTest);
        this.initContentAction("/do/jacms/Content", "save", contentOnSessionMarker);
        this.setUserOnSession("admin");
        String result = this.executeAction();
        assertEquals(Action.INPUT, result);
        ActionSupport action = this.getAction();
        assertEquals(1, action.getFieldErrors().size());
        assertEquals(1, action.getFieldErrors().get("Monolist:Link:LinkCorrelati_0").size());
    } catch (Throwable t) {
        throw t;
    } finally {
        this.removeTestContent(insertedDescr);
    }
}
Also used : LinkAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute) MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionSupport(com.opensymphony.xwork2.ActionSupport) 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