use of com.serotonin.m2m2.rt.dataSource.DataSourceRT in project ma-core-public by infiniteautomation.
the class RuntimeManagerScriptUtility method refreshDataPoint.
/**
* Refresh a data point with the given XID.
*
* @param xid
* @return status of operation
* 0 - Point not enabled
* -1 - Point does not exist
* 1 - Refresh performed
*/
public int refreshDataPoint(String xid) {
DataPointVO vo = DataPointDao.instance.getByXid(xid);
if (vo != null) {
if (!vo.isEnabled())
return OPERATION_NO_CHANGE;
DataSourceRT<?> dsRt = Common.runtimeManager.getRunningDataSource(vo.getDataSourceId());
if (dsRt == null || !Permissions.hasDataSourcePermission(permissions.getDataSourcePermissions(), dsRt.getVo()))
return OPERATION_NO_CHANGE;
Common.runtimeManager.forcePointRead(vo.getId());
return OPERATION_SUCCESSFUL;
} else
return DOES_NOT_EXIST;
}
Aggregations