use of com.sun.identity.xacml.policy.Obligation in project OpenAM by OpenRock.
the class ObligationsImpl method toXMLString.
/**
* Returns a string representation of this object
* @param includeNSPrefix Determines whether or not the namespace qualifier
* is prepended to the Element when converted
* @param declareNS Determines whether or not the namespace is declared
* within the Element.
* @return a string representation
* @exception XACMLException if conversion fails for any reason
*/
public String toXMLString(boolean includeNSPrefix, boolean declareNS) throws XACMLException {
StringBuffer sb = new StringBuffer(2000);
String nsPrefix = "";
String nsDeclaration = "";
if (includeNSPrefix) {
nsPrefix = XACMLConstants.XACML_NS_PREFIX + ":";
}
if (declareNS) {
nsDeclaration = XACMLConstants.XACML_NS_DECLARATION;
}
sb.append("<").append(nsPrefix).append(XACMLConstants.OBLIGATIONS).append(" ").append(nsDeclaration).append(">\n");
int length = 0;
if (obligations != null) {
length = obligations.size();
for (int i = 0; i < length; i++) {
Obligation obligation = (Obligation) obligations.get(i);
sb.append(obligation.toXMLString(includeNSPrefix, false));
}
}
sb.append("</").append(nsPrefix).append(XACMLConstants.OBLIGATIONS).append(">\n");
return sb.toString();
}
use of com.sun.identity.xacml.policy.Obligation in project OpenAM by OpenRock.
the class ObligationsImpl method setObligations.
/**
* Sets the <code>Obligation</code> objects of this
* <code>Obligations</code>
*
* @param obligations the <code>Obligation</code> objects to set in this
* <code>Obligations</code>
* @throws XACMLException if the object is immutable.
*/
public void setObligations(List obligations) throws XACMLException {
if (!mutable) {
throw new XACMLException(XACMLSDKUtils.xacmlResourceBundle.getString("objectImmutable"));
}
if (obligations != null) {
Iterator iter = obligations.iterator();
this.obligations = new ArrayList();
while (iter.hasNext()) {
Obligation obligation = (Obligation) iter.next();
this.obligations.add(obligation);
}
} else {
obligations = null;
}
}
Aggregations