use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.
the class ContentModelAction method checkModelId.
private void checkModelId() {
if (null == this.getModelId())
return;
ContentModel dummyModel = this.getContentModelManager().getContentModel(this.getModelId());
if (dummyModel != null) {
this.addFieldError("modelId", this.getText("error.contentModel.modelId.alreadyPresent"));
}
SmallContentType utilizer = this.getContentModelManager().getDefaultUtilizer(this.getModelId());
if (null != utilizer && !utilizer.getCode().equals(this.getContentType())) {
String[] args = { this.getModelId().toString(), utilizer.getDescr() };
this.addFieldError("modelId", this.getText("error.contentModel.modelId.wrongUtilizer", args));
}
}
use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.
the class ContentModelAction method delete.
@Override
public String delete() {
try {
String check = this.checkDelete();
if (null != check) {
return check;
}
long modelId = this.getModelId().longValue();
ContentModel model = this.getContentModelManager().getContentModel(modelId);
this.getContentModelManager().removeContentModel(model);
} catch (Throwable t) {
_logger.error("error in delete", t);
// ApsSystemUtils.logThrowable(t, this, "delete");
return FAILURE;
}
return SUCCESS;
}
use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.
the class ContentModelAction method getBeanFromForm.
private ContentModel getBeanFromForm() {
ContentModel contentModel = new ContentModel();
contentModel.setId(this.getModelId());
contentModel.setContentShape(this.getContentShape());
contentModel.setContentType(this.getContentType());
contentModel.setDescription(this.getDescription());
if (null != this.getStylesheet() && this.getStylesheet().trim().length() > 0) {
contentModel.setStylesheet(this.getStylesheet());
}
if (getStrutsAction() == ApsAdminSystemConstants.EDIT) {
contentModel.setId(new Long(this.getModelId()).longValue());
}
return contentModel;
}
use of com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel in project entando-core by entando.
the class ContentModelAction method edit.
@Override
public String edit() {
this.setStrutsAction(ApsAdminSystemConstants.EDIT);
try {
long modelId = this.getModelId().longValue();
ContentModel model = this.getContentModelManager().getContentModel(modelId);
this.setFormValues(model);
} catch (Throwable t) {
_logger.error("error in edit", t);
// ApsSystemUtils.logThrowable(t, this, "edit");
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 testGetRenderedContent_3.
public void testGetRenderedContent_3() throws Throwable {
RequestContext reqCtx = this.getRequestContext();
String contentId = null;
String langCode = "en";
long modelId = -1;
try {
modelId = this.createMockContentModel();
contentId = this.createMockContent();
String renderInfoCacheKey = BaseContentDispenser.getRenderizationInfoCacheKey(contentId, modelId, langCode, reqCtx);
ContentRenderizationInfo outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, langCode, reqCtx);
assertNotNull(outputInfo);
assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
// -----------
ContentModel contentModel = this._contentModelManager.getContentModel(modelId);
contentModel.setDescription("Modified model description");
this._contentModelManager.updateContentModel(contentModel);
super.waitNotifyingThread();
assertNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
// -----------
outputInfo = this._contentDispenser.getRenderizationInfo(contentId, modelId, langCode, reqCtx);
assertNotNull(outputInfo);
assertNotNull(this._cacheInfoManager.getFromCache(ICacheInfoManager.DEFAULT_CACHE_NAME, renderInfoCacheKey));
} catch (Throwable t) {
throw t;
} finally {
this.deleteMockContentObject(contentId, modelId);
}
}
Aggregations