Search in sources :

Example 16 with DataObjectModel

use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.

the class DataObjectModelCacheWrapper method initCache.

@Override
public void initCache(IDataObjectModelDAO dataObjectModelDAO) throws ApsSystemException {
    try {
        Cache cache = this.getCache();
        this.releaseCachedObjects(cache);
        Map<String, DataObjectModel> modelsMap = this.getModelsMap(dataObjectModelDAO);
        super.insertObjectsOnCache(cache, modelsMap);
    } catch (Throwable t) {
        logger.error("Error bootstrapping data object models map cache", t);
        throw new ApsSystemException("Error bootstrapping data object models map cache", t);
    }
}
Also used : DataObjectModel(org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel) ApsSystemException(com.agiletec.aps.system.exception.ApsSystemException) Cache(org.springframework.cache.Cache)

Example 17 with DataObjectModel

use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.

the class TestDataObjectDispenser method testGetRenderedContent_4.

public void testGetRenderedContent_4() throws Throwable {
    String dataobjectId = "ART120";
    String dataobjectShapeModel = "title (Text): testo=$data.Titolo.getText()";
    int modelId = 1972;
    try {
        this.addNewDataObjectModel(modelId, dataobjectShapeModel, "ART");
        RequestContext reqCtx = this.getRequestContext();
        this.setUserOnSession("admin");
        DataObjectRenderizationInfo outputInfo = this._dataObjectDispenser.getRenderizationInfo(dataobjectId, modelId, "en", reqCtx);
        assertEquals("title (Text): testo=Title of Administrator's Content", outputInfo.getRenderedDataobject());
        DataObjectModel model = this._dataObjectModelManager.getDataObjectModel(modelId);
        String newContentShapeModel = "title: testo=$data.Titolo.getText()";
        model.setShape(newContentShapeModel);
        this._dataObjectModelManager.updateDataObjectModel(model);
        this.waitNotifyingThread();
        outputInfo = this._dataObjectDispenser.getRenderizationInfo(dataobjectId, modelId, "en", reqCtx);
        assertEquals("title: testo=Title of Administrator's Content", outputInfo.getRenderedDataobject());
    } catch (Throwable t) {
        throw t;
    } finally {
        DataObjectModel model = this._dataObjectModelManager.getDataObjectModel(modelId);
        if (null != model) {
            this._dataObjectModelManager.removeDataObjectModel(model);
        }
    }
}
Also used : DataObjectRenderizationInfo(org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo) DataObjectModel(org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel) RequestContext(com.agiletec.aps.system.RequestContext)

Example 18 with DataObjectModel

use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.

the class TestDataObjectDispenser method addNewDataObjectModel.

public void addNewDataObjectModel(int id, String shape, String dataTypeCode) throws Throwable {
    DataObjectModel model = new DataObjectModel();
    model.setDataType(dataTypeCode);
    model.setDescription("test");
    model.setId(id);
    model.setShape(shape);
    this._dataObjectModelManager.addDataObjectModel(model);
}
Also used : DataObjectModel(org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel)

Example 19 with DataObjectModel

use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.

the class DataObjectModelAction method checkModelId.

private void checkModelId() {
    if (null == this.getModelId()) {
        return;
    }
    DataObjectModel dummyModel = this.getDataObjectModelManager().getDataObjectModel(this.getModelId());
    if (dummyModel != null) {
        this.addFieldError("modelId", this.getText("error.dataObjectModel.modelId.alreadyPresent"));
    }
    SmallDataType utilizer = this.getDataObjectModelManager().getDefaultUtilizer(this.getModelId());
    if (null != utilizer && !utilizer.getCode().equals(this.getDataType())) {
        String[] args = { this.getModelId().toString(), utilizer.getDescr() };
        this.addFieldError("modelId", this.getText("error.dataObjectModel.modelId.wrongUtilizer", args));
    }
}
Also used : SmallDataType(org.entando.entando.aps.system.services.dataobject.model.SmallDataType) DataObjectModel(org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel)

Example 20 with DataObjectModel

use of org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel in project entando-core by entando.

the class DataObjectModelAction method edit.

public String edit() {
    this.setStrutsAction(ApsAdminSystemConstants.EDIT);
    try {
        long modelId = this.getModelId().longValue();
        DataObjectModel model = this.getDataObjectModelManager().getDataObjectModel(modelId);
        this.setFormValues(model);
    } catch (Throwable t) {
        _logger.error("error in edit", t);
        // ApsSystemUtils.logThrowable(t, this, "edit");
        return FAILURE;
    }
    return SUCCESS;
}
Also used : DataObjectModel(org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel)

Aggregations

DataObjectModel (org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel)24 ApsSystemException (com.agiletec.aps.system.exception.ApsSystemException)4 ApiError (org.entando.entando.aps.system.services.api.model.ApiError)2 ApiException (org.entando.entando.aps.system.services.api.model.ApiException)2 RequestContext (com.agiletec.aps.system.RequestContext)1 IApsEntity (com.agiletec.aps.system.common.entity.model.IApsEntity)1 ArrayList (java.util.ArrayList)1 List (java.util.List)1 StringListApiResponse (org.entando.entando.aps.system.services.api.model.StringListApiResponse)1 SmallDataType (org.entando.entando.aps.system.services.dataobject.model.SmallDataType)1 DataObjectRenderizationInfo (org.entando.entando.aps.system.services.dataobjectdispenser.DataObjectRenderizationInfo)1 Cache (org.springframework.cache.Cache)1