private RetrieveFeaturePropertyLiveCommandImpl(final RetrieveFeatureProperty command) { super(command); featureId = command.getFeatureId(); propertyPointer = command.getPropertyPointer(); }
private RetrieveFeaturePropertyLiveCommandImpl(final RetrieveFeatureProperty command) { super(command); featureId = command.getFeatureId(); propertyPointer = command.getPropertyPointer(); }
@Override public Optional<JsonValue> determineETagEntity(final RetrieveFeatureProperty command, @Nullable final Thing thing) { return extractFeature(command, thing) .flatMap(Feature::getProperties) .flatMap(featureProperties -> featureProperties.getValue(command.getPropertyPointer())); } }
@Override public Optional<JsonValue> determineETagEntity(final RetrieveFeatureProperty command, @Nullable final Thing thing) { return extractFeature(command, thing) .flatMap(Feature::getProperties) .flatMap(featureProperties -> featureProperties.getValue(command.getPropertyPointer())); } }
private Result getRetrieveFeaturePropertyResult(final JsonObject featureProperties, final Context context, final RetrieveFeatureProperty command, @Nullable final Thing thing) { final String featureId = command.getFeatureId(); final JsonPointer propertyPointer = command.getPropertyPointer(); final DittoHeaders dittoHeaders = command.getDittoHeaders(); return featureProperties.getValue(propertyPointer) .map(featureProperty -> RetrieveFeaturePropertyResponse.of(context.getThingId(), featureId, propertyPointer, featureProperty, dittoHeaders)) .map(response -> ResultFactory.newQueryResult(command, thing, response, this)) .orElseGet(() -> ResultFactory.newErrorResult( ExceptionFactory.featurePropertyNotFound(context.getThingId(), featureId, propertyPointer, dittoHeaders))); }
private Result getRetrieveFeaturePropertyResult(final JsonObject featureProperties, final Context context, final RetrieveFeatureProperty command, @Nullable final Thing thing) { final String featureId = command.getFeatureId(); final JsonPointer propertyPointer = command.getPropertyPointer(); final DittoHeaders dittoHeaders = command.getDittoHeaders(); return featureProperties.getValue(propertyPointer) .map(featureProperty -> RetrieveFeaturePropertyResponse.of(context.getThingId(), featureId, propertyPointer, featureProperty, dittoHeaders)) .map(response -> ResultFactory.newQueryResult(command, thing, response, this)) .orElseGet(() -> ResultFactory.newErrorResult( ExceptionFactory.featurePropertyNotFound(context.getThingId(), featureId, propertyPointer, dittoHeaders))); }