}
@SuppressWarnings("unchecked")
public String generateURL(ControllerContext controllerContext, ResourceId id, boolean merge, boolean minified, Locale locale)
throws IOException {
@SuppressWarnings("rawtypes")
BaseScriptResource resource = null;
if (ResourceScope.GROUP.equals(id.getScope())) {
resource = scripts.getLoadGroup(id.getName());
} else {
resource = getResource(id);
}
//
if (resource != null) {
if (resource instanceof ScriptResource) {
ScriptResource rs = (ScriptResource) resource;
List<Module> modules = rs.getModules();
if (modules.size() > 0 && modules.get(0) instanceof Module.Remote) {
return ((Module.Remote) modules.get(0)).getURI();
}
}
StringBuilder buffer = new StringBuilder();
URIWriter writer = new URIWriter(buffer);
controllerContext.renderURL(resource.getParameters(minified, locale), writer);
return buffer.toString();
} else {
return null;
}
}