StatusCode.java revision a688bcbb4bcff5398fdd29b86f83450257dc0df4
/**
* DO NOT ALTER OR REMOVE COPYRIGHT NOTICES OR THIS HEADER.
*
* Copyright (c) 2006 Sun Microsystems Inc. All Rights Reserved
*
* The contents of this file are subject to the terms
* of the Common Development and Distribution License
* (the License). You may not use this file except in
* compliance with the License.
*
* You can obtain a copy of the License at
* See the License for the specific language governing
* permission and limitations under the License.
*
* When distributing Covered Code, include this CDDL
* Header Notice in each file and include the License file
* at opensso/legal/CDDLv1.0.txt.
* If applicable, add the following below the CDDL Header,
* with the fields enclosed by brackets [] replaced by
* your own identifying information:
* "Portions Copyrighted [year] [name of copyright owner]"
*
* $Id: StatusCode.java,v 1.2 2008/06/25 05:47:37 qcheng Exp $
*
*/
/**
* This class represents the <code>StatusCode</code> and
* <code>SubStatusCode</code> element. It corresponds to
* <code>samlp:StatusCodeType</code> in SAML protocol schema.
*
* @supported.all.api
*/
public class StatusCode {
/**
* This is the default constructor of <code>StatusCode</code>.
*/
StatusCode() {
}
/**
* Constructs an instance of <code>StatusCode</code> from a DOM element.
*
* @param statusCode An DOM Element that's rooted by
* <code><StatusCode></code>.
* @exception SAMLException when an error occurs.
*/
if (statusCode == null) {
throw new SAMLRequesterException(
}
throw new SAMLRequesterException(
}
throw new SAMLRequesterException(
}
"StatusCode");
if (length == 1) {
} else if (length != 0) {
+ " <StatusCode> in element " + tagName);
}
throw new SAMLRequesterException(
}
}
/**
* Construct a <code>StatusCode</code> object from a value String and a sub
* <code>StatusCode</code>.
*
* @param value The value of the <code>StatusCode</code>. This could be
* prefixed by <code>samlp:</code>. If it is not prefixed, or
* prefixed by prefix other than <code>samlp:</code>,
* <code>samlp:</code> will be used instead.
* @param subCode The optional sub <code>StatusCode</code>.
* @exception SAMLException if value string is null, empty, or contains
* wrong value.
*/
}
/**
* Construct a <code>StatusCode</code> object from a value String.
*
* @param value The value of the <code>StatusCode</code>. This could be
* prefixed by <code>samlp:</code>. It it is not prefixed, or
* prefixed by prefix other than <code>samlp:</code>,
* <code>samlp:</code> will be used instead.
* @exception SAMLException if value string is null, empty, or contains
* wrong value.
*/
}
throw new SAMLRequesterException(
}
} else {
throw new SAMLRequesterException(
}
return value;
}
}
/**
* Sets the sub <code>StatusCode</code>.
* @param subcode <code>StatusCode</code> to be included.
*/
}
/**
* Gets the sub <code>StatusCode</code> of the <code>StatusCode</code>.
* @return <code>StatusCode</code>.
*/
public StatusCode getStatusCode() {
return subStatusCode;
}
/**
* Gets the value of the <code>StatusCode</code>.
* @return A String representing the value of the <code>StatusCode</code>.
*/
return value;
}
/**
* Translates the <code>StatusCode</code> to an XML document String
* based on the SAML schema.
* @return An XML String representing the <code>StatusCode</code>.
*/
return toString(true, false);
}
/**
* Creates a String representation of the
* <code><samlp:StatusCode></code> element.
*
* @param includeNS 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 containing the valid XML for this element.
*/
if (includeNS) {
}
if (declareNS) {
}
append(" Value=\"");
} else {
try {
} catch (SAMLException e) {
}
}
if ((subStatusCode != null) &&
}
}
}