use of com.serotonin.m2m2.web.dwr.util.DwrPermission 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.web.dwr.util.DwrPermission 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.web.dwr.util.DwrPermission in project ma-core-public by infiniteautomation.
the class DataPointDwr method getChartRendererOptions.
/**
* Get a list of available Chart Renderers for this point
*
* @param vo
* @return
*/
@DwrPermission(user = true)
public ProcessResult getChartRendererOptions(int dataTypeId) {
ProcessResult response = new ProcessResult();
List<ImplDefinition> list = BaseChartRenderer.getImplementations(dataTypeId);
response.addData("options", list);
return response;
}
use of com.serotonin.m2m2.web.dwr.util.DwrPermission in project ma-core-public by infiniteautomation.
the class DataPointDwr method getUnitsList.
@DwrPermission(user = true)
public ProcessResult getUnitsList() {
ProcessResult result = new ProcessResult();
List<DojoMemoryStoreListItem> pairs = new ArrayList<>();
// Get SI Units
int id = 0;
for (Unit<?> unit : SI.getInstance().getUnits()) {
pairs.add(new DojoMemoryStoreListItem(unit.toString(), id++));
}
// Get US Units
for (Unit<?> unit : NonSI.getInstance().getUnits()) {
pairs.add(new DojoMemoryStoreListItem(unit.toString(), id++));
}
List<String> addedUnits = UnitUtil.getAddedUnitLabels();
for (String unit : addedUnits) {
pairs.add(new DojoMemoryStoreListItem(unit, id++));
}
Collections.sort(pairs, new Comparator<DojoMemoryStoreListItem>() {
@Override
public int compare(DojoMemoryStoreListItem arg0, DojoMemoryStoreListItem arg1) {
return arg0.getName().compareToIgnoreCase(arg1.getName());
}
});
result.addData("units", pairs);
return result;
}
use of com.serotonin.m2m2.web.dwr.util.DwrPermission 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;
}
Aggregations