/** * Check if inlined policy should be retrieved together with the thing. * * @param command the thing query command. * @return whether it is necessary to retrieve the thing's policy. */ private static boolean shouldRetrievePolicyWithThing(final ThingCommand command) { final RetrieveThing retrieveThing = (RetrieveThing) command; final boolean isNotV1 = JsonSchemaVersion.V_1 != command.getImplementedSchemaVersion(); return isNotV1 && retrieveThing.getSelectedFields().filter(selector -> selector.getPointers().stream().anyMatch(jsonPointer -> jsonPointer.getRoot() .filter(jsonKey -> Policy.INLINED_FIELD_NAME.equals(jsonKey.toString())) .isPresent())) .isPresent(); }
final JsonFieldSelectorBuilder jsonFieldSelectorBuilder = JsonFactory.newFieldSelectorBuilder().addFieldDefinition(Thing.JsonFields.ACL); retrieveThing.getSelectedFields().ifPresent(jsonFieldSelectorBuilder::addPointers); final DittoHeaders dittoHeaders = retrieveThing .getDittoHeaders()