/** * Creates a response to a {@code RetrievePolicy} command. * * @param policyId the Policy ID of the retrieved Policy. * @param policy the retrieved Policy. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static RetrievePolicyResponse of(final String policyId, final Policy policy, final DittoHeaders dittoHeaders) { return new RetrievePolicyResponse(policyId, HttpStatusCode.OK, checkNotNull(policy, "Policy").toJson( dittoHeaders.getSchemaVersion().orElse(policy.getLatestSchemaVersion())), dittoHeaders); }
/** * Creates a response to a {@code RetrievePolicy} command. * * @param policyId the Policy ID of the retrieved Policy. * @param policy the retrieved Policy. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static RetrievePolicyResponse of(final String policyId, final Policy policy, final DittoHeaders dittoHeaders) { return new RetrievePolicyResponse(policyId, HttpStatusCode.OK, checkNotNull(policy, "Policy").toJson( dittoHeaders.getSchemaVersion().orElse(policy.getLatestSchemaVersion())), dittoHeaders); }
/** * Creates a response to a {@code SudoRetrievePolicyResponse} command. * * @param policyId the Policy ID. * @param policy the retrieved Policy. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static SudoRetrievePolicyResponse of(final String policyId, final Policy policy, final DittoHeaders dittoHeaders) { return new SudoRetrievePolicyResponse(policyId, HttpStatusCode.OK, // checkNotNull(policy, "Policy") // .toJson(dittoHeaders.getSchemaVersion().orElse(policy.getLatestSchemaVersion()), FieldType.regularOrSpecial()), dittoHeaders); }
/** * Creates a response to a {@code SudoRetrievePolicyResponse} command. * * @param policyId the Policy ID. * @param policy the retrieved Policy. * @param dittoHeaders the headers of the preceding command. * @return the response. * @throws NullPointerException if any argument is {@code null}. */ public static SudoRetrievePolicyResponse of(final String policyId, final Policy policy, final DittoHeaders dittoHeaders) { return new SudoRetrievePolicyResponse(policyId, HttpStatusCode.OK, // checkNotNull(policy, "Policy") // .toJson(dittoHeaders.getSchemaVersion().orElse(policy.getLatestSchemaVersion()), FieldType.regularOrSpecial()), dittoHeaders); }