Ejemplo n.º 1
0
 @Override
 public void addItems() {
   try {
     new ProjectWizard().setVisible(true);
   } catch (Exception ex) {
     ClientMiscUtils.reportError("Unable to launch project wizard: %s", ex);
   }
 }
Ejemplo n.º 2
0
    @Override
    public void editItem(Object[] items) {
      try {
        String projName = (String) items[0];
        int projID =
            MedSavantClient.ProjectManager.getProjectID(
                LoginController.getInstance().getSessionID(), projName);

        // Check for existing unpublished changes to this project.
        if (ProjectController.getInstance().promptForUnpublished()) {
          try {
            // Get lock.
            if (MedSavantClient.SettingsManager.getDBLock(
                LoginController.getInstance().getSessionID())) {
              try {
                ProjectWizard wiz =
                    new ProjectWizard(
                        projID,
                        projName,
                        MedSavantClient.PatientManager.getCustomPatientFields(
                            LoginController.getInstance().getSessionID(), projID),
                        MedSavantClient.ProjectManager.getProjectDetails(
                            LoginController.getInstance().getSessionID(), projID));
                wiz.setVisible(true);

              } finally {
                try {
                  MedSavantClient.SettingsManager.releaseDBLock(
                      LoginController.getInstance().getSessionID());
                } catch (Exception ex1) {
                  LOG.error("Error releasing database lock.", ex1);
                }
              }
            } else {
              DialogUtils.displayMessage(
                  "Cannot Modify Project",
                  "The database is currently locked.\nTo unlock, see the Projects page in the Administration section.");
            }
          } catch (Exception ex) {
            ClientMiscUtils.reportError("Error getting database lock: %s", ex);
          }
        }
      } catch (Exception ex) {
        ClientMiscUtils.reportError("Error checking for changes: %s", ex);
      }
    }
Ejemplo n.º 3
0
 private void removeDatabase(
     String address, int port, String database, String username, char[] password) {
   if (DialogUtils.askYesNo(
           "Confirm",
           "<html>Are you sure you want to remove <i>%s</i>?<br>This operation cannot be undone.",
           database)
       == DialogUtils.YES) {
     try {
       MedSavantClient.initializeRegistry(address, port + "");
       MedSavantClient.SetupManager.removeDatabase(address, port, database, username, password);
       setVisible(false);
       DialogUtils.displayMessage(
           "Database Removed",
           String.format("<html>Database <i>%s</i> successfully removed.</html>", database));
     } catch (Exception ex) {
       ClientMiscUtils.reportError("Database could not be removed: %s", ex);
     }
   }
 }
Ejemplo n.º 4
0
    @Override
    public void deleteItems(List<Object[]> items) {
      int nameIndex = 0;
      int keyIndex = 0;

      int result;

      if (items.size() == 1) {
        String name = (String) items.get(0)[nameIndex];
        result =
            DialogUtils.askYesNo(
                "Confirm",
                "<html>Are you sure you want to remove <i>%s</i>?<br>This cannot be undone.</html>",
                name);
      } else {
        result =
            DialogUtils.askYesNo(
                "Confirm",
                "<html>Are you sure you want to remove these %d projects?<br>This cannot be undone.</html>",
                items.size());
      }

      if (result == DialogUtils.YES) {
        for (Object[] v : items) {
          String projectName = (String) v[keyIndex];
          controller.removeProject(projectName);
        }

        try {
          if (controller.getProjectNames().length == 0) {
            LoginController.getInstance().logout();
          }
          DialogUtils.displayMessage("Successfully removed " + items.size() + " project(s)");
        } catch (Exception ex) {
          ClientMiscUtils.reportError("Unable to get updated project list: %s.", ex);
        }
      }
    }