@Override public RetrieveAcl setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingId, dittoHeaders); }
@Override public RetrieveAcl setDittoHeaders(final DittoHeaders dittoHeaders) { return of(thingId, dittoHeaders); }
/** * Creates a new {@code RetrieveAcl} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveAcl fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveAcl>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); return of(thingId, dittoHeaders); }); }
/** * Creates a new {@code RetrieveAcl} from a JSON object. * * @param jsonObject the JSON object of which the command is to be created. * @param dittoHeaders the headers of the command. * @return the command. * @throws NullPointerException if any argument is {@code null}. * @throws org.eclipse.ditto.json.JsonParseException if the passed in {@code jsonObject} was not in the expected * format. * @throws org.eclipse.ditto.model.things.ThingIdInvalidException if the parsed thing ID did not comply to {@link * org.eclipse.ditto.model.things.Thing#ID_REGEX}. */ public static RetrieveAcl fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { return new CommandJsonDeserializer<RetrieveAcl>(TYPE, jsonObject).deserialize(() -> { final String thingId = jsonObject.getValueOrThrow(ThingQueryCommand.JsonFields.JSON_THING_ID); return of(thingId, dittoHeaders); }); }
.selectedFields(selectedFieldsFrom(adaptable)).build()); mappingStrategies.put(RetrieveAcl.TYPE, adaptable -> RetrieveAcl.of(thingIdFrom(adaptable), dittoHeadersFrom(adaptable)));
.selectedFields(selectedFieldsFrom(adaptable)).build()); mappingStrategies.put(RetrieveAcl.TYPE, adaptable -> RetrieveAcl.of(thingIdFrom(adaptable), dittoHeadersFrom(adaptable)));
private Route thingsEntryAcl(final RequestContext ctx, final DittoHeaders dittoHeaders, final String thingId) { return rawPathPrefix(mergeDoubleSlashes().concat(PATH_ACL), () -> // /things/<thingId>/acl pathEndOrSingleSlash(() -> route( get(() -> // GET /things/<thingId>/acl handlePerRequest(ctx, RetrieveAcl.of(thingId, dittoHeaders)) ), put(() -> // PUT /things/<thingId>/acl extractDataBytes(payloadSource -> handlePerRequest(ctx, dittoHeaders, payloadSource, aclJson -> ModifyAcl.of(thingId, ThingsModelFactory.newAcl(aclJson), dittoHeaders)) ) ) ) ) ); }