Search in sources :

Example 1 with ContentDOM

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

the class ContentManagerTest method testGetXML.

@Test
public void testGetXML() throws Throwable {
    String typeCode = "ART";
    // @formatter:off
    when(entityTypeFactory.extractEntityType(typeCode, Content.class, contentManager.getConfigItemName(), this.entityTypeDom, contentManager.getName(), this.entityDom)).thenReturn(this.createFakeEntity(typeCode, "contentview", "1"));
    // @formatter:on
    Content content = contentManager.createContentType(typeCode);
    ContentDOM contentDOM = new ContentDOM();
    contentDOM.setRootElementName("content");
    content.setEntityDOM(contentDOM);
    content.setId("ART1");
    content.setTypeCode("Articolo");
    content.setTypeDescription("Articolo");
    content.setDescription("descrizione");
    content.setStatus(Content.STATUS_DRAFT);
    content.setMainGroup("free");
    Category cat13 = new Category();
    cat13.setCode("13");
    content.addCategory(cat13);
    Category cat19 = new Category();
    cat19.setCode("19");
    content.addCategory(cat19);
    String xml = content.getXML();
    assertNotNull(xml);
    assertTrue(xml.indexOf("<content id=\"ART1\" typecode=\"Articolo\" typedescr=\"Articolo\">") != -1);
    assertTrue(xml.indexOf("<descr>descrizione</descr>") != -1);
    assertTrue(xml.indexOf("<status>" + Content.STATUS_DRAFT + "</status>") != -1);
    assertTrue(xml.indexOf("<category id=\"13\" />") != -1);
    assertTrue(xml.indexOf("<category id=\"19\" />") != -1);
}
Also used : Category(com.agiletec.aps.system.services.category.Category) Content(com.agiletec.plugins.jacms.aps.system.services.content.model.Content) ContentDOM(com.agiletec.plugins.jacms.aps.system.services.content.parse.ContentDOM) Test(org.junit.Test)

Example 2 with ContentDOM

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

the class Content method getBuildJDOM.

@Override
protected IApsEntityDOM getBuildJDOM() {
    ContentDOM contentDOM = (ContentDOM) super.getBuildJDOM();
    contentDOM.setStatus(this.getStatus());
    contentDOM.setVersion(this.getVersion());
    contentDOM.setFirstEditor(this.getFirstEditor());
    contentDOM.setLastEditor(this.getLastEditor());
    contentDOM.setCreationDate(this.getCreated());
    contentDOM.setModifyDate(this.getLastModified());
    return contentDOM;
}
Also used : ContentDOM(com.agiletec.plugins.jacms.aps.system.services.content.parse.ContentDOM)

Aggregations

ContentDOM (com.agiletec.plugins.jacms.aps.system.services.content.parse.ContentDOM)2 Category (com.agiletec.aps.system.services.category.Category)1 Content (com.agiletec.plugins.jacms.aps.system.services.content.model.Content)1 Test (org.junit.Test)1