use of com.serotonin.m2m2.vo.event.CompoundEventDetectorVO in project ma-core-public by infiniteautomation.
the class CompoundEventDetectorDao method updateCompoundEventDetector.
private void updateCompoundEventDetector(CompoundEventDetectorVO ced) {
CompoundEventDetectorVO old = getCompoundEventDetector(ced.getId());
ejt.update(COMPOUND_EVENT_DETECTOR_UPDATE, new Object[] { ced.getXid(), ced.getName(), ced.getAlarmLevel(), boolToChar(ced.isReturnToNormal()), boolToChar(ced.isDisabled()), ced.getCondition(), ced.getId() });
AuditEventType.raiseChangedEvent(AuditEventType.TYPE_COMPOUND_EVENT_DETECTOR, old, ced);
}
use of com.serotonin.m2m2.vo.event.CompoundEventDetectorVO in project ma-core-public by infiniteautomation.
the class CompoundDetectorEventType method getCompoundEventDetectorId.
protected int getCompoundEventDetectorId(JsonObject json, String name) throws JsonException {
String xid = json.getString(name);
if (xid == null)
throw new TranslatableJsonException("emport.error.eventType.missing.reference", name);
CompoundEventDetectorVO ced = new CompoundEventDetectorDao().getCompoundEventDetector(xid);
if (ced == null)
throw new TranslatableJsonException("emport.error.eventType.invalid.reference", name, xid);
return ced.getId();
}
use of com.serotonin.m2m2.vo.event.CompoundEventDetectorVO in project ma-core-public by infiniteautomation.
the class CompoundEventDetectorDao method deleteCompoundEventDetector.
public void deleteCompoundEventDetector(final int compoundEventDetectorId) {
final ExtendedJdbcTemplate ejt2 = ejt;
CompoundEventDetectorVO ced = getCompoundEventDetector(compoundEventDetectorId);
if (ced != null) {
getTransactionTemplate().execute(new TransactionCallbackWithoutResult() {
@Override
protected void doInTransactionWithoutResult(TransactionStatus status) {
ejt2.update("delete from eventHandlers where eventTypeId=" + EventType.EventTypeNames.COMPOUND + " and eventTypeRef1=?", new Object[] { compoundEventDetectorId });
ejt2.update("delete from compoundEventDetectors where id=?", new Object[] { compoundEventDetectorId });
}
});
AuditEventType.raiseDeletedEvent(AuditEventType.TYPE_COMPOUND_EVENT_DETECTOR, ced);
}
}
Aggregations