/** * Returns a new {@code Subject} with the specified {@code subjectIssuerWithId} and {@code subjectType}. * * @param subjectIssuerWithId the Subject issuer + Subject ID (separated with a "{@value * SubjectId#ISSUER_DELIMITER}") of the Subject to create. * @param subjectType the SubjectType of the new Subject to create. * @return the new {@code Subject}. * @throws NullPointerException if any argument is {@code null}. */ static Subject newInstance(final CharSequence subjectIssuerWithId, final SubjectType subjectType) { return PoliciesModelFactory.newSubject(SubjectId.newInstance(subjectIssuerWithId), subjectType); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
@Override public ImmutablePolicyBuilder removeSubjectFor(final CharSequence label, final CharSequence subjectIssuerWithId) { final Map<SubjectId, Subject> existingSubject = retrieveExistingSubjects(label); existingSubject.remove(SubjectId.newInstance(subjectIssuerWithId)); return this; }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(PolicyQueryCommand.JsonFields.JSON_POLICY_ID, policyId, predicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
/** * Returns a new {@code Subject} with the specified {@code issuer}, {@code subject} and {@code subjectType}. * * @param issuer the character sequence for the SubjectId's {@code issuer}. * @param subject the character sequence for the SubjectId's {@code subject}. * @param subjectType the SubjectType of the new Subject to create. * @return the new {@code Subject}. * @throws NullPointerException if any argument is {@code null}. */ static Subject newInstance(final SubjectIssuer issuer, final CharSequence subject, final SubjectType subjectType) { return PoliciesModelFactory.newSubject(SubjectId.newInstance(issuer, subject), subjectType); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(PolicyModifyCommand.JsonFields.JSON_POLICY_ID, policyId, predicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
/** * Returns the Subject with the given subjectIssuerWithId or an empty optional. * * @param subjectIssuerWithId the Subject issuer + Subject ID (separated with a "{@value * SubjectId#ISSUER_DELIMITER}") of the Subject to be retrieved. * @return the Subject with the given subjectIssuerWithId or an empty optional. * @throws NullPointerException if {@code subjectIssuerWithId} is {@code null}. * @throws IllegalArgumentException if {@code subjectIssuerWithId} is empty. */ default Optional<Subject> getSubject(final CharSequence subjectIssuerWithId) { return getSubject(SubjectId.newInstance(subjectIssuerWithId)); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(PolicyModifyCommandResponse.JsonFields.JSON_POLICY_ID, policyId, predicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
/** * Removes the Subject with the given identifier from a copy of this Subjects. * * @param subjectIssuerWithId the Subject issuer + Subject ID (separated with a "{@value * SubjectId#ISSUER_DELIMITER}") of the Subject to be removed. * @return a copy of this Subjects with {@code subject} removed. * @throws NullPointerException if {@code subjectIssuerWithId} is {@code null}. * @throws IllegalArgumentException if {@code subjectIssuerWithId} is empty. */ default Subjects removeSubject(final CharSequence subjectIssuerWithId) { return removeSubject(SubjectId.newInstance(subjectIssuerWithId)); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(PolicyModifyCommand.JsonFields.JSON_POLICY_ID, policyId, predicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
/** * Removes the Subject with the given {@code issuer} and {@code subject} from a copy of this Subjects. * * @param issuer the SubjectId's {@code issuer} of the Subject to be removed. * @param subject the character sequence for the SubjectId's {@code subject} of the Subject to be removed. * @return a copy of this Subjects with {@code subject} removed. * @throws NullPointerException if {@code subjectId} is {@code null}. * @throws IllegalArgumentException if {@code subject} is empty. */ default Subjects removeSubject(final SubjectIssuer issuer, final CharSequence subject) { return removeSubject(SubjectId.newInstance(issuer, subject)); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(PolicyQueryCommand.JsonFields.JSON_POLICY_ID, policyId, predicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
/** * Returns a new {@code Subject} with the specified {@code issuer}, {@code subject} and * subject type {@link SubjectType#GENERATED}. * * @param issuer the character sequence for the SubjectId's {@code issuer}. * @param subject the character sequence for the SubjectId's {@code subject}. * @return the new {@code Subject}. * @throws NullPointerException if any argument is {@code null}. */ static Subject newInstance(final SubjectIssuer issuer, final CharSequence subject) { return PoliciesModelFactory.newSubject(SubjectId.newInstance(issuer, subject)); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(PolicyModifyCommandResponse.JsonFields.JSON_POLICY_ID, policyId, predicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subjectId.toString(), predicate); }
/** * Returns the Subject with the given {@code issuer} and {@code subject} or an empty optional. * * @param issuer the SubjectId's {@code issuer} of the Subject to be retrieved. * @param subject the character sequence for the SubjectId's {@code subject} of the Subject to be retrieved. * @return the Subject with the given subjectId or an empty optional. * @throws NullPointerException if {@code subjectId} is {@code null}. * @throws IllegalArgumentException if {@code subject} is empty. */ default Optional<Subject> getSubject(final SubjectIssuer issuer, final CharSequence subject) { return getSubject(SubjectId.newInstance(issuer, subject)); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subject.getId().toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT, subject.toJson(schemaVersion, thePredicate), predicate); }
/** * Removes the subject identified by the specified {@code issuer} and {@code subject} from this builder. * * @param label the label identifying the PolicyEntry to modify. * @param issuer the SubjectId's {@code issuer} to remove from the PolicyEntry identified by the {@code label}. * @param subject the character sequence for the SubjectId's {@code subject} to remove from the PolicyEntry * identified by the {@code label}. * @return this builder to allow method chaining. * @throws NullPointerException if any argument is {@code null}. * @throws IllegalArgumentException if {@code label} is empty. */ default PolicyBuilder removeSubjectFor(final CharSequence label, final SubjectIssuer issuer, final CharSequence subject) { return removeSubjectFor(label, SubjectId.newInstance(issuer, subject)); }
@Override protected void appendPayload(final JsonObjectBuilder jsonObjectBuilder, final JsonSchemaVersion schemaVersion, final Predicate<JsonField> thePredicate) { final Predicate<JsonField> predicate = schemaVersion.and(thePredicate); jsonObjectBuilder.set(JSON_LABEL, label.toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT_ID, subject.getId().toString(), predicate); jsonObjectBuilder.set(JSON_SUBJECT, subject.toJson(schemaVersion, thePredicate), predicate); }
/** * Removes the subject identified by the specified {@code subjectIssuerWithId} from this builder. * * @param subjectIssuerWithId the Subject issuer + Subject ID (separated with a "{@value * SubjectId#ISSUER_DELIMITER}") of the Subject to remove from the PolicyEntry identified by the {@code label}. * @return this builder to allow method chaining. * @throws NullPointerException if any argument is {@code null}. */ default LabelScoped removeSubject(final CharSequence subjectIssuerWithId) { removeSubjectFor(getLabel(), SubjectId.newInstance(subjectIssuerWithId)); return this; }