use of com.sun.identity.federation.jaxb.entityconfig.AttributeType in project OpenAM by OpenRock.
the class IDFFModelImpl method addAttributeType.
private BaseConfigType addAttributeType(Map values, BaseConfigType bctype) throws JAXBException {
ObjectFactory objFactory = new ObjectFactory();
for (Iterator iter = values.keySet().iterator(); iter.hasNext(); ) {
AttributeType avp = objFactory.createAttributeElement();
String key = (String) iter.next();
avp.setName(key);
avp.getValue().addAll(Collections.EMPTY_LIST);
bctype.getAttribute().add(avp);
}
return bctype;
}
use of com.sun.identity.federation.jaxb.entityconfig.AttributeType in project OpenAM by OpenRock.
the class IDFFModelImpl method createEntityConfig.
public void createEntityConfig(String realm, String entityName, String role, String location) throws AMConsoleException {
try {
IDFFMetaManager idffMetaMgr = getIDFFMetaManager();
ObjectFactory objFactory = new ObjectFactory();
// Check whether the entity id existed in the DS
EntityDescriptorElement entityDesc = idffMetaMgr.getEntityDescriptor(realm, entityName);
if (entityDesc == null) {
throw new AMConsoleException("invalid.entity.name");
}
EntityConfigElement entityConfig = idffMetaMgr.getEntityConfig(realm, entityName);
if (entityConfig == null) {
entityConfig = objFactory.createEntityConfigElement();
// add to entityConfig
entityConfig.setEntityID(entityName);
if (location.equals("remote")) {
entityConfig.setHosted(false);
} else {
entityConfig.setHosted(true);
}
}
// create entity config and add the attribute
BaseConfigType baseCfgType = null;
// It could have one sp and one idp.
if ((role.equals(IFSConstants.SP)) && (IDFFMetaUtils.getSPDescriptor(entityDesc) != null)) {
baseCfgType = objFactory.createSPDescriptorConfigElement();
for (Iterator iter = extendedMetaMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
for (Iterator iter = extendedMetaSpMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
entityConfig.getSPDescriptorConfig().add(baseCfgType);
} else if ((role.equals(IFSConstants.IDP)) && (IDFFMetaUtils.getIDPDescriptor(entityDesc) != null)) {
baseCfgType = objFactory.createIDPDescriptorConfigElement();
for (Iterator iter = extendedMetaMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
for (Iterator iter = extendedMetaIdpMap.keySet().iterator(); iter.hasNext(); ) {
AttributeType atype = objFactory.createAttributeType();
String key = (String) iter.next();
atype.setName(key);
atype.getValue().addAll(Collections.EMPTY_LIST);
baseCfgType.getAttribute().add(atype);
}
entityConfig.getIDPDescriptorConfig().add(baseCfgType);
}
idffMetaMgr.setEntityConfig(realm, entityConfig);
} catch (IDFFMetaException e) {
throw new AMConsoleException(getErrorString(e));
} catch (JAXBException e) {
throw new AMConsoleException(getErrorString(e));
}
}
Aggregations