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