use of com.serotonin.m2m2.vo.template.DataPointPropertiesTemplateVO in project ma-core-public by infiniteautomation.
the class TemplateDwr method updateDataPointsUsingTemplate.
/**
* Update all data points tied to this template.
*
* PRE-The Template must have been validated
*
* @param vo
* @param response
*/
protected void updateDataPointsUsingTemplate(DataPointPropertiesTemplateVO vo, ProcessResult response) {
// Update all data points and let the user know which ones were updated
List<DataPointVO> templatedPoints = DataPointDao.instance.getByTemplate(vo.getId());
List<String> xidsUpdated = new ArrayList<String>();
// Map of XID to why
Map<String, String> failedXidMap = new HashMap<String, String>();
for (DataPointVO templatedPoint : templatedPoints) {
try {
vo.updateDataPointVO(templatedPoint);
Common.runtimeManager.saveDataPoint(templatedPoint);
xidsUpdated.add(templatedPoint.getXid());
} catch (Exception e) {
LOG.error(e.getMessage(), e);
failedXidMap.put(templatedPoint.getXid(), e.getMessage());
response.addMessage(new TranslatableMessage("common.default", e.getMessage()));
}
}
response.addData("updatedXids", xidsUpdated);
response.addData("failedXids", failedXidMap);
}
Aggregations