use of com.infiniteautomation.mango.rest.latest.model.MaintenanceEventModel in project ma-modules-public by infiniteautomation.
the class MaintenanceEventsRestController method getForSourcesByXid.
@ApiOperation(value = "Find Maintenance Events linked to data sources by source XIDs", notes = "Returns a map of source xids to a list of events that have this data source in thier list", response = Map.class, responseContainer = "List")
@RequestMapping(method = RequestMethod.GET, value = "/query/get-for-sources-by-xids/{sourceXids}")
public Map<String, List<MaintenanceEventModel>> getForSourcesByXid(@PathVariable(required = true) List<String> sourceXids, HttpServletRequest request, @AuthenticationPrincipal PermissionHolder user) {
Map<String, List<MaintenanceEventModel>> map = new HashMap<>();
for (String xid : sourceXids) {
List<MaintenanceEventModel> models = new ArrayList<>();
map.put(xid, models);
if (xid != null) {
dao.getForDataSource(xid, new Consumer<MaintenanceEventVO>() {
@Override
public void accept(MaintenanceEventVO vo) {
MaintenanceEventModel model = new MaintenanceEventModel(vo);
fillDataPoints(model);
fillDataSources(model);
models.add(model);
}
});
}
}
return map;
}
use of com.infiniteautomation.mango.rest.latest.model.MaintenanceEventModel in project ma-modules-public by infiniteautomation.
the class MaintenanceEventsRestController method getForSourcesByIds.
@ApiOperation(value = "Find Maintenance Events linked to data sources by source IDs", notes = "Returns a map of source ids to a list of events that have this data source in thier list", response = Map.class, responseContainer = "List")
@RequestMapping(method = RequestMethod.GET, value = "/query/get-for-sources-by-ids/{sourceIds}")
public Map<Integer, List<MaintenanceEventModel>> getForSourcesByIds(@PathVariable(required = true) List<Integer> sourceIds, HttpServletRequest request, @AuthenticationPrincipal PermissionHolder user) {
Map<Integer, List<MaintenanceEventModel>> map = new HashMap<>();
for (Integer id : sourceIds) {
List<MaintenanceEventModel> models = new ArrayList<>();
map.put(id, models);
dao.getForDataSource(id, new Consumer<MaintenanceEventVO>() {
@Override
public void accept(MaintenanceEventVO vo) {
MaintenanceEventModel model = new MaintenanceEventModel(vo);
fillDataPoints(model);
fillDataSources(model);
models.add(model);
}
});
}
return map;
}
Aggregations