use of com.sun.identity.saml2.assertion.OneTimeUse in project OpenAM by OpenRock.
the class ConditionsImpl method toXMLString.
/**
* Returns a String representation
* @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 SAML2Exception if something is wrong during conversion
*/
public String toXMLString(boolean includeNSPrefix, boolean declareNS) throws SAML2Exception {
StringBuffer sb = new StringBuffer(2000);
String NS = "";
String appendNS = "";
if (declareNS) {
NS = SAML2Constants.ASSERTION_DECLARE_STR;
}
if (includeNSPrefix) {
appendNS = SAML2Constants.ASSERTION_PREFIX;
}
sb.append("<").append(appendNS).append(CONDITIONS_ELEMENT).append(NS);
String str = null;
if (notBefore != null) {
str = DateUtils.toUTCDateFormat(notBefore);
sb.append(" ").append(NOT_BEFORE_ATTR).append("=\"").append(str).append("\"");
}
if (notOnOrAfter != null) {
str = DateUtils.toUTCDateFormat(notOnOrAfter);
sb.append(" ").append(NOT_ON_OR_AFTER_ATTR).append("=\"").append(str).append("\"");
}
sb.append(">\n");
int length = 0;
if (conditions != null) {
length = conditions.size();
for (int i = 0; i < length; i++) {
Condition condition = (Condition) conditions.get(i);
sb.append(condition.toXMLString(includeNSPrefix, false));
}
}
if (audienceRestrictions != null) {
length = audienceRestrictions.size();
for (int i = 0; i < length; i++) {
AudienceRestriction ar = (AudienceRestriction) audienceRestrictions.get(i);
sb.append(ar.toXMLString(includeNSPrefix, false));
}
}
if (oneTimeUses != null) {
length = oneTimeUses.size();
for (int i = 0; i < length; i++) {
OneTimeUse ar = (OneTimeUse) oneTimeUses.get(i);
sb.append(ar.toXMLString(includeNSPrefix, false));
}
}
if (proxyRestrictions != null) {
length = proxyRestrictions.size();
for (int i = 0; i < length; i++) {
ProxyRestriction pr = (ProxyRestriction) proxyRestrictions.get(i);
sb.append(pr.toXMLString(includeNSPrefix, false));
}
}
sb.append("</").append(appendNS).append(CONDITIONS_ELEMENT).append(">\n");
return sb.toString();
}
use of com.sun.identity.saml2.assertion.OneTimeUse in project OpenAM by OpenRock.
the class ConditionsImpl method makeImmutable.
/**
* Makes the object immutable
*/
public void makeImmutable() {
if (isMutable) {
if (conditions != null) {
int length = conditions.size();
for (int i = 0; i < length; i++) {
Condition condition = (Condition) conditions.get(i);
condition.makeImmutable();
}
conditions = Collections.unmodifiableList(conditions);
}
if (audienceRestrictions != null) {
int length = audienceRestrictions.size();
for (int i = 0; i < length; i++) {
AudienceRestriction ar = (AudienceRestriction) audienceRestrictions.get(i);
ar.makeImmutable();
}
audienceRestrictions = Collections.unmodifiableList(audienceRestrictions);
}
if (oneTimeUses != null) {
int length = oneTimeUses.size();
for (int i = 0; i < length; i++) {
OneTimeUse oneTimeUse = (OneTimeUse) oneTimeUses.get(i);
oneTimeUse.makeImmutable();
}
oneTimeUses = Collections.unmodifiableList(oneTimeUses);
}
if (proxyRestrictions != null) {
int length = proxyRestrictions.size();
for (int i = 0; i < length; i++) {
ProxyRestriction pr = (ProxyRestriction) proxyRestrictions.get(i);
pr.makeImmutable();
}
proxyRestrictions = Collections.unmodifiableList(proxyRestrictions);
}
isMutable = false;
}
}
Aggregations