Search in sources :

Example 11 with DataPointChangeDefinition

use of com.serotonin.m2m2.module.definitions.dataPoint.DataPointChangeDefinition in project ma-core-public by MangoAutomation.

the class DataPointService method delete.

@Override
protected DataPointVO delete(DataPointVO vo) throws PermissionException, NotFoundException {
    PermissionHolder user = Common.getUser();
    ensureDeletePermission(user, vo);
    for (DataPointChangeDefinition def : changeDefinitions) {
        def.preDelete(vo);
    }
    getRuntimeManager().stopDataPoint(vo.getId());
    dao.delete(vo);
    for (DataPointChangeDefinition def : changeDefinitions) {
        def.postDelete(vo);
    }
    pointValueCache.deleteCache(vo);
    getEventManager().cancelEventsForDataPoint(vo.getId());
    return vo;
}
Also used : DataPointChangeDefinition(com.serotonin.m2m2.module.definitions.dataPoint.DataPointChangeDefinition) PermissionHolder(com.serotonin.m2m2.vo.permission.PermissionHolder)

Aggregations

DataPointChangeDefinition (com.serotonin.m2m2.module.definitions.dataPoint.DataPointChangeDefinition)8 PermissionHolder (com.serotonin.m2m2.vo.permission.PermissionHolder)6 DataPointVO (com.serotonin.m2m2.vo.DataPointVO)4 DataPointWithEventDetectors (com.serotonin.m2m2.vo.dataPoint.DataPointWithEventDetectors)4 AbstractPointEventDetectorVO (com.serotonin.m2m2.vo.event.detector.AbstractPointEventDetectorVO)4 DataPointChangeDefinition (com.serotonin.m2m2.module.DataPointChangeDefinition)3 ValidationException (com.infiniteautomation.mango.util.exception.ValidationException)2 ModuleNotLoadedException (com.serotonin.ModuleNotLoadedException)2 LicenseViolatedException (com.serotonin.m2m2.LicenseViolatedException)2 ProcessResult (com.serotonin.m2m2.i18n.ProcessResult)2 ArrayList (java.util.ArrayList)2 NoDataFoundException (org.jooq.exception.NoDataFoundException)2 TransactionStatus (org.springframework.transaction.TransactionStatus)1 TransactionCallbackWithoutResult (org.springframework.transaction.support.TransactionCallbackWithoutResult)1