default boolean isWildcardTopic() { return ID_PLACEHOLDER.equals(getId()); }
default boolean isWildcardTopic() { return ID_PLACEHOLDER.equals(getId()); }
protected static String thingIdFrom(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); return topicPath.getNamespace() + ":" + topicPath.getId(); }
protected static String thingIdFrom(final Adaptable adaptable) { final TopicPath topicPath = adaptable.getTopicPath(); return topicPath.getNamespace() + ":" + topicPath.getId(); }
return Optional.of(topicPath.getNamespace()); case ENTITYID_PLACEHOLDER: return Optional.of(topicPath.getId()); case GROUP_PLACEHOLDER: return Optional.of(topicPath.getGroup().getName());
/** * Creates a {@code ThingErrorResponse} from the given {@code adaptable}. * * @param adaptable the adaptable to convert. * @return the ThingErrorResponse. */ private ThingErrorResponse thingErrorResponseFromAdaptable(final Adaptable adaptable) { final DittoHeaders dittoHeaders = headerTranslator.fromExternalHeaders(adaptable.getHeaders().orElse(DittoHeaders.empty())); final TopicPath topicPath = adaptable.getTopicPath(); final DittoRuntimeException dittoRuntimeException = adaptable.getPayload() .getValue() .map(JsonValue::asObject) .map(jsonObject -> { try { return errorRegistry.parse(jsonObject, dittoHeaders); } catch (final JsonTypeNotParsableException e) { return DittoRuntimeException.fromUnknownErrorJson(jsonObject, dittoHeaders) .orElseThrow(() -> e); } }) .orElseThrow(() -> new JsonMissingFieldException(ThingCommandResponse.JsonFields.PAYLOAD)); final String thingId = topicPath.getNamespace() + ":" + topicPath.getId(); return ThingErrorResponse.of(thingId, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
/** * Creates a {@code ThingErrorResponse} from the given {@code adaptable}. * * @param adaptable the adaptable to convert. * @return the ThingErrorResponse. */ private ThingErrorResponse thingErrorResponseFromAdaptable(final Adaptable adaptable) { final DittoHeaders dittoHeaders = headerTranslator.fromExternalHeaders(adaptable.getHeaders().orElse(DittoHeaders.empty())); final TopicPath topicPath = adaptable.getTopicPath(); final DittoRuntimeException dittoRuntimeException = adaptable.getPayload() .getValue() .map(JsonValue::asObject) .map(jsonObject -> { try { return errorRegistry.parse(jsonObject, dittoHeaders); } catch (final JsonTypeNotParsableException e) { return DittoRuntimeException.fromUnknownErrorJson(jsonObject, dittoHeaders) .orElseThrow(() -> e); } }) .orElseThrow(() -> new JsonMissingFieldException(ThingCommandResponse.JsonFields.PAYLOAD)); final String thingId = topicPath.getNamespace() + ":" + topicPath.getId(); return ThingErrorResponse.of(thingId, dittoRuntimeException, dittoRuntimeException.getDittoHeaders()); }
topicPath.getNamespace() + ":" + topicPath.getId()); dittoHeadersBuilder.putHeader(SUBJECT.getKey(), topicPath.getSubject().orElse("")); adaptable.getPayload().getPath().getDirection().ifPresent(direction ->
topicPath.getNamespace() + ":" + topicPath.getId()); dittoHeadersBuilder.putHeader(SUBJECT.getKey(), topicPath.getSubject().orElse("")); adaptable.getPayload().getPath().getDirection().ifPresent(direction ->