// if multiple assertions per user per user/subject/predicate are not allowed,
// throw an exception if a previous assertion exists
AsnOperation operation = context.getOperation();
boolean multipleAllowed = operation.getAuthPolicy().getMultiplePerUserSubjectPredicate();
if (!multipleAllowed) {
Assertion existing = this.getIndexAdapter().loadPreviousUserAssertion(context);
if (existing != null) {
String msg = "An assertion for this subject, predicate and user already exists.";
throw new AsnInvalidOperationException(msg);
}
}
// index the assertion
Assertion assertion = operation.getAssertionSet().newAssertion(context,true);
context.getAuthorizer().authorizeCreate(context,assertion);
this.getIndexAdapter().index(context,assertion);
// return the new assertion subject ID
String asnPfx = operation.getAssertionSet().getAssertionIdPrefix();
String msg = asnPfx+":"+assertion.getSystemPart().getAssertionId();
context.getOperationResponse().generateOkResponse(context,msg);
}