use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class BaseDwr method forcePointRead.
@DwrPermission(user = true)
public void forcePointRead(int pointId) {
User user = Common.getUser();
DataPointVO point = DataPointDao.instance.getDataPoint(pointId, false);
// Check permissions.
Permissions.ensureDataPointReadPermission(user, point);
Common.runtimeManager.forcePointRead(pointId);
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class BaseDwr method setChart.
protected static void setChart(DataPointVO point, BasePointState state, HttpServletRequest request, Map<String, Object> model) {
ChartRenderer chartRenderer = point.getChartRenderer();
if (chartRenderer != null) {
chartRenderer.addDataToModel(model, point);
String snippet = chartRenderer.getChartSnippetFilename();
state.setChart(generateContent(request, snippet, model));
}
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class BaseDwr method setEvents.
protected static void setEvents(DataPointVO pointVO, User user, Map<String, Object> model, int limit) {
int userId = 0;
if (user != null)
userId = user.getId();
List<EventInstance> userEvents = Common.eventManager.getAllActiveUserEvents(userId);
// EVENT_DAO.getPendingEventsForDataPoint(pointVO.getId(), userId);
// Fill the list in reverse order so the latest is first
List<EventInstance> list = null;
if (userEvents.size() > 0) {
for (int i = userEvents.size() - 1; i >= 0; i--) {
EventInstance e = userEvents.get(i);
if (e.getEventType().getDataPointId() == pointVO.getId()) {
if (list == null)
list = new ArrayList<EventInstance>();
list.add(e);
if (list.size() == limit)
break;
}
}
}
if (list != null) {
model.put(MODEL_ATTR_EVENTS, list);
for (EventInstance event : list) {
if (!event.isAcknowledged()) {
model.put(MODEL_ATTR_HAS_UNACKED_EVENT, true);
break;
}
}
}
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class DataPointDetailsDwr method getStatsChartData.
@DwrPermission(user = true)
public ProcessResult getStatsChartData(int periodType, int period, boolean includeSum) {
HttpServletRequest request = WebContextFactory.get().getHttpServletRequest();
DataPointVO pointVO = Common.getUser(request).getEditPoint();
Map<String, Object> model = new HashMap<String, Object>();
model.put("point", pointVO);
StatisticsChartRenderer r = new StatisticsChartRenderer(periodType, period, includeSum);
r.addDataToModel(model, pointVO);
ProcessResult response = new ProcessResult();
response.addData("stats", generateContent(request, "statsChart.jsp", model));
addAsof(response);
return response;
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class DataPointDwr method enableDisable.
@DwrPermission(user = true)
public ProcessResult enableDisable(int dataPointId, boolean enabled) {
DataPointVO dataPoint = DataPointDao.instance.getDataPoint(dataPointId, false);
Permissions.ensureDataSourcePermission(Common.getUser(), dataPoint.getDataSourceId());
if (enabled)
DataPointDao.instance.setEventDetectors(dataPoint);
Common.runtimeManager.enableDataPoint(dataPoint, enabled);
ProcessResult response = new ProcessResult();
response.addData("id", dataPointId);
response.addData("enabled", dataPoint.isEnabled());
return response;
}
Aggregations