/* * Copyright 2017 Graz University of Technology EAAF-Core Components has been developed in a * cooperation between EGIZ, A-SIT Plus, A-SIT, and Graz University of Technology. * * Licensed under the EUPL, Version 1.2 or - as soon they will be approved by the European * Commission - subsequent versions of the EUPL (the "Licence"); You may not use this work except in * compliance with the Licence. You may obtain a copy of the Licence at: * https://joinup.ec.europa.eu/news/understanding-eupl-v12 * * Unless required by applicable law or agreed to in writing, software distributed under the Licence * is distributed on an "AS IS" basis, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express * or implied. See the Licence for the specific language governing permissions and limitations under * the Licence. * * This product combines work with different licenses. See the "NOTICE" text file for details on the * various modules and licenses. The "NOTICE" text file is part of the distribution. Any derivative * works that you distribute must include a readable copy of the "NOTICE" text file. */ package at.gv.egiz.eaaf.modules.pvp2.impl.reqattr; import java.util.ArrayList; import java.util.Collections; import java.util.List; import at.gv.egiz.eaaf.modules.pvp2.api.reqattr.EaafRequestedAttribute; import org.opensaml.core.xml.XMLObject; import org.opensaml.core.xml.schema.XSBooleanValue; import org.opensaml.core.xml.util.AttributeMap; import org.opensaml.core.xml.util.XMLObjectChildrenList; import org.opensaml.saml.common.AbstractSAMLObject; public class EaafRequestedAttributeImpl extends AbstractSAMLObject implements EaafRequestedAttribute { private final XMLObjectChildrenList attributeValues; private String friendlyName; private String isRequired; private String name; private String nameFormat; private AttributeMap unknownAttributes; /** * Build an EAAF specific requested attribute. * * @param namespaceUri Attribute namespace * @param elementLocalName Attribute name * @param namespacePrefix Attribute namespace prefix */ public EaafRequestedAttributeImpl(final String namespaceUri, final String elementLocalName, final String namespacePrefix) { super(namespaceUri, elementLocalName, namespacePrefix); unknownAttributes = new AttributeMap(this); attributeValues = new XMLObjectChildrenList<>(this); } @Override public final List getAttributeValues() { return attributeValues; } @Override public final String getFriendlyName() { return friendlyName; } @Override public final String getIsRequiredXsBoolean() { return isRequired; } @Override public final String getName() { return name; } @Override public final String getNameFormat() { return nameFormat; } @Override public final List getOrderedChildren() { final List children = new ArrayList<>(); children.addAll(attributeValues); return Collections.unmodifiableList(children); } @Override public final AttributeMap getUnknownAttributes() { return unknownAttributes; } @Override public final void setFriendlyName(final String newFriendlyName) { this.friendlyName = prepareForAssignment(this.friendlyName, newFriendlyName); } @Override public void setIsRequired(final Boolean aboolean) { this.isRequired = String.valueOf(aboolean); } @Override public void setIsRequired(final XSBooleanValue xsBooleanValue) { this.isRequired = String.valueOf(xsBooleanValue); } @Override public final void setIsRequired(final String newIsRequired) { isRequired = prepareForAssignment(this.isRequired, newIsRequired); } @Override public final void setName(final String newName) { this.name = prepareForAssignment(this.name, newName); } @Override public final void setNameFormat(final String newNameFormat) { this.nameFormat = prepareForAssignment(this.nameFormat, newNameFormat); } public final void setUnknownAttributes(final AttributeMap newUnknownAttr) { this.unknownAttributes = newUnknownAttr; } @Override public XSBooleanValue isRequiredXSBoolean() { return XSBooleanValue.valueOf(isRequired); } @Override public Boolean isRequired() { return Boolean.parseBoolean(isRequired); } }