use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class DataPointDwr method storeEditLoggingProperties.
/**
* Store the logging properties into the
* current user's edit point.
*
* This is still being used on the page, but could be brought forward by putting the logging properties
* into the DWR system
*
* @param type
* @param period
* @param periodType
* @param intervalType
* @param tolerance
* @param discardExtremeValues
* @param discardHighLimit
* @param discardLowLimit
* @param purgeOverride
* @param purgeType
* @param purgePeriod
* @param defaultCacheSize
*/
@DwrPermission(user = true)
public void storeEditLoggingProperties(int type, int period, int periodType, int intervalType, double tolerance, boolean discardExtremeValues, double discardHighLimit, double discardLowLimit, boolean purgeOverride, int purgeType, int purgePeriod, int defaultCacheSize, boolean overrideIntervalLoggingSamples, int intervalLoggingSampleWindowSize) {
DataPointVO dp = Common.getUser().getEditPoint();
if (dp != null) {
dp.setLoggingType(type);
dp.setIntervalLoggingPeriod(period);
dp.setIntervalLoggingPeriodType(periodType);
dp.setIntervalLoggingType(intervalType);
dp.setTolerance(tolerance);
dp.setDiscardExtremeValues(discardExtremeValues);
dp.setDiscardHighLimit(discardHighLimit);
dp.setDiscardLowLimit(discardLowLimit);
dp.setPurgeOverride(purgeOverride);
dp.setPurgeType(purgeType);
dp.setPurgePeriod(purgePeriod);
dp.setDefaultCacheSize(defaultCacheSize);
dp.setOverrideIntervalLoggingSamples(overrideIntervalLoggingSamples);
dp.setIntervalLoggingSampleWindowSize(intervalLoggingSampleWindowSize);
}
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class DataPointDwr method storeEditProperties.
/**
* This method is used to pre-stage the vo for saving by the custom modules.
*
* All of the general properties are saved into the "Session" here for use in the modules.
*
* @param newDp
*/
@SuppressWarnings("deprecation")
@DwrPermission(user = true)
public void storeEditProperties(DataPointVO newDp) {
DataPointVO dp = Common.getUser().getEditPoint();
if (dp != null) {
// Do we want the details set here? (The ID Name,XID and Locator are stored via the modules)
dp.setId(newDp.getId());
dp.setXid(newDp.getXid());
// dp.setPointLocator(newDp.getPointLocator());
dp.setDeviceName(newDp.getDeviceName());
dp.setEnabled(newDp.isEnabled());
dp.setReadPermission(newDp.getReadPermission());
dp.setSetPermission(newDp.getSetPermission());
dp.setTemplateId(newDp.getTemplateId());
dp.setDataSourceId(newDp.getDataSourceId());
// General Properties
dp.setEngineeringUnits(newDp.getEngineeringUnits());
dp.setUseIntegralUnit(newDp.isUseIntegralUnit());
dp.setUseRenderedUnit(newDp.isUseRenderedUnit());
try {
// These won't come back from the UI as they aren't converted
dp.setUnit(UnitUtil.parseLocal(newDp.getUnitString()));
} catch (Exception e) {
LOG.warn(e.getMessage(), e);
// For validation
dp.setUnit(null);
}
dp.setUnitString(newDp.getUnitString());
try {
dp.setRenderedUnit(UnitUtil.parseLocal(newDp.getRenderedUnitString()));
} catch (Exception e) {
LOG.warn(e.getMessage(), e);
dp.setRenderedUnit(null);
}
dp.setRenderedUnitString(newDp.getRenderedUnitString());
try {
dp.setIntegralUnit(UnitUtil.parseLocal(newDp.getIntegralUnitString()));
} catch (Exception e) {
LOG.warn(e.getMessage(), e);
dp.setIntegralUnit(null);
}
dp.setIntegralUnitString(newDp.getIntegralUnitString());
dp.setChartColour(newDp.getChartColour());
dp.setPlotType(newDp.getPlotType());
dp.setSimplifyType(newDp.getSimplifyType());
dp.setSimplifyTolerance(newDp.getSimplifyTolerance());
dp.setSimplifyTarget(newDp.getSimplifyTarget());
// Logging Properties
dp.setLoggingType(newDp.getLoggingType());
dp.setIntervalLoggingPeriod(newDp.getIntervalLoggingPeriod());
dp.setIntervalLoggingPeriodType(newDp.getIntervalLoggingPeriodType());
dp.setIntervalLoggingType(newDp.getIntervalLoggingType());
dp.setTolerance(newDp.getTolerance());
dp.setDiscardExtremeValues(newDp.isDiscardExtremeValues());
dp.setDiscardHighLimit(newDp.getDiscardHighLimit());
dp.setDiscardLowLimit(newDp.getDiscardLowLimit());
dp.setPurgeOverride(newDp.isPurgeOverride());
dp.setPurgeType(newDp.getPurgeType());
dp.setPurgePeriod(newDp.getPurgePeriod());
dp.setDefaultCacheSize(newDp.getDefaultCacheSize());
dp.setOverrideIntervalLoggingSamples(newDp.isOverrideIntervalLoggingSamples());
dp.setIntervalLoggingSampleWindowSize(newDp.getIntervalLoggingSampleWindowSize());
// Chart Renderer
dp.setChartRenderer(newDp.getChartRenderer());
dp.setRollup(newDp.getRollup());
// Text Renderer
dp.setTextRenderer(newDp.getTextRenderer());
// Extreme sets
dp.setPreventSetExtremeValues(newDp.isPreventSetExtremeValues());
dp.setSetExtremeLowLimit(newDp.getSetExtremeLowLimit());
dp.setSetExtremeHighLimit(newDp.getSetExtremeHighLimit());
}
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class DataPointEditDwr method addEventDetector.
@DwrPermission(user = true)
public AbstractPointEventDetectorVO<?> addEventDetector(String typeName, int newId) {
DataPointVO dp = getDataPoint();
EventDetectorDefinition<?> definition = ModuleRegistry.getEventDetectorDefinition(typeName);
AbstractPointEventDetectorVO<?> ped = (AbstractPointEventDetectorVO<?>) definition.baseCreateEventDetectorVO();
ped.setXid(EventDetectorDao.instance.generateUniqueXid());
ped.setName("");
ped.setId(newId);
synchronized (dp) {
ped.setSourceId(dp.getId());
ped.njbSetDataPoint(dp);
dp.getEventDetectors().add(ped);
}
return ped;
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class DataPointEditDwr method purgeNow.
//
// Data purge
//
@DwrPermission(user = true)
public long purgeNow(int purgeType, int purgePeriod, boolean allData) {
DataPointVO point = getDataPoint();
Long count;
if (allData)
count = Common.runtimeManager.purgeDataPointValues(point.getId());
else
count = Common.runtimeManager.purgeDataPointValues(point.getId(), purgeType, purgePeriod);
return count;
}
use of com.serotonin.m2m2.vo.DataPointVO in project ma-core-public by infiniteautomation.
the class DataPointEditDwr method ensureEditingPointMatch.
@DwrPermission(user = true)
public ProcessResult ensureEditingPointMatch(int uiPointId) {
ProcessResult result = new ProcessResult();
User user = Common.getHttpUser();
DataPointVO dataPoint = user.getEditPoint();
if (dataPoint.getId() == uiPointId) {
result.addData("match", true);
} else {
result.addData("message", Common.translate("pointEdit.error.uiPointMismatch"));
result.addData("match", false);
}
return result;
}
Aggregations