public void update(EventBean[] newEvents, EventBean[] oldEvents) { if (newEvents != null) { for (EventBean newEvent : newEvents) { MapEventBean bean = (MapEventBean) newEvent; System.out.println("Trying to sleep after " + bean.get("total") + " sheep"); } } } }
private Object resolveOriginalObject(Map<?, ?> alert) { Object result = alert.get(MapEposEvent.ORIGNIAL_OBJECT_KEY); if (result != null) return result; String[] potentialKeys = new String[] {MapEposEvent.VALUE_KEY}; for (String string : potentialKeys) { Object value = alert.get(string); if (value != null && value instanceof MapEventBean) { Object underlying = ((MapEventBean) value).getUnderlying(); if (underlying instanceof Map<?, ?>) { result = ((Map<?, ?>) underlying).get(MapEposEvent.ORIGNIAL_OBJECT_KEY); } } if (result != null) return result; } return null; }
/** * generates a new {@link MapEvent} from a selection with multiple values * @param meBean the selected {@link MapEventBean} * @return the new map event */ private MapEposEvent createEventFromComplexSelect(MapEventBean meBean) { //event selected Map<String, Object> properties = meBean.getProperties(); return parseEventFromMap(properties); }
/** * Given an Event from the Esper core engine, get its name. * This return null for UUID-based names (select statements), the specified name otherwise (named streams, e.g. insert) * * @param newEvent Event to extract the name from * @return event name if human-readable, null otherwise */ static String getEventName(EventBean newEvent) { String typeName = newEvent.getEventType().getName(); // For automatically generated event names (uuid, most likely from a select statement), the public name // is null. if (newEvent.getEventType() instanceof MapEventType) { typeName = ((MapEventType) newEvent.getEventType()).getMetadata().getPublicName(); } return typeName; }
String[] propertyNames = selected.getEventType().getPropertyNames();
event.addCausalAncestor(parseFromMap(ancestorBean.getProperties(), createCausality));