Search in sources :

Example 11 with ContentModel

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));
    }
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel) SmallContentType(com.agiletec.plugins.jacms.aps.system.services.content.model.SmallContentType)

Example 12 with ContentModel

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;
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Example 13 with ContentModel

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;
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Example 14 with 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;
}
Also used : ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel)

Example 15 with ContentModel

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);
    }
}
Also used : ContentRenderizationInfo(com.agiletec.plugins.jacms.aps.system.services.dispenser.ContentRenderizationInfo) ContentModel(com.agiletec.plugins.jacms.aps.system.services.contentmodel.ContentModel) RequestContext(com.agiletec.aps.system.RequestContext)

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