Exemplo n.º 1
0
  private void load_() {
    startTx_(); // to init JPA em if needed
    IMenu m = menuInstance();
    if (0 < m._count()) {
      if ("yml".equalsIgnoreCase(Play.configuration.getProperty("menu.loadFrom", "db"))) {
        Logger.info(msg_("Force loading menus from yaml file. clean up menu database ..."));
        // clean db
        m._purge();
      } else {
        // reuse the data in database
        commitTx_();
        return;
      }
    }
    commitTx_(); // close the previous Tx if it's started
    String fileName = Play.configuration.getProperty("menu.yamlFile", "_menu.yml");
    VirtualFile yamlFile = virtualFile_(fileName);

    if (yamlFile == null) {
      Logger.warn(msg_("Couldn't find menu plugin initial file: %s", fileName));
      return;
    }
    load_(yamlFile);
  }
Exemplo n.º 2
0
 public static void _purge() {
   fact_._purge();
 }