use of org.entando.entando.aps.system.services.dataobject.model.DataObject 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.DataObject in project entando-core by entando.
the class IndexLoaderThread method reloadContentIndex.
private void reloadContentIndex(String id) {
try {
DataObject dataObject = this._dataObjectManager.loadDataObject(id, true, false);
if (dataObject != null) {
this._indexerDao.add(dataObject);
_logger.debug("Indexed DataObject {}", dataObject.getId());
}
} catch (Throwable t) {
_logger.error("Error reloading index: DataObject id {}", id, t);
}
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestDataObjectManager method testCreateDataObjectWithDefaultModel.
public void testCreateDataObjectWithDefaultModel() {
DataObject dataObject = _dataObjectManager.createDataObject("ART");
String defaultModel = dataObject.getDefaultModel();
assertEquals(defaultModel, "1");
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestValidateDataObject method createNewVoid.
private DataObject createNewVoid(String contentType, String insertedDescr, String status, String mainGroup, String lastEditor) {
DataObject content = this._contentManager.createDataObject(contentType);
content.setDescription(insertedDescr);
content.setStatus(status);
content.setMainGroup(mainGroup);
content.setLastEditor(lastEditor);
return content;
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestValidateDataObject method testValidate_1.
public void testValidate_1() throws Throwable {
String insertedDescr = "XXX Prova Validazione XXX";
try {
DataObject content = this.createNewVoid("ART", insertedDescr, DataObject.STATUS_DRAFT, Group.FREE_GROUP_NAME, "admin");
List<FieldError> errors = content.validate(this._groupManager);
assertNotNull(errors);
assertEquals(1, errors.size());
FieldError error = errors.get(0);
// Verifica obbligatorietĂ attributo "Titolo"
assertEquals("Text:it_Titolo", error.getFieldCode());
assertEquals(FieldError.MANDATORY, error.getErrorCode());
String monolistAttributeName = "Autori";
MonoListAttribute monolist = (MonoListAttribute) content.getAttribute(monolistAttributeName);
monolist.addAttribute();
assertEquals(1, monolist.getAttributes().size());
errors = content.validate(this._groupManager);
assertEquals(2, errors.size());
error = errors.get(0);
// Verifica obbligatorietĂ attributo "Titolo"
assertEquals("Text:it_Titolo", error.getFieldCode());
assertEquals(FieldError.MANDATORY, error.getErrorCode());
error = errors.get(1);
// Verifica non valido elemento 1 in attributo lista "Autori"
assertEquals("Monolist:Monotext:Autori_0", error.getFieldCode());
assertEquals(FieldError.INVALID, error.getErrorCode());
} catch (Throwable t) {
throw t;
}
}
Aggregations