use of com.serotonin.m2m2.vo.event.ProcessEventHandlerVO in project ma-core-public by infiniteautomation.
the class EventHandlersDwr method saveProcessEventHandler.
@DwrPermission(user = true)
public ProcessResult saveProcessEventHandler(String eventType, String eventSubtype, int eventTypeRef1, int eventTypeRef2, int handlerId, String xid, String alias, boolean disabled, String activeProcessCommand, int activeProcessTimeout, String inactiveProcessCommand, int inactiveProcessTimeout) {
ProcessEventHandlerVO handler = new ProcessEventHandlerVO();
handler.setDefinition(ModuleRegistry.getEventHandlerDefinition(ProcessEventHandlerDefinition.TYPE_NAME));
handler.setActiveProcessCommand(activeProcessCommand);
handler.setActiveProcessTimeout(activeProcessTimeout);
handler.setInactiveProcessCommand(inactiveProcessCommand);
handler.setInactiveProcessTimeout(inactiveProcessTimeout);
return save(eventType, eventSubtype, eventTypeRef1, eventTypeRef2, handler, handlerId, xid, alias, disabled);
}
use of com.serotonin.m2m2.vo.event.ProcessEventHandlerVO in project ma-core-public by infiniteautomation.
the class Upgrade12 method upgradeEventHandlers.
@SuppressWarnings("deprecation")
private int upgradeEventHandlers(OutputStream os) {
int upgraded = 0;
List<EventHandlerVO> handlers = this.ejt.query(EVENT_HANDLER_SELECT, new EventHandlerRowMapper());
// Convert them and update the database with the new handlers
for (EventHandlerVO vo : handlers) {
switch(vo.getHandlerType()) {
case EventHandlerVO.TYPE_EMAIL:
EmailEventHandlerVO emailHandler = new EmailEventHandlerVO();
emailHandler.setId(vo.getId());
emailHandler.setXid(vo.getXid());
emailHandler.setName(vo.getAlias());
emailHandler.setDisabled(vo.isDisabled());
emailHandler.setDefinition(ModuleRegistry.getEventHandlerDefinition(EmailEventHandlerDefinition.TYPE_NAME));
emailHandler.setActiveRecipients(vo.getActiveRecipients());
emailHandler.setSendEscalation(vo.isSendEscalation());
emailHandler.setEscalationDelayType(vo.getEscalationDelayType());
emailHandler.setEscalationDelay(vo.getEscalationDelay());
emailHandler.setEscalationRecipients(vo.getEscalationRecipients());
emailHandler.setSendInactive(vo.isSendInactive());
emailHandler.setInactiveOverride(vo.isInactiveOverride());
emailHandler.setInactiveRecipients(vo.getInactiveRecipients());
emailHandler.setIncludeSystemInfo(vo.isIncludeSystemInfo());
emailHandler.setIncludePointValueCount(vo.getIncludePointValueCount());
emailHandler.setIncludeLogfile(vo.isIncludeLogfile());
upgradeEventHandler(emailHandler);
upgraded++;
break;
case EventHandlerVO.TYPE_PROCESS:
ProcessEventHandlerVO processHandler = new ProcessEventHandlerVO();
processHandler.setId(vo.getId());
processHandler.setXid(vo.getXid());
processHandler.setName(vo.getAlias());
processHandler.setDisabled(vo.isDisabled());
processHandler.setDefinition(ModuleRegistry.getEventHandlerDefinition(ProcessEventHandlerDefinition.TYPE_NAME));
processHandler.setActiveProcessCommand(vo.getActiveProcessCommand());
processHandler.setActiveProcessTimeout(vo.getActiveProcessTimeout());
processHandler.setInactiveProcessCommand(vo.getInactiveProcessCommand());
processHandler.setInactiveProcessTimeout(vo.getInactiveProcessTimeout());
upgradeEventHandler(processHandler);
upgraded++;
break;
case EventHandlerVO.TYPE_SET_POINT:
SetPointEventHandlerVO setPointHandler = new SetPointEventHandlerVO();
setPointHandler.setId(vo.getId());
setPointHandler.setXid(vo.getXid());
setPointHandler.setName(vo.getAlias());
setPointHandler.setDisabled(vo.isDisabled());
setPointHandler.setDefinition(ModuleRegistry.getEventHandlerDefinition(SetPointEventHandlerDefinition.TYPE_NAME));
setPointHandler.setTargetPointId(vo.getTargetPointId());
setPointHandler.setActiveAction(vo.getActiveAction());
setPointHandler.setActiveValueToSet(vo.getActiveValueToSet());
setPointHandler.setActivePointId(vo.getActivePointId());
setPointHandler.setInactiveAction(vo.getInactiveAction());
setPointHandler.setInactiveValueToSet(vo.getInactiveValueToSet());
setPointHandler.setInactivePointId(vo.getInactivePointId());
upgradeEventHandler(setPointHandler);
upgraded++;
break;
default:
LOG.error("Unknown event detector type: " + vo.getHandlerType());
try {
os.write(new String("Unknown event detector type: " + vo.getHandlerType()).getBytes(Common.UTF8_CS));
} catch (IOException e2) {
LOG.error("Unable to write to upgrade log.", e2);
}
break;
}
}
return upgraded;
}
Aggregations