Exemplo n.º 1
0
  private void deleteObjectclass() {
    ArrayList<LocalizableMessage> errors = new ArrayList<>();
    ProgressDialog dlg =
        new ProgressDialog(
            Utilities.createFrame(),
            Utilities.getParentDialog(this),
            INFO_CTRL_PANEL_DELETE_OBJECTCLASS_TITLE.get(),
            getInfo());
    LinkedHashSet<ObjectClass> ocsToDelete = new LinkedHashSet<>();
    ocsToDelete.add(objectClass);
    LinkedHashSet<AttributeType> attrsToDelete = new LinkedHashSet<>(0);

    DeleteSchemaElementsTask newTask =
        new DeleteSchemaElementsTask(getInfo(), dlg, ocsToDelete, attrsToDelete);
    for (Task task : getInfo().getTasks()) {
      task.canLaunch(newTask, errors);
    }
    Schema schema = getInfo().getServerDescriptor().getSchema();
    ArrayList<String> childClasses = new ArrayList<>();
    if (schema != null) {
      for (ObjectClass o : schema.getObjectClasses().values()) {
        for (ObjectClass superior : o.getSuperiorClasses()) {
          if (objectClass.equals(superior)) {
            childClasses.add(o.getNameOrOID());
          }
        }
      }
    } else {
      errors.add(ERR_CTRL_PANEL_SCHEMA_NOT_FOUND_DETAILS.get());
    }
    if (errors.isEmpty()) {
      LocalizableMessageBuilder mb = new LocalizableMessageBuilder();

      if (!childClasses.isEmpty()) {
        mb.append(
            INFO_OBJECTCLASS_IS_SUPERIOR.get(
                ocName, Utilities.getStringFromCollection(childClasses, ", ")));
        mb.append("<br>");
      }
      LocalizableMessage confirmationMessage =
          INFO_CTRL_PANEL_CONFIRMATION_DELETE_OBJECTCLASS_DETAILS.get(ocName);
      mb.append(confirmationMessage);
      if (displayConfirmationDialog(
          INFO_CTRL_PANEL_CONFIRMATION_REQUIRED_SUMMARY.get(), confirmationMessage)) {
        launchOperation(
            newTask,
            INFO_CTRL_PANEL_DELETING_OBJECTCLASS_SUMMARY.get(ocName),
            INFO_CTRL_PANEL_DELETING_OBJECTCLASS_COMPLETE.get(),
            INFO_CTRL_PANEL_DELETING_OBJECTCLASS_SUCCESSFUL.get(ocName),
            ERR_CTRL_PANEL_DELETING_OBJECTCLASS_ERROR_SUMMARY.get(),
            ERR_CTRL_PANEL_DELETING_OBJECTCLASS_ERROR_DETAILS.get(ocName),
            null,
            dlg);
        dlg.setVisible(true);
      }
    } else {
      displayErrorDialog(errors);
    }
  }
 private static void updateStatsUndefinedResults(
     LocalizableMessageBuilder debugMessage, Index index) {
   if (!index.isTrusted()) {
     debugMessage.append(INFO_INDEX_FILTER_INDEX_NOT_TRUSTED.get(index.getName()));
   } else if (index.isRebuildRunning()) {
     debugMessage.append(INFO_INDEX_FILTER_INDEX_REBUILD_IN_PROGRESS.get(index.getName()));
   } else {
     debugMessage.append(INFO_INDEX_FILTER_INDEX_LIMIT_EXCEEDED.get(index.getName()));
   }
 }
Exemplo n.º 3
0
  /** The constructor of a CurrentInstallStatus object. */
  public CurrentInstallStatus() {
    if (Utils.isWebStart()) {
      isInstalled = false;
    } else {
      Installation installation = Installation.getLocal();
      ArrayList<LocalizableMessage> msgs = new ArrayList<>();

      if (installation.getStatus().isServerRunning()) {
        msgs.add(INFO_INSTALLSTATUS_SERVERRUNNING.get(getPort()));
      }

      if (dbFilesExist()) {
        canOverwriteCurrentInstall = true;
        msgs.add(INFO_INSTALLSTATUS_DBFILEEXIST.get());
      }

      if (configExists()) {
        canOverwriteCurrentInstall = false;
        isInstalled = true;
        msgs.add(INFO_INSTALLSTATUS_CONFIGFILEMODIFIED.get());
      }

      if (canOverwriteCurrentInstall) {
        installationMsg =
            !Utils.isCli()
                ? INFO_INSTALLSTATUS_CANOVERWRITECURRENTINSTALL_MSG.get()
                : INFO_INSTALLSTATUS_CANOVERWRITECURRENTINSTALL_MSG_CLI.get();
      } else if (isInstalled) {
        LocalizableMessageBuilder buf = new LocalizableMessageBuilder();
        if (Utils.isCli()) {
          buf = new LocalizableMessageBuilder();
          for (LocalizableMessage msg : msgs) {
            buf.append(Constants.LINE_SEPARATOR);
            buf.append("- ").append(msg);
          }
          String cmd =
              isWindows()
                  ? Installation.WINDOWS_SETUP_FILE_NAME
                  : Installation.UNIX_SETUP_FILE_NAME;
          installationMsg = INFO_INSTALLSTATUS_INSTALLED_CLI.get(cmd, buf);
        } else {
          buf.append("<ul>");
          for (LocalizableMessage msg : msgs) {
            buf.append("\n<li>");
            buf.append(msg);
            buf.append("</li>");
          }
          buf.append("</ul>");
          installationMsg = INFO_INSTALLSTATUS_INSTALLED.get(buf);
        }
      }
    }
    if (!isInstalled) {
      installationMsg = INFO_INSTALLSTATUS_NOT_INSTALLED.get();
    }
  }