本文整理了Java中org.opensaml.core.xml.util.AttributeMap.get()
方法的一些代码示例,展示了AttributeMap.get()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。AttributeMap.get()
方法的具体详情如下:
包路径:org.opensaml.core.xml.util.AttributeMap
类名称:AttributeMap
方法名:get
暂无
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml
/**
* Deregister an attribute as having a type of ID.
*
* @param attributeName the QName of the ID attribute to be de-registered
*/
public void deregisterID(QName attributeName) {
if (idAttribNames.contains(attributeName)) {
idAttribNames.remove(attributeName);
}
// In case attribute already has a value,
// deregister the current value mapping with the XMLObject owner.
if (containsKey(attributeName)) {
attributeOwner.getIDIndex().deregisterIDMapping(get(attributeName));
}
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml
/**
* Register an attribute as having a type of ID.
*
* @param attributeName the QName of the ID attribute to be registered
*/
public void registerID(QName attributeName) {
if (! idAttribNames.contains(attributeName)) {
idAttribNames.add(attributeName);
}
// In case attribute already has a value,
// register the current value mapping with the XMLObject owner.
if (containsKey(attributeName)) {
attributeOwner.getIDIndex().registerIDMapping(get(attributeName), attributeOwner);
}
}
代码示例来源:origin: org.opensaml/opensaml-core
/**
* Deregister an attribute as having a type of ID.
*
* @param attributeName the QName of the ID attribute to be de-registered
*/
public void deregisterID(QName attributeName) {
if (idAttribNames.contains(attributeName)) {
idAttribNames.remove(attributeName);
}
// In case attribute already has a value,
// deregister the current value mapping with the XMLObject owner.
if (containsKey(attributeName)) {
attributeOwner.getIDIndex().deregisterIDMapping(get(attributeName));
}
}
代码示例来源:origin: org.opensaml/opensaml-core
/**
* Register an attribute as having a type of ID.
*
* @param attributeName the QName of the ID attribute to be registered
*/
public void registerID(QName attributeName) {
if (! idAttribNames.contains(attributeName)) {
idAttribNames.add(attributeName);
}
// In case attribute already has a value,
// register the current value mapping with the XMLObject owner.
if (containsKey(attributeName)) {
attributeOwner.getIDIndex().registerIDMapping(get(attributeName), attributeOwner);
}
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Gets the soap12:encodingStyle
.
*
* @param soapObject the SOAP object which may contain the encoding style
*
* @return the encoding style or null if it is not set on the object
*/
@Nullable public static String getSOAP12EncodingStyleAttribute(@Nonnull final XMLObject soapObject) {
String style = null;
if (soapObject instanceof org.opensaml.soap.soap12.EncodingStyleBearing) {
style = ((org.opensaml.soap.soap12.EncodingStyleBearing) soapObject).getSOAP12EncodingStyle();
}
if (style == null && soapObject instanceof AttributeExtensibleXMLObject) {
style = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject)
.getUnknownAttributes().get(
org.opensaml.soap.soap12.EncodingStyleBearing.SOAP12_ENCODING_STYLE_ATTR_NAME));
}
return style;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Gets the soap12:role
.
*
* @param soapObject the SOAP object which may contain the role
*
* @return the role or null if it is not set on the object
*/
@Nullable public static String getSOAP12RoleAttribute(@Nonnull final XMLObject soapObject) {
String role = null;
if (soapObject instanceof org.opensaml.soap.soap12.RoleBearing) {
role = ((org.opensaml.soap.soap12.RoleBearing) soapObject).getSOAP12Role();
}
if (role == null && soapObject instanceof AttributeExtensibleXMLObject) {
role = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject)
.getUnknownAttributes().get(
org.opensaml.soap.soap12.RoleBearing.SOAP12_ROLE_ATTR_LOCAL_NAME));
}
return role;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Get the soap11:mustUnderstand
attribute from a given SOAP object.
*
* @param soapObject the SOAP object to add the attribute to
*
* @return value of the mustUnderstand attribute, or false if not present
*/
public static boolean getSOAP11MustUnderstandAttribute(@Nonnull final XMLObject soapObject) {
if (soapObject instanceof MustUnderstandBearing) {
XSBooleanValue value = ((MustUnderstandBearing) soapObject).isSOAP11MustUnderstandXSBoolean();
if (value != null) {
return value.getValue();
}
}
if (soapObject instanceof AttributeExtensibleXMLObject) {
String value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject)
.getUnknownAttributes().get(MustUnderstandBearing.SOAP11_MUST_UNDERSTAND_ATTR_NAME));
return Objects.equals("1", value) || Objects.equals("true", value);
}
return false;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Get the soap12:relay
attribute from a given SOAP object.
*
* @param soapObject the SOAP object to add the attribute to
*
* @return value of the relay attribute, or false if not present
*/
public static boolean getSOAP12RelayAttribute(@Nonnull final XMLObject soapObject) {
if (soapObject instanceof org.opensaml.soap.soap12.RelayBearing) {
XSBooleanValue value = ((org.opensaml.soap.soap12.RelayBearing) soapObject).isSOAP12RelayXSBoolean();
if (value != null) {
return value.getValue();
}
}
if (soapObject instanceof AttributeExtensibleXMLObject) {
String value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject)
.getUnknownAttributes().get(org.opensaml.soap.soap12.RelayBearing.SOAP12_RELAY_ATTR_LOCAL_NAME));
return Objects.equals("1", value) || Objects.equals("true", value);
}
return false;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Gets the list value of the soap11:encodingStyle
attribute from the given SOAP object.
*
* @param soapObject the SOAP object to add the attribute to
*
* @return the list of encoding styles, or null if not present
*/
@Nullable public static List
if (soapObject instanceof EncodingStyleBearing) {
List
if (value != null) {
return value;
}
}
if (soapObject instanceof AttributeExtensibleXMLObject) {
String value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject)
.getUnknownAttributes().get(EncodingStyleBearing.SOAP11_ENCODING_STYLE_ATTR_NAME));
if (value != null) {
StringSupport.stringToList(value, XMLConstants.LIST_DELIMITERS);
}
}
return null;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Get the wsa:IsReferenceParameter
attribute from a given SOAP object.
*
* @param soapObject the SOAP object to add the attribute to
*
* @return value of the IsReferenceParameter attribute, or false if not present
*/
public static boolean getWSAIsReferenceParameter(XMLObject soapObject) {
if (soapObject instanceof IsReferenceParameterBearing) {
XSBooleanValue value = ((IsReferenceParameterBearing)soapObject).isWSAIsReferenceParameterXSBoolean();
if (value != null) {
return value.getValue();
}
}
if (soapObject instanceof AttributeExtensibleXMLObject) {
String valueStr = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)soapObject)
.getUnknownAttributes().get(IsReferenceParameterBearing.WSA_IS_REFERENCE_PARAMETER_ATTR_NAME));
return Objects.equals("1", valueStr) || Objects.equals("true", valueStr);
}
return false;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Gets the soap11:actor
attribute from a given SOAP object.
*
* @param soapObject the SOAP object to add the attribute to
*
* @return the value of the actor attribute, or null if not present
*/
@Nullable public static String getSOAP11ActorAttribute(@Nonnull final XMLObject soapObject) {
String value = null;
if (soapObject instanceof ActorBearing) {
value = StringSupport.trimOrNull(((ActorBearing) soapObject).getSOAP11Actor());
if (value != null) {
return value;
}
}
if (soapObject instanceof AttributeExtensibleXMLObject) {
value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject) soapObject)
.getUnknownAttributes().get(ActorBearing.SOAP11_ACTOR_ATTR_NAME));
return value;
}
return null;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Adds a single wsse:Usage
value to the given SOAP object. If an existing wsse:Usage
* attribute is present, the given usage will be added to the existing list.
*
* @param soapObject the SOAP object to add the attribute to
* @param usage the usage to add
*/
public static void addWSSEUsage(XMLObject soapObject, String usage) {
if (soapObject instanceof UsageBearing) {
UsageBearing usageBearing = (UsageBearing) soapObject;
List
if (list == null) {
list = new LazyList<>();
usageBearing.setWSSEUsages(list);
}
list.add(usage);
} else if (soapObject instanceof AttributeExtensibleXMLObject) {
AttributeMap am = ((AttributeExtensibleXMLObject)soapObject).getUnknownAttributes();
String list = am.get(UsageBearing.WSSE_USAGE_ATTR_NAME);
if (list == null) {
list = usage;
} else {
list = list + " " + usage;
}
am.put(UsageBearing.WSSE_USAGE_ATTR_NAME, list);
} else {
throw new IllegalArgumentException("Specified object was neither UsageBearing nor AttributeExtensible");
}
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Gets the wsse11:TokenType
attribute from a given SOAP object.
*
* @param soapObject the SOAP object to add the attribute to
*
* @return the value of the tokenType attribute, or null if not present
*/
public static String getWSSE11TokenType(XMLObject soapObject) {
String value = null;
if (soapObject instanceof TokenTypeBearing) {
value = StringSupport.trimOrNull(((TokenTypeBearing)soapObject).getWSSE11TokenType());
if (value != null) {
return value;
}
}
if (soapObject instanceof AttributeExtensibleXMLObject) {
value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)soapObject)
.getUnknownAttributes().get(TokenTypeBearing.WSSE11_TOKEN_TYPE_ATTR_NAME));
return value;
}
return null;
}
代码示例来源:origin: org.opensaml/opensaml-soap-api
/**
* Gets the list value of the wsse:Usage
attribute from the given SOAP object.
*
* @param soapObject the SOAP object to add the attribute to
*
* @return the list of usages, or null if not present
*/
public static List
if (soapObject instanceof UsageBearing) {
List
if (value != null) {
return value;
}
}
if (soapObject instanceof AttributeExtensibleXMLObject) {
String value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)soapObject)
.getUnknownAttributes().get(UsageBearing.WSSE_USAGE_ATTR_NAME));
if (value != null) {
StringSupport.stringToList(value, XMLConstants.LIST_DELIMITERS);
}
}
return null;
}
}
代码示例来源:origin: org.opensaml/opensaml-core
/**
* Gets the xml:lang
attribute from a given XML object.
*
* @param xmlObject the XML object from which to extract the attribute
*
* @return the value of the xml:lang attribute, or null if not present
*/
public static String getXMLLang(XMLObject xmlObject) {
String value = null;
if (xmlObject instanceof LangBearing) {
value = StringSupport.trimOrNull(((LangBearing)xmlObject).getXMLLang());
if (value != null) {
return value;
}
}
if (xmlObject instanceof AttributeExtensibleXMLObject) {
value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)xmlObject)
.getUnknownAttributes().get(LangBearing.XML_LANG_ATTR_NAME));
return value;
}
return null;
}
代码示例来源:origin: org.opensaml/opensaml-core
/**
* Gets the xml:id
attribute from a given XML object.
*
* @param xmlObject the XML object from which to extract the attribute
*
* @return the value of the xml:id attribute, or null if not present
*/
public static String getXMLId(XMLObject xmlObject) {
String value = null;
if (xmlObject instanceof IdBearing) {
value = StringSupport.trimOrNull(((IdBearing)xmlObject).getXMLId());
if (value != null) {
return value;
}
}
if (xmlObject instanceof AttributeExtensibleXMLObject) {
value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)xmlObject)
.getUnknownAttributes().get(IdBearing.XML_ID_ATTR_NAME));
return value;
}
return null;
}
代码示例来源:origin: org.opensaml/opensaml-core
/**
* Gets the xml:base
attribute from a given XML object.
*
* @param xmlObject the XML object from which to extract the attribute
*
* @return the value of the xml:base attribute, or null if not present
*/
public static String getXMLBase(XMLObject xmlObject) {
String value = null;
if (xmlObject instanceof BaseBearing) {
value = StringSupport.trimOrNull(((BaseBearing)xmlObject).getXMLBase());
if (value != null) {
return value;
}
}
if (xmlObject instanceof AttributeExtensibleXMLObject) {
value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)xmlObject)
.getUnknownAttributes().get(BaseBearing.XML_BASE_ATTR_NAME));
return value;
}
return null;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml
/**
* Gets the xml:lang
attribute from a given XML object.
*
* @param xmlObject the XML object from which to extract the attribute
*
* @return the value of the xml:lang attribute, or null if not present
*/
public static String getXMLLang(XMLObject xmlObject) {
String value = null;
if (xmlObject instanceof LangBearing) {
value = StringSupport.trimOrNull(((LangBearing)xmlObject).getXMLLang());
if (value != null) {
return value;
}
}
if (xmlObject instanceof AttributeExtensibleXMLObject) {
value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)xmlObject)
.getUnknownAttributes().get(LangBearing.XML_LANG_ATTR_NAME));
return value;
}
return null;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml
/**
* Gets the xml:base
attribute from a given XML object.
*
* @param xmlObject the XML object from which to extract the attribute
*
* @return the value of the xml:base attribute, or null if not present
*/
public static String getXMLBase(XMLObject xmlObject) {
String value = null;
if (xmlObject instanceof BaseBearing) {
value = StringSupport.trimOrNull(((BaseBearing)xmlObject).getXMLBase());
if (value != null) {
return value;
}
}
if (xmlObject instanceof AttributeExtensibleXMLObject) {
value = StringSupport.trimOrNull(((AttributeExtensibleXMLObject)xmlObject)
.getUnknownAttributes().get(BaseBearing.XML_BASE_ATTR_NAME));
return value;
}
return null;
}
代码示例来源:origin: org.apache.servicemix.bundles/org.apache.servicemix.bundles.opensaml
/** {@inheritDoc} */
public String put(QName attributeName, String value) {
Constraint.isNotNull(attributeName, "Attribute name cannot be null");
String oldValue = get(attributeName);
if (!Objects.equals(value, oldValue)) {
releaseDOM();
attributes.put(attributeName, value);
if (isIDAttribute(attributeName) || XMLObjectProviderRegistrySupport.isIDAttribute(attributeName)) {
attributeOwner.getIDIndex().deregisterIDMapping(oldValue);
attributeOwner.getIDIndex().registerIDMapping(value, attributeOwner);
}
if (!Strings.isNullOrEmpty(attributeName.getNamespaceURI())) {
if (value == null) {
attributeOwner.getNamespaceManager().deregisterAttributeName(attributeName);
} else {
attributeOwner.getNamespaceManager().registerAttributeName(attributeName);
}
}
checkAndDeregisterQNameValue(attributeName, oldValue);
checkAndRegisterQNameValue(attributeName, value);
}
return oldValue;
}