Ejemplo n.º 1
0
  public static void removeApplication(String appPath) throws NotesException {

    Session session = null;
    Database dbUnplugged = null;

    String correctedPath = appPath.replace("\\", "/");

    Logger.debug("Remove Unplugged application for app at " + correctedPath);

    Configuration config = Configuration.get();

    // open unplugged db
    session = Utils.getCurrentSession();
    dbUnplugged = session.getDatabase(config.getServerName(), config.getUnpluggedDbPath());

    // check if an app document for this app already exists and create it if not
    DocumentCollection dcApp =
        dbUnplugged.search("Form=\"UserDatabase\" & Path=\"" + correctedPath + "\"");

    if (dcApp.getCount() == 0) {
      Logger.warn("- Unplugged application document not found");

    } else if (dcApp.getCount() > 1) {
      Logger.error("- Multiple Unplugged application documents found: not removed");

    } else {

      Logger.info("- Unplugged add configuration found");

      dcApp.getFirstDocument().remove(true);
      Logger.info("- Unplugged app configuration removed");
    }
  }