*
*/
private static HashMap getAllDefaultProfileAttributes(HashMap exoProfileAttrs) throws EMFInternalError {
SourceBean profileAttrsSB = getProfileAttributesSourceBean();
if (profileAttrsSB == null) {
throw new EMFInternalError(EMFErrorSeverity.ERROR,
"Profile attributes attribute not found in ConfigSingleton");
}
HashMap toReturn = new HashMap();
List attrs = profileAttrsSB.getAttributeAsList("ATTRIBUTE");
if (attrs != null && attrs.size() > 0) {
Iterator iterAttrs = attrs.iterator();
SourceBean attrSB = null;
String nameattr = null;
String source = null;
String defaultvalue = null;
while(iterAttrs.hasNext()) {
attrSB = (SourceBean) iterAttrs.next();
if (attrSB == null)
continue;
source = (String) attrSB.getAttribute("source");
nameattr = (String) attrSB.getAttribute("name");
if (nameattr == null) {
throw new EMFInternalError(EMFErrorSeverity.ERROR,
"Attribute 'name' missing in SourceBean\n" + attrSB.toXML(false));
}
defaultvalue = (String) attrSB.getAttribute("default");
if ("absolute".equalsIgnoreCase(source)) {
toReturn.put(nameattr, defaultvalue);
} else if ("exo".equalsIgnoreCase(source)) {
String exoname = (String) attrSB.getAttribute("exoname");
if (exoname == null) {
throw new EMFInternalError(EMFErrorSeverity.ERROR,
"Attribute 'exoname', required for attributes with source='exo', " +
"missing in SourceBean\n" + attrSB.toXML(false));
}
String exovalue = (String) exoProfileAttrs.get(exoname);
if (exovalue != null) toReturn.put(nameattr, exovalue);
else toReturn.put(nameattr, defaultvalue);
} else {
throw new EMFInternalError(EMFErrorSeverity.ERROR,
"Source '" + source + "' not recognized in SourceBean\n" + attrSB.toXML(false));
}
}
}
return toReturn;