use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class DataPointDwr method getTextRendererOptions.
/**
* Get a list of available Chart Renderers for this point
*
* @param vo
* @return
*/
@DwrPermission(user = true)
public ProcessResult getTextRendererOptions(int dataTypeId) {
ProcessResult response = new ProcessResult();
List<ImplDefinition> list = BaseTextRenderer.getImplementation(dataTypeId);
response.addData("options", list);
return response;
}
use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class DataPointDwr method getPoints.
@DwrPermission(user = true)
public ProcessResult getPoints() {
ProcessResult result = new ProcessResult();
User user = Common.getUser();
if (user == null) {
result.addData("list", new ArrayList<DataPointVO>());
return result;
}
DataSourceVO<?> ds = user.getEditDataSource();
if (ds.getId() == Common.NEW_ID) {
result.addData("list", new ArrayList<DataPointVO>());
return result;
}
List<DataPointVO> points = DataPointDao.instance.getDataPoints(ds.getId(), DataPointNameComparator.instance, false);
result.addData("list", points);
return result;
}
use of com.serotonin.m2m2.i18n.ProcessResult in project ma-core-public by infiniteautomation.
the class DataPointDwr method remove.
/**
* Delete a VO
*
* @param id
* @return
*/
@Override
@DwrPermission(user = true)
public ProcessResult remove(int id) {
ProcessResult response = new ProcessResult();
try {
DataPointVO dp = dao.get(id);
if (dp != null)
Common.runtimeManager.deleteDataPoint(dp);
} catch (Exception e) {
// Handle the exceptions.
LOG.error(e);
DataPointVO vo = dao.get(id);
if (e instanceof DataIntegrityViolationException)
response.addContextualMessage(vo.getName(), "table.edit.unableToDeleteDueToConstraints");
else
response.addContextualMessage(vo.getName(), "table.edit.unableToDelete", e.getMessage());
}
response.addData("id", id);
return response;
}
use of com.serotonin.m2m2.i18n.ProcessResult 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.i18n.ProcessResult 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;
}
Aggregations