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());
}
}
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);
}
}
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;
}
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;
}
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);
}
}
Aggregations