use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestDataObjectManager method testGetXML.
public void testGetXML() throws Throwable {
DataObject dataObject = this._dataObjectManager.createDataObject("ART");
dataObject.setId("ART1");
dataObject.setTypeCode("Articolo");
dataObject.setTypeDescription("Articolo");
dataObject.setDescription("descrizione");
dataObject.setStatus(DataObject.STATUS_DRAFT);
dataObject.setMainGroup("free");
Category cat13 = new Category();
cat13.setCode("13");
dataObject.addCategory(cat13);
Category cat19 = new Category();
cat19.setCode("19");
dataObject.addCategory(cat19);
String xml = dataObject.getXML();
assertNotNull(xml);
assertTrue(xml.indexOf("<dataObject id=\"ART1\" typecode=\"Articolo\" typedescr=\"Articolo\">") != -1);
assertTrue(xml.indexOf("<descr>descrizione</descr>") != -1);
assertTrue(xml.indexOf("<status>" + DataObject.STATUS_DRAFT + "</status>") != -1);
assertTrue(xml.indexOf("<category id=\"13\" />") != -1);
assertTrue(xml.indexOf("<category id=\"19\" />") != -1);
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestDataObjectManager method deleteDataObjects.
private void deleteDataObjects(String[] dataObjectIds) throws Throwable {
for (int i = 0; i < dataObjectIds.length; i++) {
DataObject dataObject = this._dataObjectManager.loadDataObject(dataObjectIds[i], false);
if (null != dataObject) {
this._dataObjectManager.removeDataObject(dataObject);
this._dataObjectManager.deleteDataObject(dataObject);
}
}
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class TestDataObjectManager method testCreateDataObjectWithViewPage.
public void testCreateDataObjectWithViewPage() {
DataObject dataObject = _dataObjectManager.createDataObject("ART");
String viewPage = dataObject.getViewPage();
assertEquals(viewPage, "dataObjectview");
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class ListAttributeAction method updateDataOnSession.
protected DataObject updateDataOnSession() {
DataObject content = this.getData();
this.getDataObjectActionHelper().updateEntity(content, this.getRequest());
return content;
}
use of org.entando.entando.aps.system.services.dataobject.model.DataObject in project entando-core by entando.
the class DataObjectActionHelper method scanEntity.
@Override
public void scanEntity(IApsEntity entity, ActionSupport action) {
DataObject dataObject = (DataObject) entity;
if (null == dataObject) {
_logger.error("Null DataObject");
return;
}
String descr = dataObject.getDescription();
if (descr == null || descr.length() == 0) {
action.addFieldError("descr", action.getText("error.dataobject.descr.required"));
} else {
int maxLength = 250;
if (descr.length() > maxLength) {
String[] args = { String.valueOf(maxLength) };
action.addFieldError("descr", action.getText("error.dataobject.descr.wrongMaxLength", args));
}
if (!descr.matches("([^\"])+")) {
action.addFieldError("descr", action.getText("error.dataobject.descr.wrongCharacters"));
}
}
if (null == dataObject.getId() && (dataObject.getMainGroup() == null || dataObject.getMainGroup().length() == 0)) {
action.addFieldError("mainGroup", action.getText("error.dataobject.mainGroup.required"));
}
try {
super.scanEntity(dataObject, action);
} catch (Throwable t) {
_logger.error("DataObjectActionHelper - scanEntity", t);
throw new RuntimeException("Error checking entity", t);
}
}
Aggregations