use of com.infiniteautomation.mango.rest.v2.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", notes = "Data Point must exist and user must have write access")
@RequestMapping(method = RequestMethod.POST)
public ResponseEntity<Collection<PointValueImportResult>> savePointsValues(HttpServletRequest request, @RequestBody(required = true) List<XidPointValueTimeModel> models, @AuthenticationPrincipal User user) {
// Map of XIDs to results
Map<String, PointValueImportResult> results = new HashMap<String, PointValueImportResult>();
for (XidPointValueTimeModel model : models) {
PointValueImportResult result = results.get(model.getXid());
if (result == null) {
result = new PointValueImportResult(model.getXid(), dao, user);
results.put(model.getXid(), result);
}
// Attempt to save it
result.saveValue(model);
}
return ResponseEntity.ok(results.values());
}
Aggregations