public GatewayEventImpl(TimestampedEntryEventImpl entryEvent) { this.entryEvent = entryEvent; // We've to manage three representations of operations - // Operation, Type and GatewayEventType Type eventType = null; Operation op = entryEvent.getOperation(); if (op.equals(Operation.CREATE)) { eventType = Type.AFTER_INSERT; this.type = GatewayEventType.INSERT; } else if (op.equals(Operation.UPDATE)) { eventType = Type.AFTER_UPDATE; this.type = GatewayEventType.UPDATE; } else if (op.equals(Operation.DESTROY)) { eventType = Type.AFTER_DELETE; this.type = GatewayEventType.DELETE; } else { throw new AssertionError( "Unexpected operation type " + op + " for gateway event: " + entryEvent); } this.eventImpl = new EventImpl(entryEvent, eventType); }
@Override public long getOldTimestamp() { return entryEvent.getOldTimestamp(); }
@Override public int getOldDistributedSystemID() { return entryEvent.getOldDistributedSystemID(); }
@Override public String toString() { return entryEvent.toString() + ",GatewayEventType=" + type; }