public void onUnsubscribe(String sessionId, WampUnsubscribeMessage wampUnsubscribeMessage) { EventAction e = eventMapping.getAction(wampUnsubscribeMessage.getTopicId()); if (e != null) e.unsubscribe(sessionId); else if (log.isDebugEnabled()) log.debug( "unable to unsubscribe : action name doesn't not exist " + wampUnsubscribeMessage.getTopicId()); }
// TODO new publish public void onPublish(String sessionId, WampPublishMessage wampPublishMessage) throws SerializationException { EventAction e = eventMapping.getAction(wampPublishMessage.getTopicId()); if (e != null) { OutputWampEventMessage msg = new OutputWampEventMessage(); msg.setTopicId(wampPublishMessage.getTopicId()); msg.setEvent(wampPublishMessage.getEvent()); // e.publishTo think about it List<String> publishList = e.publishTo(getPublishList(e, sessionId, wampPublishMessage), wampPublishMessage, msg); if (publishList != null) for (String s : publishList) sendEvent(s, msg); } else if (log.isDebugEnabled()) log.debug( "unable to publish : action name doesn't not exist " + wampPublishMessage.getTopicId()); }
private List<String> getPublishList( EventAction e, String sessionId, WampPublishMessage wampPublishMessage) { if (wampPublishMessage.getEligible() != null) return wampPublishMessage.getEligible(); List<String> res; if (wampPublishMessage.getExclude() != null) { res = new ArrayList<String>(e.getSubscriber()); for (String s : wampPublishMessage.getExclude()) res.remove(s); } else { if (wampPublishMessage.isExcludeMe()) { res = new ArrayList<String>(e.getSubscriber()); res.remove(sessionId); } else res = new ArrayList<String>(e.getSubscriber()); } return res; }
@Override public int hashCode() { int result = eventCode != null ? eventCode.hashCode() : 0; result = 31 * result + (eventTypeCodes != null ? eventTypeCodes.hashCode() : 0); result = 31 * result + (eventActionCode != null ? eventActionCode.hashCode() : 0); result = 31 * result + (eventOutcome != null ? eventOutcome.hashCode() : 0); result = 31 * result + (eventDateTime != null ? eventDateTime.hashCode() : 0); result = 31 * result + (participants != null ? participants.hashCode() : 0); result = 31 * result + (sources != null ? sources.hashCode() : 0); result = 31 * result + (objects != null ? objects.hashCode() : 0); return result; }
@Override public boolean equals(Object o) { if (this == o) { return true; } if (!(o instanceof AtnaMessage)) { return false; } AtnaMessage that = (AtnaMessage) o; if (eventActionCode != null ? !eventActionCode.equals(that.eventActionCode) : that.eventActionCode != null) { return false; } if (eventCode != null ? !eventCode.equals(that.eventCode) : that.eventCode != null) { return false; } if (eventDateTime != null ? !eventDateTime.equals(that.eventDateTime) : that.eventDateTime != null) { return false; } if (eventOutcome != that.eventOutcome) { return false; } if (eventTypeCodes != null ? !eventTypeCodes.equals(that.eventTypeCodes) : that.eventTypeCodes != null) { return false; } if (objects != null ? !objects.equals(that.objects) : that.objects != null) { return false; } if (participants != null ? !participants.equals(that.participants) : that.participants != null) { return false; } if (sources != null ? !sources.equals(that.sources) : that.sources != null) { return false; } return true; }