// TODO Change to KeyManager usage
final String type = (String)parameters.get("type");
final Configuration config = (Configuration) parameters.get("config");
final String profileType = (String)parameters.get("profiletype");
final String postFix = (load ? "load" : "save");
final UserHandler handler = (UserHandler)parameters.get("handler");
String uri = null;
if (type == null) {
uri = config.getChild(profileType + "-" + postFix).getAttribute("uri");
} else if (type.equals("global")) {
uri = config.getChild(profileType + "-global-" + postFix).getAttribute("uri");
} else if (type.equals("role")) {
uri = config.getChild(profileType + "-role-" + postFix).getAttribute("uri");
} else if (type.equals("user")) {
uri = config.getChild(profileType + "-user-" + postFix).getAttribute("uri");
}
Map key = new LinkedMap();
key.put("baseuri", uri);
key.put("separator", "?");
key.put("portal", service.getPortalName());
key.put("layout", layoutKey);
if ( type != null ) {
key.put("type", type);
if ( "role".equals(type) || "user".equals(type)) {
key.put("role", handler.getContext().getContextInfo().get("role"));
}
if ( "user".equals(type) ) {
key.put("user", handler.getUserId());
}
}
return key;
}