/**
* 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: AttributeStatement.java,v 1.2 2008/06/25 05:47:31 qcheng Exp $
*
*/
/**
*The <code>AttributeStatement</code> element supplies a statement by the issuer
*that the specified subject is associated with the specified attributes.
*@supported.all.api
*/
/**
*Dafault constructor
*/
protected AttributeStatement() {
}
/**
* Constructs an <code>AttributStatement</code> element from an existing
* XML block
* @param element representing a DOM tree element
* @exception SAMLException if there is an error in the sender or in the
* element definition.
*/
// make sure input is not null
throw new SAMLRequesterException(
}
// check if it's an AttributeStatement
"AttributeStatement");
if (!valid) {
throw new SAMLRequesterException(
}
//Handle the children elements of AttributeStatement
if (nodeCount > 0) {
for (int i = 0; i < nodeCount; i++) {
"AttributeStatement: " +
" The tag name or tag namespace of child" +
" element is either null or empty.");
}
throw new SAMLRequesterException(
}
"AttributeStatement: "+
"should not contain more than one subject.");
}
throw new SAMLRequesterException(
"oneElement"));
} else {
this._subject =
}
if (_attributes == null) {
_attributes = new ArrayList();
}
(Element)currentNode))) {
"AttributeStatement:"+
" failed to add to the Attribute list.");
}
throw new SAMLRequesterException(
"addListError"));
}
} else {
"AttributeStatement:" +
"wrong element:" + tagName);
}
throw new SAMLRequesterException(
}
} //end of if (currentNode.getNodeType() == Node.ELEMENT_NODE)
} // end of for loop
} // end of if (nodeCount > 0)
// check if the subject is null
"AttributeStatement: missing Subject");
}
throw new SAMLRequesterException(
}
//check if the attribute is null
"should at least contain one Attribute element.");
}
throw new SAMLRequesterException(
}
}
/**
* Constructs an instance of <code>AttributeStatement</code>.
*
* @param subject (required) A Subject object.
* @param attribute (one or more) A List of Attribute objects.
* @exception SAMLException if there is an error in the sender.
*/
throws SAMLException {
// check if the subject is null
"missing subject.");
}
throw new SAMLRequesterException(
} else {
}
// check if containing any Attribute
"AttributeStatement: Attribute is required.");
}
throw new SAMLRequesterException(
}
if (_attributes == null) {
_attributes = new ArrayList();
}
}
/**
*Gets attribute from Attribute statement
*@return A list of Attributes contained in this statement
*/
return _attributes;
}
/**
*Gets the type of statement.
*@return an Integer which is Statement.ATTRIBUTE_STATEMENT.
*/
public int getStatementType() {
return Statement.ATTRIBUTE_STATEMENT;
}
/**
*Creates a String representation of the attribute statement
*@return A string representation of the <code>AttributeStatement</code>
* element
*/
return toString(true, false);
}
/**
* Returns a String representation of the Attribute statement.
*
* @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 representation of the
* <code><saml:AttributeStatement></code> element.
*/
if (includeNS) {
}
if (declareNS) {
}
}
}
throws SAMLException {
return new Subject(subjectElement);
}
throws SAMLException {
return new Attribute(attributeElement);
}
}