use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class EventHandlerDao method savePreRelationalData.
@Override
public void savePreRelationalData(AbstractEventHandlerVO existing, AbstractEventHandlerVO 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 FileStoreDao method savePreRelationalData.
@Override
public void savePreRelationalData(FileStore existing, FileStore vo) {
MangoPermission readPermission = permissionService.findOrCreate(vo.getReadPermission());
vo.setReadPermission(readPermission);
MangoPermission writePermission = permissionService.findOrCreate(vo.getWritePermission());
vo.setWritePermission(writePermission);
}
use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class FileStoreDao method mapRecord.
@Override
public FileStore mapRecord(Record record) {
FileStore result = new FileStore();
result.setId(record.get(table.id));
result.setXid(record.get(table.xid));
result.setName(record.get(table.name));
result.setReadPermission(new MangoPermission(record.get(table.readPermissionId)));
result.setWritePermission(new MangoPermission(record.get(table.writePermissionId)));
return result;
}
use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class JsonDataDao method mapRecord.
@Override
public JsonDataVO mapRecord(Record record) {
JsonDataVO vo = new JsonDataVO();
vo.setId(record.get(table.id));
vo.setXid(record.get(table.xid));
vo.setName(record.get(table.name));
vo.setJsonData(extractDataFromObject(record.get(table.data)));
vo.setReadPermission(new MangoPermission(record.get(table.readPermissionId)));
vo.setEditPermission(new MangoPermission(record.get(table.editPermissionId)));
return vo;
}
use of com.infiniteautomation.mango.permission.MangoPermission in project ma-core-public by infiniteautomation.
the class ConfigurationExportData method createExportDataMap.
/**
* Get a map of desired export data.
*
* @param exportElements if null full export is returned
*/
public static Map<String, Object> createExportDataMap(String[] exportElements) {
if (exportElements == null)
exportElements = getAllExportNames();
Map<String, Object> data = new LinkedHashMap<>();
if (ArrayUtils.contains(exportElements, DATA_SOURCES))
data.put(DATA_SOURCES, DataSourceDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, DATA_POINTS))
data.put(DATA_POINTS, DataPointDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, USERS))
data.put(USERS, UserDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, MAILING_LISTS))
data.put(MAILING_LISTS, MailingListDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, PUBLISHERS))
data.put(PUBLISHERS, PublisherDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, PUBLISHED_POINTS))
data.put(PUBLISHED_POINTS, Common.getBean(PublishedPointDao.class).getAll());
if (ArrayUtils.contains(exportElements, EVENT_HANDLERS))
data.put(EVENT_HANDLERS, EventHandlerDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, SYSTEM_SETTINGS))
data.put(SYSTEM_SETTINGS, SystemSettingsDao.getInstance().getAllSystemSettingsAsCodes());
if (ArrayUtils.contains(exportElements, VIRTUAL_SERIAL_PORTS))
data.put(VIRTUAL_SERIAL_PORTS, VirtualSerialPortConfigDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, JSON_DATA))
data.put(JSON_DATA, JsonDataDao.getInstance().getAll());
if (ArrayUtils.contains(exportElements, ROLES))
data.put(ROLES, Common.getBean(RoleDao.class).getAll());
if (ArrayUtils.contains(exportElements, PERMISSIONS)) {
List<Map<String, MangoPermission>> permissions = new ArrayList<>();
for (PermissionDefinition def : ModuleRegistry.getPermissionDefinitions().values()) {
Map<String, MangoPermission> toExport = new HashMap<>();
toExport.put(def.getPermissionTypeName(), def.getPermission());
permissions.add(toExport);
}
data.put(PERMISSIONS, permissions);
}
for (EmportDefinition def : ModuleRegistry.getDefinitions(EmportDefinition.class)) {
if (ArrayUtils.contains(exportElements, def.getElementId()))
data.put(def.getElementId(), def.getExportData());
}
return data;
}
Aggregations