/** * Creates a new {@code SudoRetrieveThing}. The returned thing is serialized using its original schema version. * * @param thingId the ID of the Thing to be retrieved. * @param dittoHeaders the command headers of the request. * @return a command for retrieving a Thing without authorization. * @throws NullPointerException if any argument is {@code null} except the {@code selectedFields}. */ public static SudoRetrieveThing withOriginalSchemaVersion(final String thingId, final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, null, dittoHeaders, true); }
/** * Creates a new {@code SudoRetrieveThing}. The returned thing is serialized using its original schema version. * * @param thingId the ID of the Thing to be retrieved. * @param dittoHeaders the command headers of the request. * @return a command for retrieving a Thing without authorization. * @throws NullPointerException if any argument is {@code null} except the {@code selectedFields}. */ public static SudoRetrieveThing withOriginalSchemaVersion(final String thingId, final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, null, dittoHeaders, true); }
@Override public SudoRetrieveThing setDittoHeaders(final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, selectedFields, dittoHeaders, useOriginalSchemaVersion); }
@Override public SudoRetrieveThing setDittoHeaders(final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, selectedFields, dittoHeaders, useOriginalSchemaVersion); }
/** * Creates a new {@code SudoRetrieveThing}. The returned thing is serialized using its original schema version. * * @param thingId the ID of the Thing to be retrieved. * @param selectedFields the Fields which should be included in the Thing's JSON representation. * @param dittoHeaders the command headers of the request. * @return a command for retrieving a Thing without authorization. * @throws NullPointerException if any argument is {@code null} except the {@code selectedFields}. */ public static SudoRetrieveThing withOriginalSchemaVersion(final String thingId, @Nullable final JsonFieldSelector selectedFields, final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, selectedFields, dittoHeaders, true); }
/** * Creates a new {@code SudoRetrieveThing}. The returned thing is serialized using its original schema version. * * @param thingId the ID of the Thing to be retrieved. * @param selectedFields the Fields which should be included in the Thing's JSON representation. * @param dittoHeaders the command headers of the request. * @return a command for retrieving a Thing without authorization. * @throws NullPointerException if any argument is {@code null} except the {@code selectedFields}. */ public static SudoRetrieveThing withOriginalSchemaVersion(final String thingId, @Nullable final JsonFieldSelector selectedFields, final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, selectedFields, dittoHeaders, true); }
/** * Creates a new {@code SudoRetrieveThing}. * * @param thingId the ID of the Thing to be retrieved. * @param selectedFields the Fields which should be included in the Thing's JSON representation. * @param dittoHeaders the command headers of the request. * @return a command for retrieving a Thing without authorization. * @throws NullPointerException if any argument is {@code null} except the {@code selectedFields} */ public static SudoRetrieveThing of(final String thingId, @Nullable final JsonFieldSelector selectedFields, final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, selectedFields, dittoHeaders, false); }
/** * Creates a new {@code SudoRetrieveThing}. * * @param thingId the ID of the Thing to be retrieved. * @param selectedFields the Fields which should be included in the Thing's JSON representation. * @param dittoHeaders the command headers of the request. * @return a command for retrieving a Thing without authorization. * @throws NullPointerException if any argument is {@code null} except the {@code selectedFields} */ public static SudoRetrieveThing of(final String thingId, @Nullable final JsonFieldSelector selectedFields, final DittoHeaders dittoHeaders) { return new SudoRetrieveThing(thingId, selectedFields, dittoHeaders, false); }
/** * Creates a new {@code SudoRetrieveThing} from a JSON object. * * @param jsonObject the JSON string of which a new SudoRetrieveThing is to be created. * @param dittoHeaders the optional command headers of the request. * @return the SudoRetrieveThing which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static SudoRetrieveThing fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final String readThingId = jsonObject.getValueOrThrow(SudoCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector readFieldSelector = jsonObject.getValue(SudoCommand.JsonFields.SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build()) ) .orElse(null); final boolean isUseOriginalSchemaVersion = jsonObject.getValue(JSON_USE_ORIGINAL_SCHEMA_VERSION).orElse(false); return new SudoRetrieveThing(readThingId, readFieldSelector, dittoHeaders, isUseOriginalSchemaVersion); }
/** * Creates a new {@code SudoRetrieveThing} from a JSON object. * * @param jsonObject the JSON string of which a new SudoRetrieveThing is to be created. * @param dittoHeaders the optional command headers of the request. * @return the SudoRetrieveThing which was created from the given JSON object. * @throws NullPointerException if {@code jsonObject} is {@code null}. * @throws org.eclipse.ditto.json.JsonMissingFieldException if the passed in {@code jsonObject} was not in the * expected format. */ public static SudoRetrieveThing fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final String readThingId = jsonObject.getValueOrThrow(SudoCommand.JsonFields.JSON_THING_ID); final JsonFieldSelector readFieldSelector = jsonObject.getValue(SudoCommand.JsonFields.SELECTED_FIELDS) .map(str -> JsonFactory.newFieldSelector(str, JsonFactory.newParseOptionsBuilder() .withoutUrlDecoding() .build()) ) .orElse(null); final boolean isUseOriginalSchemaVersion = jsonObject.getValue(JSON_USE_ORIGINAL_SCHEMA_VERSION).orElse(false); return new SudoRetrieveThing(readThingId, readFieldSelector, dittoHeaders, isUseOriginalSchemaVersion); }