Exemplo n.º 1
0
  public static List<String> getScriptByPageAlias(PageAlias pageAlias) {
    // String rootPage = ServletActionContext.getServletContext().getRealPath("/config");

    Object obj = CacheManager.get(CachePrefix.RESOURCE_PAGE_SCRIPT_PREFIX, pageAlias.toString());

    if (obj != null && (obj instanceof ArrayList<?>)) {
      return (ArrayList<String>) obj;
    }

    ScriptConfig scriptConfig =
        CacheManager.get(CachePrefix.RESOURCE_SCRIPT_PREFIX, "SCRIPT", ScriptConfig.class);
    if (scriptConfig == null) {
      scriptConfig = Config.getScriptConfig();
    }
    return buildScriptList(pageAlias, scriptConfig);
  }
Exemplo n.º 2
0
  private static List<String> buildScriptList(PageAlias pageAlias, ScriptConfig scriptConfig) {

    List<String> resultList = new ArrayList<String>();
    if (scriptConfig != null) {
      List<Script> scriptList = scriptConfig.getScriptListInPage(pageAlias.toString());

      if (scriptList != null) {
        for (Script script : scriptList) {
          if (script.getName().equals("environmentVariable")) {
            script.setScript(buildEnvironmentVariable());
          }
          resultList.add(buildScriptItem(script));
        }
      }
    }

    return resultList;
  }