Search in sources :

Example 1 with SmallDataType

use of org.entando.entando.aps.system.services.dataobject.model.SmallDataType in project entando-core by entando.

the class DataObjectModelManagerIntegrationTest method testGetTypeUtilizer.

public void testGetTypeUtilizer() throws Throwable {
    SmallDataType utilizer = this.dataModelManager.getDefaultUtilizer(1);
    assertNotNull(utilizer);
    assertEquals("ART", utilizer.getCode());
    utilizer = this.dataModelManager.getDefaultUtilizer(11);
    assertNotNull(utilizer);
    assertEquals("ART", utilizer.getCode());
    utilizer = this.dataModelManager.getDefaultUtilizer(126);
    assertNotNull(utilizer);
    assertEquals("RAH", utilizer.getCode());
}
Also used : SmallDataType(org.entando.entando.aps.system.services.dataobject.model.SmallDataType)

Example 2 with SmallDataType

use of org.entando.entando.aps.system.services.dataobject.model.SmallDataType in project entando-core by entando.

the class DataObjectManager method getSmallDataTypesMap.

/**
 * Return the map of the prototypes of the dataobjects types. Return a map,
 * index by the code of the type, of the prototypes of the available
 * dataobject types.
 *
 * @return The map of the prototypes of the dataobject types in a
 * 'SmallDataObjectType' objects.
 */
@Override
public Map<String, SmallDataType> getSmallDataTypesMap() {
    Map<String, SmallDataType> smallDataTypes = new HashMap<>();
    List<SmallEntityType> entityTypes = super.getSmallEntityTypes();
    for (SmallEntityType entityType : entityTypes) {
        SmallDataType sdt = new SmallDataType();
        sdt.setCode(entityType.getCode());
        sdt.setDescription(entityType.getDescription());
        smallDataTypes.put(entityType.getCode(), sdt);
    }
    return smallDataTypes;
}
Also used : SmallDataType(org.entando.entando.aps.system.services.dataobject.model.SmallDataType) HashMap(java.util.HashMap) SmallEntityType(com.agiletec.aps.system.common.entity.model.SmallEntityType)

Example 3 with SmallDataType

use of org.entando.entando.aps.system.services.dataobject.model.SmallDataType in project entando-core by entando.

the class DataObjectModelManager method getDefaultUtilizer.

@Override
public SmallDataType getDefaultUtilizer(long modelId) {
    String modelIdString = String.valueOf(modelId);
    List<SmallDataType> smallDataTypes = this.getDataObjectManager().getSmallDataTypes();
    for (SmallDataType smallDataType : smallDataTypes) {
        DataObject prototype = this.getDataObjectManager().createDataObject(smallDataType.getCode());
        if ((null != prototype.getListModel() && prototype.getListModel().equals(modelIdString)) || (null != prototype.getDefaultModel() && prototype.getDefaultModel().equals(modelIdString))) {
            return smallDataType;
        }
    }
    return null;
}
Also used : DataObject(org.entando.entando.aps.system.services.dataobject.model.DataObject) SmallDataType(org.entando.entando.aps.system.services.dataobject.model.SmallDataType)

Example 4 with SmallDataType

use of org.entando.entando.aps.system.services.dataobject.model.SmallDataType 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)

Aggregations

SmallDataType (org.entando.entando.aps.system.services.dataobject.model.SmallDataType)4 SmallEntityType (com.agiletec.aps.system.common.entity.model.SmallEntityType)1 HashMap (java.util.HashMap)1 DataObject (org.entando.entando.aps.system.services.dataobject.model.DataObject)1 DataObjectModel (org.entando.entando.aps.system.services.dataobjectmodel.DataObjectModel)1