MapSourceAdapter adapter = null;
try {
service = (PortalService) this.componentManager.lookup(PortalService.ROLE);
if ( null == key ) {
Layout l = (Layout) service.getTemporaryAttribute("DEFAULT_LAYOUT");
if ( null != l) {
return l;
}
}
Object[] objects = (Object[]) service.getAttribute(StaticProfileManager.class.getName() + "/Layout");
Map map = new HashMap();
map.put("profile", "layout");
map.put("portalname", service.getPortalName());
int valid = SourceValidity.INVALID;
SourceValidity sourceValidity = null;
if (objects != null) {
sourceValidity = (SourceValidity) objects[1];
valid = sourceValidity.isValid();
if (valid == SourceValidity.VALID)
return (Layout) objects[0];
}
adapter = (MapSourceAdapter) this.componentManager.lookup(MapSourceAdapter.ROLE);
Map param = new HashMap();
param.put("portalname", service.getPortalName());
SourceValidity newValidity = adapter.getValidity(param, map);
if (valid == SourceValidity.UNKNWON) {
if (sourceValidity.isValid(newValidity) == SourceValidity.VALID)
return (Layout) objects[0];
}
Layout layout = (Layout) adapter.loadProfile(param, map);
if (newValidity != null) {
objects = new Object[] { layout, newValidity };
service.setAttribute(StaticProfileManager.class.getName() + "/Layout", objects);
}
// resolve parents