use of com.sun.identity.wsfederation.jaxb.entityconfig.AttributeElement in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method createAttributeElement.
/**
* Returns BaseConfig object after updating with Attribute Elements.
* @param values contain the keys for extended metadata attributes.
* @param bconfig is the BaseConfigType object passed.
*
* @return BaseConfig object after updating with Attribute Elements.
*/
private BaseConfigType createAttributeElement(Map values, BaseConfigType bconfig) throws AMConsoleException {
try {
ObjectFactory objFactory = new ObjectFactory();
for (Iterator iter = values.keySet().iterator(); iter.hasNext(); ) {
AttributeElement avp = objFactory.createAttributeElement();
String key = (String) iter.next();
avp.setName(key);
bconfig.getAttribute().add(avp);
}
} catch (JAXBException e) {
debug.warning("WSFedPropertiesModelImpl.createAttributeElement", e);
throw new AMConsoleException(e.getMessage());
}
return bconfig;
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.AttributeElement in project OpenAM by OpenRock.
the class WSFedPropertiesModelImpl method updateBaseConfig.
/**
* Updates the BaseConfig Object with the map of values passed.
*
* @param baseConfig is the BaseConfigType object passed.
* @param values the Map which contains the new attribute/value pairs.
* @throws AMConsoleException if update of baseconfig object fails.
*/
private void updateBaseConfig(BaseConfigType baseConfig, Map values, String role) throws AMConsoleException {
List attrList = baseConfig.getAttribute();
if (role.equals(EntityModel.IDENTITY_PROVIDER)) {
attrList.clear();
baseConfig = createAttributeElement(getIDPEXDataMap(), baseConfig);
attrList = baseConfig.getAttribute();
} else if (role.equals(EntityModel.SERVICE_PROVIDER)) {
attrList.clear();
baseConfig = createAttributeElement(getSPEXDataMap(), baseConfig);
attrList = baseConfig.getAttribute();
}
for (Iterator it = attrList.iterator(); it.hasNext(); ) {
AttributeElement avpnew = (AttributeElement) it.next();
String name = avpnew.getName();
if (values.keySet().contains(name)) {
Set set = (Set) values.get(name);
if (set != null) {
avpnew.getValue().clear();
avpnew.getValue().addAll(set);
}
}
}
}
use of com.sun.identity.wsfederation.jaxb.entityconfig.AttributeElement in project OpenAM by OpenRock.
the class WSFederationMetaUtils method setAttributes.
/**
* Sets attribute value pairs in <code>BaseConfigType</code>. NOTE -
* existing AVPs are discarded! The key is
* @param config the <code>BaseConfigType</code> object
* @param map mapping from attribute names to <code>List</code>s of
* attribute values;
*/
public static void setAttributes(BaseConfigType config, Map<String, List<String>> map) throws JAXBException {
JAXBContext jc = WSFederationMetaUtils.getMetaJAXBContext();
com.sun.identity.wsfederation.jaxb.entityconfig.ObjectFactory objFactory = new com.sun.identity.wsfederation.jaxb.entityconfig.ObjectFactory();
List attributeList = config.getAttribute();
attributeList.clear();
// add the new content
for (String key : map.keySet()) {
AttributeElement avp = objFactory.createAttributeElement();
avp.setName(key);
avp.getValue().addAll(map.get(key));
attributeList.add(avp);
}
}
Aggregations