*
* @return
*/
public Map<String, Boolean> getScripts() {
PortalRequestContext prc = PortalRequestContext.getCurrentInstance();
JavascriptManager jsMan = prc.getJavascriptManager();
//
FetchMap<ResourceId> requiredResources = jsMan.getScriptResources();
log.debug("Resource ids to resolve: {}", requiredResources);
//
JavascriptConfigService service = getApplicationComponent(JavascriptConfigService.class);
Map<String, Boolean> ret = new LinkedHashMap<String, Boolean>();
Map<String, Boolean> tmp = new LinkedHashMap<String, Boolean>();
Map<ScriptResource, FetchMode> resolved = service.resolveIds(requiredResources);
for (ScriptResource rs : resolved.keySet()) {
if (!rs.isNativeAmd()) {
ResourceId id = rs.getId();
// SHARED/bootstrap should be loaded first
if (ResourceScope.SHARED.equals(id.getScope()) && "bootstrap".equals(id.getName())) {
ret.put(id.toString(), false);
} else {
boolean isRemote = !rs.isEmpty() && rs.getModules().get(0) instanceof Module.Remote;
tmp.put(id.toString(), isRemote);
}
}
}
ret.putAll(tmp);
for (String url : jsMan.getExtendedScriptURLs()) {
ret.put(url, true);
}
//
log.debug("Resolved resources for page: " + ret);