private JsonObject lazyLoadThingJsonObject() { if (thing == null) { thing = JsonFactory.readFrom(thingPlainJson).asObject(); } return thing; }
private static void handleObject(final String path, final JsonValue value, final List<Document> flatAttributes) { final JsonObject jsonObject = value.asObject(); jsonObject.getKeys().forEach(key -> { final String newPath = path + PersistenceConstants.SLASH + key; final JsonValue innerValue = jsonObject.getValue(key).orElse(null); toFlatAttributesList(newPath, innerValue, flatAttributes); }); }
private ConnectionData tryToCreateConnectionDataFrom(final JsonValue json) { try { return ConnectionData.fromJson(json.asObject()); } catch (final UnsupportedOperationException | JsonParseException e) { if (system != null) { system.log().error(e, "Could not deserialize JSON: '{}'", json); } else { System.err.println("Could not deserialize JSON: '" + json + "': " + e.getMessage()); } return null; } }
@Override public RetrieveAttributesResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, entity.asObject(), getDittoHeaders()); }
@Override public RetrieveFeaturePropertiesResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, featureId, entity.asObject(), getDittoHeaders()); }
@Override public RetrieveThingResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, entity.asObject(), getDittoHeaders()); }
@Override public RetrieveFeaturesResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, entity.asObject(), getDittoHeaders()); }
@Override public RetrieveResourceResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(policyId, label, resourceKey, entity.asObject(), getDittoHeaders()); }
@Override public RetrievePolicyEntriesResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(policyId, entity.asObject(), getDittoHeaders()); }
@Override public RetrievePolicyResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(policyId, entity.asObject(), getDittoHeaders()); }
@Override public RetrieveSubjectsResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(policyId, label, entity.asObject(), getDittoHeaders()); }
@Override public RetrievePolicyEntryResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(policyId, policyEntryLabel, entity.asObject(), getDittoHeaders()); }
@Override public RetrieveSubjectResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(policyId, label, subjectId, entity.asObject(), getDittoHeaders()); }
@Override public SudoRetrievePolicyResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(policyId, entity.asObject(), getDittoHeaders()); }
@Override public RetrieveFeatureResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(thingId, getFeatureId(), entity.asObject(), getDittoHeaders()); }
public static PolicyErrorResponse fromJson(final JsonObject jsonObject, final DittoHeaders dittoHeaders) { final String policyId = jsonObject.getValueOrThrow(PolicyCommandResponse.JsonFields.JSON_POLICY_ID); final JsonObject payload = jsonObject.getValueOrThrow(PolicyCommandResponse.JsonFields.PAYLOAD).asObject(); final DittoRuntimeException exception = POLICY_ERROR_REGISTRY.parse(payload, dittoHeaders); return of(policyId, exception, dittoHeaders); }
private T parseEvent(final JsonValue jsonValue) { final JsonObject jsonObject = jsonValue.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(jsonObject, DittoHeaders.empty()); }
@Override public SudoRetrieveNamespaceReportResponse setEntity(final JsonValue entity) { checkNotNull(entity, "entity"); return of(SearchNamespaceReportResult.fromJson(entity.asObject()), getDittoHeaders()); }
private Event createEventFrom(final JsonValue json) { final JsonObject jsonObject = json.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(migrateComplex(migratePayload(jsonObject)), DittoHeaders.empty()); }
private PolicyEvent createEventFrom(final JsonValue json) { final JsonObject jsonObject = json.asObject() .setValue(Event.JsonFields.REVISION.getPointer(), Event.DEFAULT_REVISION); return eventRegistry.parse(migrateComplex(migratePayload(jsonObject)), DittoHeaders.empty()); }