use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestSearchEngineManager method testSearchContentsId_3.
public void testSearchContentsId_3() throws Throwable {
try {
DataObject content_1 = this.createDataObject_1();
content_1.setMainGroup(Group.ADMINS_GROUP_NAME);
this.dataObjectSearchEngineManager.deleteIndexedEntity(content_1.getId());
this.dataObjectSearchEngineManager.addEntityToIndex(content_1);
DataObject content_2 = this.createDataObject_2();
this.dataObjectSearchEngineManager.deleteIndexedEntity(content_2.getId());
this.dataObjectSearchEngineManager.addEntityToIndex(content_2);
List<String> allowedGroup = new ArrayList<String>();
allowedGroup.add(Group.FREE_GROUP_NAME);
List<String> contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", allowedGroup);
assertNotNull(contentsId);
assertFalse(contentsId.contains(content_1.getId()));
allowedGroup.add("secondaryGroup");
contentsId = this.dataObjectSearchEngineManager.searchEntityId("it", "San meravigliosa", allowedGroup);
assertNotNull(contentsId);
assertTrue(contentsId.contains(content_1.getId()));
} catch (Throwable t) {
throw t;
}
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectManager method createDataObject.
protected DataObject createDataObject(DataObjectRecordVO dataobjectVo, boolean onLine) throws ApsSystemException {
DataObject dataobject = null;
try {
if (dataobjectVo != null) {
String xmlData;
if (onLine) {
xmlData = dataobjectVo.getXmlOnLine();
} else {
xmlData = dataobjectVo.getXmlWork();
}
if (xmlData != null) {
dataobject = (DataObject) this.createEntityFromXml(dataobjectVo.getTypeCode(), xmlData);
dataobject.setId(dataobjectVo.getId());
dataobject.setTypeCode(dataobjectVo.getTypeCode());
dataobject.setDescription(dataobjectVo.getDescription());
dataobject.setOnLine(dataobjectVo.isOnLine());
dataobject.setMainGroup(dataobjectVo.getMainGroupCode());
if (null == dataobject.getVersion()) {
dataobject.setVersion(dataobjectVo.getVersion());
}
if (null == dataobject.getFirstEditor()) {
dataobject.setFirstEditor(dataobjectVo.getFirstEditor());
}
if (null == dataobject.getLastEditor()) {
dataobject.setLastEditor(dataobjectVo.getLastEditor());
}
if (null == dataobject.getCreated()) {
dataobject.setCreated(dataobjectVo.getCreate());
}
if (null == dataobject.getLastModified()) {
dataobject.setLastModified(dataobjectVo.getModify());
}
if (null == dataobject.getStatus()) {
dataobject.setStatus(dataobjectVo.getStatus());
}
}
}
} catch (ApsSystemException e) {
logger.error("Error while creating dataobject by vo", e);
throw new ApsSystemException("Error while creating dataobject by vo", e);
}
return dataobject;
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectManager method reloadEntityReferences.
@Override
public void reloadEntityReferences(String entityId) {
try {
DataObjectRecordVO dataobjectVo = this.loadDataObjectVO(entityId);
DataObject dataobject = this.createDataObject(dataobjectVo, true);
if (dataobject != null) {
this.getDataObjectDAO().reloadDataObjectReferences(dataobject);
}
logger.debug("Reloaded dataobject references for dataobject {}", entityId);
} catch (Throwable t) {
logger.error("Error while reloading dataobject references for dataobject {}", entityId, t);
}
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectManager method getTypeById.
/**
* Return the dataobject type from the given ID code. The code is extracted
* following the coding conventions: the first three characters are the type
* of the code.
*
* @param dataId the dataobject ID whose dataobject type is extracted.
* @return The dataobject type requested
*/
private DataObject getTypeById(String dataId) {
String typeCode = dataId.substring(0, 3);
DataObject type = (DataObject) super.getEntityTypes().get(typeCode);
return type;
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectService method createEntityType.
@Override
protected DataObject createEntityType(IEntityManager entityManager, EntityTypeDtoRequest dto, BindingResult bindingResult) throws Throwable {
DataObject dataObject = super.createEntityType(entityManager, dto, bindingResult);
DataTypeDtoRequest dtr = (DataTypeDtoRequest) dto;
if (this.checkModel(false, dataObject.getTypeCode(), dtr.getListModel(), bindingResult)) {
dataObject.setListModel(dtr.getListModel());
}
if (this.checkModel(true, dataObject.getTypeCode(), dtr.getDefaultModel(), bindingResult)) {
dataObject.setDefaultModel(dtr.getDefaultModel());
}
if (this.checkPage(dataObject.getTypeCode(), dtr.getViewPage(), bindingResult)) {
dataObject.setViewPage(dtr.getViewPage());
}
return dataObject;
}
Aggregations