use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class DataSourceDao method savePreRelationalData.
@Override
public void savePreRelationalData(DataSourceVO existing, DataSourceVO vo) {
MangoPermission readPermission = permissionService.findOrCreate(vo.getReadPermission());
vo.setReadPermission(readPermission);
MangoPermission editPermission = permissionService.findOrCreate(vo.getEditPermission());
vo.setEditPermission(editPermission);
vo.getDefinition().savePreRelationalData(existing, vo);
}
use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class DataPointDao method loadRelationalData.
/**
* Loads the event detectors, point comments, tags data source and template name
* Used by getFull()
*/
@Override
public void loadRelationalData(DataPointVO vo) {
vo.supplyTags(() -> dataPointTagsDao.getTagsForDataPointId(vo.getId()));
// Populate permissions
MangoPermission read = vo.getReadPermission();
vo.supplyReadPermission(() -> permissionService.get(read.getId()));
MangoPermission edit = vo.getEditPermission();
vo.supplyEditPermission(() -> permissionService.get(edit.getId()));
MangoPermission set = vo.getSetPermission();
vo.supplySetPermission(() -> permissionService.get(set.getId()));
DataSourceDefinition<? extends DataSourceVO> def = ModuleRegistry.getDataSourceDefinition(vo.getPointLocator().getDataSourceType());
if (def != null) {
def.loadRelationalData(vo);
}
}
use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class DataPointDao method savePreRelationalData.
@Override
public void savePreRelationalData(DataPointVO existing, DataPointVO vo) {
// Shall we generate a new series ID?
if (vo.getSeriesId() <= 0) {
if (existing == null) {
int seriesId = insertNewTimeSeries();
vo.setSeriesId(seriesId);
} else {
vo.setSeriesId(existing.getSeriesId());
}
}
MangoPermission readPermission = permissionService.findOrCreate(vo.getReadPermission());
vo.setReadPermission(readPermission);
MangoPermission editPermission = permissionService.findOrCreate(vo.getEditPermission());
vo.setEditPermission(editPermission);
MangoPermission setPermission = permissionService.findOrCreate(vo.getSetPermission());
vo.setSetPermission(setPermission);
}
use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class DataPointDao method mapRecord.
@Override
public DataPointVO mapRecord(Record record) {
int id = record.get(table.id);
String xid = record.get(table.xid);
String name = record.get(table.name);
DataPointVO dp = (DataPointVO) SerializationHelper.readObjectInContextFromArray(record.get(table.data));
dp.setId(id);
dp.setXid(xid);
dp.setName(name);
dp.setDataSourceId(record.get(table.dataSourceId));
dp.setDeviceName(record.get(table.deviceName));
dp.setEnabled(charToBool(record.get(table.enabled)));
dp.setLoggingType(record.get(table.loggingType));
dp.setIntervalLoggingPeriodType(record.get(table.intervalLoggingPeriodType));
dp.setIntervalLoggingPeriod(record.get(table.intervalLoggingPeriod));
dp.setIntervalLoggingType(record.get(table.intervalLoggingType));
dp.setTolerance(record.get(table.tolerance));
dp.setPurgeOverride(charToBool(record.get(table.purgeOverride)));
dp.setPurgeType(record.get(table.purgeType));
dp.setPurgePeriod(record.get(table.purgePeriod));
dp.setDefaultCacheSize(record.get(table.defaultCacheSize));
dp.setDiscardExtremeValues(charToBool(record.get(table.discardExtremeValues)));
dp.setEngineeringUnits(record.get(table.engineeringUnits));
dp.setRollup(record.get(table.rollup));
// // read and discard dataTypeId
// record.get(table.xyz);
// // read and discard settable boolean
// record.get(table.xyz);
dp.setData(extractDataFromObject(record.get(table.jsonData)));
dp.setSeriesId(record.get(table.seriesId));
MangoPermission read = new MangoPermission(record.get(table.readPermissionId));
dp.supplyReadPermission(() -> read);
MangoPermission edit = new MangoPermission(record.get(table.editPermissionId));
dp.supplyEditPermission(() -> edit);
MangoPermission set = new MangoPermission(record.get(table.setPermissionId));
dp.supplySetPermission(() -> set);
// Data source information from join
dp.setDataSourceName(record.get(dataSources.name));
dp.setDataSourceXid(record.get(dataSources.xid));
dp.setDataSourceTypeName(record.get(dataSources.dataSourceType));
dp.ensureUnitsCorrect();
return dp;
}
use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class EventDao method loadRelationalData.
public void loadRelationalData(EventInstance vo) {
if (vo.isHasComments()) {
List<UserCommentVO> comments = new ArrayList<>();
userCommentDao.getEventComments(vo.getId(), comments::add);
vo.setEventComments(comments);
}
MangoPermission read = vo.getReadPermission();
vo.supplyReadPermission(() -> permissionService.get(read.getId()));
}
Aggregations