use of com.infiniteautomation.mango.rest.latest.model.pointValue.PointValueImportResult in project ma-modules-public by infiniteautomation.
the class PointValueRestController method savePointsValues.
@ApiOperation(value = "Import Point Values for one or many Data Points, this is deprecated and it is recommended to use the /point-value-modification endpoints", notes = "Data Point must exist and user must have write access")
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Collection<PointValueImportResult>> savePointsValues(@ApiParam(value = "Shall data point listeners be notifified, default is NEVER") @RequestParam(defaultValue = "NEVER") FireEvents fireEvents, @RequestBody() List<LegacyXidPointValueTimeModel> models, @AuthenticationPrincipal User user) {
// Map of XIDs to results
Map<String, PointValueImportResult> results = new HashMap<>();
for (LegacyXidPointValueTimeModel model : models) {
PointValueImportResult result = results.get(model.getXid());
if (result == null) {
result = new PointValueImportResult(model.getXid(), dao, dataPointService, fireEvents, user);
results.put(model.getXid(), result);
}
// Attempt to save it
result.saveValue(model);
}
return ResponseEntity.ok(results.values());
}
Aggregations