use of com.serotonin.m2m2.maintenanceEvents.MaintenanceEventVO in project ma-modules-public by infiniteautomation.
the class MaintenanceEventTypeModelMapping method map.
@Override
public MaintenanceEventTypeModel map(Object o, PermissionHolder user, RestModelMapper mapper) {
MaintenanceEventType type = (MaintenanceEventType) o;
MaintenanceEventVO vo = MaintenanceEventDao.getInstance().get(type.getReferenceId1());
MaintenanceEventTypeModel model;
if (vo != null)
model = new MaintenanceEventTypeModel(type, new MaintenanceEventModel(vo));
else
model = new MaintenanceEventTypeModel(type);
return model;
}
use of com.serotonin.m2m2.maintenanceEvents.MaintenanceEventVO in project ma-modules-public by infiniteautomation.
the class MaintenanceEventsService method validate.
@Override
public ProcessResult validate(MaintenanceEventVO vo) {
ProcessResult result = commonValidation(vo);
PermissionHolder user = Common.getUser();
permissionService.validatePermission(result, "togglePermission", user, vo.getTogglePermission());
return result;
}
use of com.serotonin.m2m2.maintenanceEvents.MaintenanceEventVO in project ma-modules-public by infiniteautomation.
the class MaintenanceEventsService method update.
@Override
protected MaintenanceEventVO update(MaintenanceEventVO existing, MaintenanceEventVO vo) throws PermissionException, ValidationException {
PermissionHolder user = Common.getUser();
ensureEditPermission(user, existing);
vo.setId(existing.getId());
ensureValid(existing, vo);
RTMDefinition.instance.saveMaintenanceEvent(vo);
return vo;
}
use of com.serotonin.m2m2.maintenanceEvents.MaintenanceEventVO in project ma-modules-public by infiniteautomation.
the class MaintenanceEventsService method delete.
/**
* Delete an event
*/
@Override
protected MaintenanceEventVO delete(MaintenanceEventVO vo) throws PermissionException, NotFoundException {
PermissionHolder user = Common.getUser();
ensureEditPermission(user, vo);
RTMDefinition.instance.deleteMaintenanceEvent(vo.getId());
return vo;
}
use of com.serotonin.m2m2.maintenanceEvents.MaintenanceEventVO in project ma-modules-public by infiniteautomation.
the class MaintenanceEventsJavascriptTestUtility method update.
@Override
public MaintenanceEventVO update(String existingXid, MaintenanceEventVO vo) throws NotFoundException, PermissionException, ValidationException {
return this.runAs.runAs(permissions, () -> {
MaintenanceEventVO existing = meService.get(existingXid);
meService.ensureEditPermission(permissions, existing);
// Don't change ID ever
vo.setId(existing.getId());
meService.ensureValid(vo);
return vo;
});
}
Aggregations