}
private SubjectType createSubject(String reqTradeAppr, String reqCreditAppr, int buyPrice)
{
//Create a subject type
SubjectType subject = new SubjectType();
subject.setSubjectCategory("urn:oasis:names:tc:xacml:1.0:subject-category:access-subject");
//create the subject attributes
AttributeType attSubjectID = RequestAttributeFactory.createStringAttributeType(
"urn:oasis:names:tc:xacml:1.0:subject:subject-id", "xacml20.interop.com", "123456");
subject.getAttribute().add(attSubjectID);
AttributeType attUserName = RequestAttributeFactory.createStringAttributeType(
"urn:xacml:2.0:interop:example:subject:user-name", "xacml20.interop.com", "John Smith");
subject.getAttribute().add(attUserName);
AttributeType attBuyNumShares = RequestAttributeFactory.createIntegerAttributeType(
"urn:xacml:2.0:interop:example:subject:buy-num-shares", "xacml20.interop.com", 1000);
subject.getAttribute().add(attBuyNumShares);
AttributeType attBuyOfferShare = RequestAttributeFactory.createIntegerAttributeType(
"urn:xacml:2.0:interop:example:subject:buy-offer-price", "xacml20.interop.com", buyPrice);
subject.getAttribute().add(attBuyOfferShare);
AttributeType attRequestExtCred = RequestAttributeFactory.createStringAttributeType(
"urn:xacml:2.0:interop:example:subject:req-credit-ext-approval", "xacml20.interop.com", reqCreditAppr);
subject.getAttribute().add(attRequestExtCred);
AttributeType attRequestTradeApproval = RequestAttributeFactory.createStringAttributeType(
"urn:xacml:2.0:interop:example:subject:req-trade-approval", "xacml20.interop.com", reqTradeAppr);
subject.getAttribute().add(attRequestTradeApproval);
return subject;
}