コード例 #1
0
ファイル: PPUtils.java プロジェクト: simonsez1808/sandbox
  static {
    try {
      session = NotesFactory.createSession((String) null, (String) null, Authentication.getInfo());
      thisDb = session.getCurrentDatabase();

    } catch (NotesException e) {
      // TODO Auto-generated catch block
      e.printStackTrace();
    }
  }
コード例 #2
0
  /*
   * Reload the application configuration by reading the settings document
   */
  public void reload() {

    Database dbCurrent = null;
    View vwAllByType = null;
    Document docSettings = null;

    try {

      Session sessionAsSigner = Utils.getCurrentSessionAsSigner();
      dbCurrent = sessionAsSigner.getCurrentDatabase();
      vwAllByType = dbCurrent.getView("vwAllByType");

      docSettings = vwAllByType.getDocumentByKey("fSettings", true);

      if (docSettings == null) {

        System.out.println("could not read settings document");

      } else {

        String dataVersion = docSettings.getItemValueString("dataVersion");

        if (!dataVersion.equals(DATA_VERSION)) {

          convert(dataVersion, DATA_VERSION, dbCurrent, vwAllByType, docSettings);
        }

        serverName = dbCurrent.getServer();
        continuityDbPath = dbCurrent.getFilePath();
        continuityDbUrl = "/" + continuityDbPath.replace("\\", "/");

        settingsUnid = docSettings.getUniversalID();
        organisationName = docSettings.getItemValueString("organisationName");
        organisationId = docSettings.getItemValueString("organisationId");
        directoryDbPath = docSettings.getItemValueString("directoryDbPath");
        unpluggedDbPath = docSettings.getItemValueString("unpluggedDbPath");

        callTreeType = docSettings.getItemValueString("callTreeType");

        if (callTreeType.length() == 0) {
          callTreeType = CALLTREE_TYPE_ROLE; // default: role based
        }

        senderEmail = docSettings.getItemValueString("senderEmail");
        senderName = docSettings.getItemValueString("senderName");

        // defaults
        if (senderEmail.length() == 0) {
          senderEmail = "*****@*****.**";
        }
        if (senderName.length() == 0) {
          senderName = "Continuity";
        }

        // labels
        String riskNaming = docSettings.getItemValueString("riskNaming");
        String incidentNaming = docSettings.getItemValueString("incidentNaming");

        if (riskNaming.equals("activities")) {
          labels.put("assets", "Activities");
          labels.put("asset", "Activity");
        } else if (riskNaming.equals("sites")) {
          labels.put("assets", "Sites");
          labels.put("asset", "Site");
        } else if (riskNaming.equals("locations")) {
          labels.put("assets", "Locations");
          labels.put("asset", "Location");
        } else {
          labels.put("assets", "Assets");
          labels.put("asset", "Asset");
        }

        if (incidentNaming.equals("crises")) {
          labels.put("incidents", "Crises");
          labels.put("incident", "Crisis");
        } else if (incidentNaming.equals("emergencies")) {
          labels.put("incidents", "Emergencies");
          labels.put("incident", "Emergency");
        } else {
          labels.put("incidents", "Incidents");
          labels.put("incident", "Incident");
        }

        labels.put("miniConfigGuide", getMiniConfigGuide());
        labels.put("contactsImportGuide", getContactsImportGuide());
      }

    } catch (Exception e) {
      e.printStackTrace();
    } finally {

      Utils.recycle(docSettings, vwAllByType, dbCurrent);
    }
  }