Search in sources :

Example 21 with ContentModel

use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.

the class TestContentModelAction method testAddNewModel.

public void testAddNewModel() throws Throwable {
    List<ContentModel> eventModels = this._contentModelManager.getModelsForContentType("EVN");
    assertEquals(0, eventModels.size());
    long modelIdToAdd = 99;
    try {
        this.setUserOnSession("admin");
        this.initAction("/do/jacms/ContentModel", "save");
        addParameter("contentType", "EVN");
        addParameter("strutsAction", new Integer(ApsAdminSystemConstants.ADD).toString());
        addParameter("description", "contentModel description");
        addParameter("contentShape", "contentShape field value\r\n");
        addParameter("modelId", String.valueOf(modelIdToAdd));
        String result = this.executeAction();
        assertEquals(Action.SUCCESS, result);
        eventModels = this._contentModelManager.getModelsForContentType("EVN");
        assertEquals(1, eventModels.size());
        ContentModel model = eventModels.get(0);
        assertEquals("contentShape field value\r\n", model.getContentShape());
    } catch (Throwable t) {
        throw t;
    } finally {
        ContentModel model = this._contentModelManager.getContentModel(modelIdToAdd);
        if (null != model) {
            this._contentModelManager.removeContentModel(model);
        }
        eventModels = this._contentModelManager.getModelsForContentType("EVN");
        assertEquals(0, eventModels.size());
    }
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Example 22 with ContentModel

use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.

the class TestContentModelFinderAction method tearDown.

@Override
protected void tearDown() throws Exception {
    super.tearDown();
    ContentModel model = this._contentModelManager.getContentModel(MODEL_ID);
    if (null != model) {
        this._contentModelManager.removeContentModel(model);
    }
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Example 23 with ContentModel

use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.

the class TestContentModelFinderAction method createContentModel.

private ContentModel createContentModel(int id, String contentType) {
    ContentModel model = new ContentModel();
    model.setId(id);
    model.setContentType(contentType);
    model.setDescription("Event test Model");
    model.setContentShape("test shape");
    return model;
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Example 24 with ContentModel

use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.

the class ContentModelAction method trash.

@Override
public String trash() {
    try {
        String check = this.checkDelete();
        if (null != check) {
            return check;
        }
        long modelId = this.getModelId().longValue();
        ContentModel model = this.getContentModelManager().getContentModel(modelId);
        if (null != model) {
            this.setDescription(model.getDescription());
            this.setContentType(model.getContentType());
        } else {
            return "noModel";
        }
    } catch (Throwable t) {
        _logger.error("error in trash", t);
        // ApsSystemUtils.logThrowable(t, this, "trash");
        return FAILURE;
    }
    return SUCCESS;
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Example 25 with ContentModel

use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.

the class TestCacheInfoManager method deleteMockContentObject.

protected void deleteMockContentObject(String contentId, long modelId) throws Throwable {
    this.deleteMockContent(contentId);
    ContentModel contentModel = this._contentModelManager.getContentModel(modelId);
    if (null != contentModel) {
        this._contentModelManager.removeContentModel(contentModel);
    }
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Aggregations

ContentModel (com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)27 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)3 RequestContext (com.agiletec.aps.system.RequestContext)2 ApiError (org.entando.entando.aps.system.services.api.model.ApiError)2 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)2 SmallContentType (com.agiletec.plugins.jacms.aps.system.services.content.model.SmallContentType)1 ContentRenderizationInfo (com.agiletec.plugins.jacms.aps.system.services.dispenser.ContentRenderizationInfo)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 StringListApiResponse (org.entando.entando.aps.system.services.api.model.StringListApiResponse)1 Cache (org.springframework.cache.Cache)1