Search in sources :

Example 71 with Content

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

the class TestListAttributeAction method testAddListElement.

public void testAddListElement() throws Throwable {
    String contentOnSessionMarker = this.initEditContent();
    this.initContentAction("/do/jacms/Content", "addListElement", contentOnSessionMarker);
    this.addParameter("attributeName", "Autori");
    this.addParameter("listLangCode", "it");
    String result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
    MonoListAttribute monoListAttribute = (MonoListAttribute) currentContent.getAttribute("Autori");
    List<AttributeInterface> attributes = monoListAttribute.getAttributes();
    String[] expected = { "Pippo", "Paperino", "Pluto", "" };
    this.verifyText(attributes, expected);
}
Also used : MonoListAttribute(com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) AttributeInterface(com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)

Example 72 with Content

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

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

the class TestResourceAttributeAction method testRemoveImageResource_1.

public void testRemoveImageResource_1() throws Throwable {
    String contentOnSessionMarker = this.initForImageRemovingTest();
    this.initContentAction("/do/jacms/Content", "removeResource", contentOnSessionMarker);
    this.addParameter("attributeName", "Foto");
    this.addParameter("resourceTypeCode", "Image");
    this.addParameter("resourceLangCode", "it");
    assertEquals(Action.SUCCESS, this.executeAction());
    Content contentOnEdit = this.getContentOnEdit(contentOnSessionMarker);
    ImageAttribute imageAttribute = (ImageAttribute) contentOnEdit.getAttribute("Foto");
    assertNull(imageAttribute.getResource("it"));
    assertNull(imageAttribute.getResource("en"));
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ImageAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ImageAttribute)

Example 74 with Content

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

the class TestResourceAttributeAction method testRemoveImageResource_2.

public void testRemoveImageResource_2() throws Throwable {
    String contentOnSessionMarker = this.initForImageRemovingTest();
    this.initContentAction("/do/jacms/Content", "removeResource", contentOnSessionMarker);
    this.addParameter("attributeName", "Foto");
    this.addParameter("resourceTypeCode", "Image");
    this.addParameter("resourceLangCode", "en");
    assertEquals(Action.SUCCESS, this.executeAction());
    Content contentOnEdit = this.getContentOnEdit(contentOnSessionMarker);
    ImageAttribute imageAttribute = (ImageAttribute) contentOnEdit.getAttribute("Foto");
    assertNotNull(imageAttribute.getResource("it"));
    assertEquals("44", imageAttribute.getResource("it").getId());
    assertNull(imageAttribute.getResource("en"));
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ImageAttribute(com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.ImageAttribute)

Example 75 with Content

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

the class TestUrlLinkAction method initJoinLinkTest.

private String initJoinLinkTest(String contentId, String simpleLinkAttributeName, String langCode) throws Throwable {
    Content content = this.getContentManager().loadContent(contentId, false);
    this.executeEdit(contentId, "admin");
    String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(content, ApsAdminSystemConstants.EDIT);
    // iniziazione parametri sessione
    HttpSession session = this.getRequest().getSession();
    session.setAttribute(ILinkAttributeActionHelper.ATTRIBUTE_NAME_SESSION_PARAM, simpleLinkAttributeName);
    session.setAttribute(ILinkAttributeActionHelper.LINK_LANG_CODE_SESSION_PARAM, langCode);
    return contentOnSessionMarker;
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) HttpSession(javax.servlet.http.HttpSession)

Aggregations

Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)227 AttributeInterface (com.agiletec.aps.system.common.entity.model.attribute.AttributeInterface)55 AttributeTracer (com.agiletec.aps.system.common.entity.model.AttributeTracer)35 MonoListAttribute (com.agiletec.aps.system.common.entity.model.attribute.MonoListAttribute)29 ArrayList (java.util.ArrayList)26 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)17 ActionSupport (com.opensymphony.xwork2.ActionSupport)14 List (java.util.List)14 CompositeAttribute (com.agiletec.aps.system.common.entity.model.attribute.CompositeAttribute)13 HttpSession (javax.servlet.http.HttpSession)13 UserDetails (com.agiletec.aps.system.services.user.UserDetails)12 IPage (com.agiletec.aps.system.services.page.IPage)10 Date (java.util.Date)8 EntitySearchFilter (com.agiletec.aps.system.common.entity.model.EntitySearchFilter)7 ITextAttribute (com.agiletec.aps.system.common.entity.model.attribute.ITextAttribute)7 LinkAttribute (com.agiletec.plugins.jacms.aps.system.services.content.model.extraAttribute.LinkAttribute)7 ResourceInterface (com.agiletec.plugins.jacms.aps.system.services.resource.model.ResourceInterface)7 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)7 ListAttribute (com.agiletec.aps.system.common.entity.model.attribute.ListAttribute)6 TextAttribute (com.agiletec.aps.system.common.entity.model.attribute.TextAttribute)6