Search in sources :

Example 61 with Content

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

the class TestContentGroupAction method deleteContents.

private void deleteContents(String[] contentIds) throws Throwable {
    for (int i = 0; i < contentIds.length; i++) {
        Content content = this.getContentManager().loadContent(contentIds[i], false);
        if (null != content) {
            this.getContentManager().removeOnLineContent(content);
            this.getContentManager().deleteContent(content);
        }
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content)

Example 62 with Content

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

the class TestContentGroupAction method testInsertOnLineContents_1.

public void testInsertOnLineContents_1() throws Throwable {
    this.setUserOnSession("admin");
    // CONTENUTI FREE
    String[] masterContentIds = { "ART111", "EVN20" };
    String[] newContentIds = null;
    try {
        newContentIds = this.addDraftContentsForTest(masterContentIds, false);
        for (int i = 0; i < newContentIds.length; i++) {
            Content content = this.getContentManager().loadContent(newContentIds[i], false);
            assertFalse(content.isOnLine());
        }
        this.initAction("/do/jacms/Content", "approveContentGroup");
        this.addParameter("contentIds", newContentIds);
        String result = this.executeAction();
        assertEquals(Action.SUCCESS, result);
        for (int i = 0; i < newContentIds.length; i++) {
            Content content = this.getContentManager().loadContent(newContentIds[i], false);
            assertTrue(content.isOnLine());
        }
        ActionSupport action = this.getAction();
        Collection<String> messages = action.getActionMessages();
        assertEquals(1, messages.size());
    } catch (Throwable t) {
        throw t;
    } finally {
        this.deleteContents(newContentIds);
    }
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ActionSupport(com.opensymphony.xwork2.ActionSupport)

Example 63 with Content

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

the class TestIntroNewContentAction method testCreateNewVoid.

public void testCreateNewVoid() throws Throwable {
    String contentTypeCode = "ART";
    Content prototype = this.getContentManager().createContentType(contentTypeCode);
    String contentOnSessionMarker = AbstractContentAction.buildContentOnSessionMarker(prototype, ApsAdminSystemConstants.ADD);
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.setUserOnSession("admin");
    this.addParameter("contentTypeCode", contentTypeCode);
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    Map<String, List<String>> fieldErrors = this.getAction().getFieldErrors();
    assertEquals(2, fieldErrors.size());
    assertEquals(1, fieldErrors.get("contentDescription").size());
    assertEquals(1, fieldErrors.get("contentMainGroup").size());
    Content content = super.getContentOnEdit(contentOnSessionMarker);
    assertNull(content);
    this.initAction("/do/jacms/Content", "createNewVoid");
    this.setUserOnSession("admin");
    this.addParameter("contentTypeCode", contentTypeCode);
    this.addParameter("contentDescription", "Descrizione di prova");
    this.addParameter("contentMainGroup", Group.FREE_GROUP_NAME);
    result = this.executeAction();
    assertEquals(Action.SUCCESS, result);
    content = super.getContentOnEdit(contentOnSessionMarker);
    assertNotNull(content);
    assertEquals(contentTypeCode, content.getTypeCode());
}
Also used : Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) List(java.util.List)

Example 64 with Content

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

the class TestLinkAttributeAction method testChooseLinkType.

public void testChooseLinkType() throws Throwable {
    String contentId = "ART1";
    String contentOnSessionMarker = this.extractSessionMarker(contentId, ApsAdminSystemConstants.EDIT);
    this.executeEdit(contentId, "admin");
    // iniziazione parametri sessione
    HttpSession session = this.getRequest().getSession();
    session.setAttribute(ILinkAttributeActionHelper.ATTRIBUTE_NAME_SESSION_PARAM, "VediAnche");
    session.setAttribute(ILinkAttributeActionHelper.LINK_LANG_CODE_SESSION_PARAM, "it");
    this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
    this.addParameter("linkType", "1");
    String result = this.executeAction();
    assertEquals("configUrlLink", result);
    this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
    this.addParameter("linkType", "2");
    result = this.executeAction();
    assertEquals("configPageLink", result);
    this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
    this.addParameter("linkType", "3");
    result = this.executeAction();
    assertEquals("configContentLink", result);
    Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
    assertNotNull(currentContent);
    assertEquals("ART1", currentContent.getId());
    assertEquals("Articolo", currentContent.getDescription());
}
Also used : HttpSession(javax.servlet.http.HttpSession) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content)

Example 65 with Content

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

the class TestLinkAttributeAction method testFailureChooseLinkType_1.

public void testFailureChooseLinkType_1() throws Throwable {
    String contentId = "ART1";
    String contentOnSessionMarker = this.extractSessionMarker(contentId, ApsAdminSystemConstants.EDIT);
    this.executeEdit(contentId, "admin");
    // iniziazione parametri sessione
    HttpSession session = this.getRequest().getSession();
    session.setAttribute(ILinkAttributeActionHelper.ATTRIBUTE_NAME_SESSION_PARAM, "VediAnche");
    session.setAttribute(ILinkAttributeActionHelper.LINK_LANG_CODE_SESSION_PARAM, "it");
    this.initContentAction("/do/jacms/Content/Link", "configLink", contentOnSessionMarker);
    String result = this.executeAction();
    assertEquals(Action.INPUT, result);
    Map<String, List<String>> fieldErrors = this.getAction().getFieldErrors();
    assertEquals(1, fieldErrors.size());
    List<String> typeFieldErrors = fieldErrors.get("linkType");
    assertEquals(1, typeFieldErrors.size());
    Content currentContent = this.getContentOnEdit(contentOnSessionMarker);
    assertNotNull(currentContent);
    assertEquals("ART1", currentContent.getId());
    assertEquals("Articolo", currentContent.getDescription());
}
Also used : HttpSession(javax.servlet.http.HttpSession) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) List(java.util.List)

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