Package com.dbxml.db.admin

Examples of com.dbxml.db.admin.Admin


   public String getMenuTitle() {
      return "Role";
   }

   public int menuAction(int action) {
      Admin admin = Admin.getInstance();
      AccessManagerClient manager = new AccessManagerClient(col.getClient());

      switch ( action ) {
         case ACTION_REMOVE_DATABASE:
         case ACTION_REMOVE_USER:
            try {
               String title;
               String message;
               if ( type == USER ) {
                  title = "Remove Role from User";
                  message = "Are you sure you want to remove the\n"
                          + "Role '"+id+"' from User '"+userID+"'?";
               }
               else {
                  title = "Remove Role from Database";
                  message = "Are you sure you want to remove the\n"
                          + "Role '"+id+"' from the Database?";
               }
               int res = JOptionPane.showConfirmDialog(Admin.getInstance(), message, title, JOptionPane.YES_NO_OPTION);
               if ( res == JOptionPane.YES_OPTION ) {
                  switch ( type ) {
                     case DATABASE:
                        manager.removeRole(id);
                        break;
                     case USER:
                        manager.removeRoleFromUser(userID, id);
                        break;
                  }
                  return REMOVE_SELF;
               }
            }
            catch ( dbXMLException e ) {
               admin.addMessage(e.getMessage());
            }
            break;

         case ACTION_PERMISSIONS:
            PermissionsDialog perms = new PermissionsDialog(admin, col, id);
View Full Code Here


   public MenuItem[] getMenu() {
      return Menu;
   }

   public int menuAction(int action) {
      Admin admin = Admin.getInstance();

      switch ( action ) {
         case ACTION_IMPORT: {
            try {
               JFileChooser fc = new JFileChooser();
               fc.setFileSelectionMode(JFileChooser.FILES_ONLY);
               fc.setMultiSelectionEnabled(true);
               int result = fc.showDialog(admin, "Import");
               if ( result == JFileChooser.APPROVE_OPTION ) {
                  admin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
                  Stopwatch sw = new Stopwatch(true);
                  boolean docs = col.getCollectionType() == CollectionClient.TYPE_DOCUMENTS;
                  int count = 0;
                  int error = 0;
                  File[] files = fc.getSelectedFiles();
                  for ( int i = 0; i < files.length; i++ ) {
                     File file = files[i];
                     String docName = file.getName();
                     try {
                        if ( docs )
                           importDoc(docName, file);
                        else
                           importBin(docName, file);
                        count++;
                     }
                     catch ( Exception e ) {
                        error++;
                        admin.addMessage("Couldn't import '" + docName + "': "+e.getMessage());
                     }
                  }
                  sw.stop();
                  if ( error > 0 )
                     admin.addMessage(count+" Document(s) imported ("+error+" errors): "+sw.toString());
                  else
                     admin.setStatus(count+" Document(s) imported: "+sw.toString());
                  admin.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
               }
               return REFRESH_CHILDREN;
            }
            catch ( dbXMLException e ) {
               admin.addMessage(e.getMessage());
            }
         }
      }
      return REFRESH_NONE;
   }
View Full Code Here

   }

   public int menuAction(int action) {
      switch ( action ) {
         case ACTION_ADD:
            Admin admin = Admin.getInstance();
            if ( type == RoleNode.COLLECTION ) {
               PermissionsDialog perms = new PermissionsDialog(admin, col);
               perms.show();
            }
            break;
View Full Code Here

   public String getMenuTitle() {
      return "Directory";
   }

   public int menuAction(int action) {
      Admin admin = Admin.getInstance();

      switch ( action ) {
         case ACTION_DETACH:
            try {
               AdminConfig cfg = admin.getAdminConfig();
               cfg.removeFileSystem(label);
               cfg.save();
               return REMOVE_SELF;
            }
            catch ( Exception e ) {
               admin.addMessage(e.getMessage());
            }
            break;

         case ACTION_DELETE:
            try {
               String title = "Delete Directory";
               String message = "Are you sure you want to delete the\n"
                              + "Directory '"+file.getName()+"'?";
               int res = JOptionPane.showConfirmDialog(admin, message, title, JOptionPane.YES_NO_OPTION);
               if ( res == JOptionPane.YES_OPTION ) {
                  file.delete();
                  return REFRESH_PARENT;
               }
            }
            catch ( Exception e ) {
               admin.addMessage(e.getMessage());
            }
            break;

      }
      return REFRESH_NONE;
View Full Code Here

   public boolean isParentMenuInherited() {
      return false;
   }

   public int menuAction(int action) {
      Admin admin = Admin.getInstance();
      switch ( action ) {
         case ACTION_CONNECT:
            ConnectDialog connect = new ConnectDialog(admin);
            connect.show();
            break;
View Full Code Here

   public MenuItem[] getMenu() {
      return Menu;
   }

   public int menuAction(int action) {
      Admin admin = Admin.getInstance();

      switch ( action ) {
         case ACTION_DELETE:
            try {
               String title = "Delete Document";
               String message = "Are you sure you want to delete the\n"
                              + "Document '"+id+"'?";
               int res = JOptionPane.showConfirmDialog(Admin.getInstance(), message, title, JOptionPane.YES_NO_OPTION);
               if ( res == JOptionPane.YES_OPTION ) {
                  col.remove(id);
                  return REMOVE_SELF;
               }
            }
            catch ( Exception e ) {
               Admin.getInstance().addMessage(e.toString());
            }
            break;

         case ACTION_EDIT:
            admin.setCursor(Cursor.getPredefinedCursor(Cursor.WAIT_CURSOR));
            Stopwatch sw = new Stopwatch("Document Retrieval", true);
            DocWrapper dw = getDocWrapper();
            sw.stop();
            admin.setStatus(sw.toString());
            admin.editDocument(dw);
            admin.setCursor(Cursor.getPredefinedCursor(Cursor.DEFAULT_CURSOR));
            break;

         case ACTION_XSLT:
            try {
               String name = col.getCanonicalName() + '/' + id;
View Full Code Here

TOP

Related Classes of com.dbxml.db.admin.Admin

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.