@Override protected String getType(final Adaptable adaptable) { if (adaptable.getTopicPath().getSubject().filter(KnownMessageSubjects.CLAIM_SUBJECT::equals).isPresent()) { return SendClaimMessageResponse.TYPE; } else if (!adaptable.getHeaders().map(DittoHeaders::isResponseRequired).orElse(true)) { return SendMessageAcceptedResponse.TYPE; } else if (adaptable.getPayload().getPath().getFeatureId().isPresent()) { return SendFeatureMessageResponse.TYPE; } else { return SendThingMessageResponse.TYPE; } }
@Override protected String getType(final Adaptable adaptable) { if (adaptable.getTopicPath().getSubject().filter(KnownMessageSubjects.CLAIM_SUBJECT::equals).isPresent()) { return SendClaimMessage.TYPE; } else if (adaptable.getPayload().getPath().getFeatureId().isPresent()) { return SendFeatureMessage.TYPE; } else { return SendThingMessage.TYPE; } }
@Override protected String getType(final Adaptable adaptable) { if (adaptable.getTopicPath().getSubject().filter(KnownMessageSubjects.CLAIM_SUBJECT::equals).isPresent()) { return SendClaimMessage.TYPE; } else if (adaptable.getPayload().getPath().getFeatureId().isPresent()) { return SendFeatureMessage.TYPE; } else { return SendThingMessage.TYPE; } }
protected static String featureIdFrom(final Adaptable adaptable) { final JsonPointer path = adaptable.getPayload().getPath(); return path.get(1).orElseThrow(() -> UnknownPathException.newBuilder(path).build()).toString(); }
protected static String featureIdFrom(final Adaptable adaptable) { final JsonPointer path = adaptable.getPayload().getPath(); return path.get(1).orElseThrow(() -> UnknownPathException.newBuilder(path).build()).toString(); }
protected static JsonPointer attributePointerFrom(final Adaptable adaptable) { final JsonPointer path = adaptable.getPayload().getPath(); return path.getSubPointer(ATTRIBUTE_PATH_LEVEL) .orElseThrow(() -> UnknownPathException.newBuilder(path).build()); }
protected static JsonPointer attributePointerFrom(final Adaptable adaptable) { final JsonPointer path = adaptable.getPayload().getPath(); return path.getSubPointer(ATTRIBUTE_PATH_LEVEL) .orElseThrow(() -> UnknownPathException.newBuilder(path).build()); }
protected static String featureIdForMessageFrom(final Adaptable adaptable) { return adaptable.getPayload().getPath() .getFeatureId() .orElseThrow(() -> JsonParseException.newBuilder().build()); }
protected static String featureIdForMessageFrom(final Adaptable adaptable) { return adaptable.getPayload().getPath() .getFeatureId() .orElseThrow(() -> JsonParseException.newBuilder().build()); }
protected static JsonPointer featurePropertyPointerFrom(final Adaptable adaptable) { final JsonPointer path = adaptable.getPayload().getPath(); return path.getSubPointer(FEATURE_PROPERTY_PATH_LEVEL) .orElseThrow(() -> UnknownPathException.newBuilder(path).build()); }
protected static AclEntry aclEntryFrom(final Adaptable adaptable) { return adaptable.getPayload() .getValue() .map(permissions -> AccessControlListModelFactory .newAclEntry(leafValue(adaptable.getPayload().getPath()), permissions)) .orElseThrow(() -> JsonParseException.newBuilder().build()); }
protected static AclEntry aclEntryFrom(final Adaptable adaptable) { return adaptable.getPayload() .getValue() .map(permissions -> AccessControlListModelFactory .newAclEntry(leafValue(adaptable.getPayload().getPath()), permissions)) .orElseThrow(() -> JsonParseException.newBuilder().build()); }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); final JsonPointer path = adaptable.getPayload().getPath(); final String eventName = PathMatcher.match(path) + getActionNameWithFirstLetterUpperCase(topicPath); return topicPath.getGroup() + "." + topicPath.getCriterion() + ":" + eventName; }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); final JsonPointer path = adaptable.getPayload().getPath(); final String commandName = getAction(topicPath) + upperCaseFirst(PathMatcher.match(path)); return topicPath.getGroup() + ".responses:" + commandName; }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); final JsonPointer path = adaptable.getPayload().getPath(); final String commandName = getAction(topicPath) + upperCaseFirst(PathMatcher.match(path)); return topicPath.getGroup() + ".responses:" + commandName; }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); final JsonPointer path = adaptable.getPayload().getPath(); final String commandName = getAction(topicPath) + upperCaseFirst(PathMatcher.match(path)); return topicPath.getGroup() + "." + topicPath.getCriterion() + ":" + commandName; }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); if (topicPath.isWildcardTopic()) { return RetrieveThingsResponse.TYPE; } else { final JsonPointer path = adaptable.getPayload().getPath(); final String commandName = getAction(topicPath) + upperCaseFirst(PathMatcher.match(path)); return topicPath.getGroup() + ".responses:" + commandName; } }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); final JsonPointer path = adaptable.getPayload().getPath(); final String commandName = getAction(topicPath) + upperCaseFirst(PathMatcher.match(path)); return topicPath.getGroup() + "." + topicPath.getCriterion() + ":" + commandName; }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); if (topicPath.isWildcardTopic()) { return RetrieveThings.TYPE; } else { final JsonPointer path = adaptable.getPayload().getPath(); final String commandName = getAction(topicPath) + upperCaseFirst(PathMatcher.match(path)); return topicPath.getGroup() + "." + topicPath.getCriterion() + ":" + commandName; } }
@Override protected String getType(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); if (topicPath.isWildcardTopic()) { return RetrieveThings.TYPE; } else { final JsonPointer path = adaptable.getPayload().getPath(); final String commandName = getAction(topicPath) + upperCaseFirst(PathMatcher.match(path)); return topicPath.getGroup() + "." + topicPath.getCriterion() + ":" + commandName; } }