Package com.commander4j.db

Examples of com.commander4j.db.JDBUser


      {
        password = new String(fld_password.getPassword());
        username = fld_userName.getText().toUpperCase();
        String pass1 = new String(fld_new_password.getPassword());
        String pass2 = new String(fld_verify_new_password.getPassword());
        JDBUser user = new JDBUser(Common.selectedHostID, Common.sessionID);

        user.setUserId(username);
        user.setPassword(password);
        user.setPasswordNew(pass1);
        user.setPasswordVerify(pass2);
        if (user.changePassword())
        {
          validated = true;
          Common.userList.addUser(Common.sessionID, user);
          dispose();
        }
        else
        {
          validated = false;
          fld_new_password.setText("");
          fld_verify_new_password.setText("");
          fld_new_password.requestFocus();
          JUtility.errorBeep();
          JOptionPane.showMessageDialog(null, user.getErrorMessage());
        }
      }

      if (event.getSource() == btn_cancel)
      {
View Full Code Here


  public int size() {
    return users.size();
  }

  public JDBUser getUser(String sessionID) {
    JDBUser usr = new JDBUser("", "");
    if (users.containsKey(sessionID) == true)
    {
      usr = users.get(sessionID);
    }
    else
View Full Code Here

  {
    Logger logger = Logger.getLogger(Start.class);
    JDialogLogin lg;
    JDialogHosts hsts;
    JDBControl ctrl;
    JDBUser user;
    boolean loggedIn = false;
    String passwordMode = "";

    Thread t = Thread.currentThread();
    t.setName("C4J Main");

    System.setProperty("apple.laf.useScreenMenuBar", "true");
    System.setProperty("com.apple.mrj.application.apple.menu.about.name", "Commander4j");
    Common.base_dir = System.getProperty("user.dir");
    Common.sessionID = JUnique.getUniqueID();
    Common.sd.setData(Common.sessionID, "silentExceptions", "No", true);
    Common.applicationMode = "SwingClient";

    JUtility.adjustForLookandFeel();

    JUtility.initLogging("");
    Common.hostList.loadHosts();
    com.commander4j.util.JUpdate.updateCheck();

    JSplashScreenUtils.create();
    JSplashScreenUtils.updateProgress(0, "Initialising");
    JSplashScreenUtils.updateProgress(5, "Starting Logger");
    JSplashScreenUtils.updateProgress(10, "Checking Printers");

    JPrint.init();

    if (JUtility.isValidJavaVersion(Common.requiredJavaVersion) == false)
    {
      JUtility.errorBeep();
      JOptionPane.showMessageDialog(null, "This application requires java version " + Common.requiredJavaVersion + " or higher.\n Detected version is " + System.getProperty("java.version"),
          "Information", JOptionPane.ERROR_MESSAGE);
      System.exit(0);
    }

    JSplashScreenUtils.updateProgress(15, "Setting Look and Feel");

    logger.info("Application starting");
    JSplashScreenUtils.updateProgress(20, "Preparing for Logon");

    JSplashScreenUtils.hide();

    hsts = new JDialogHosts(null);
    hsts.setVisible(false);
    hsts.dispose();

    if (Common.selectedHostID.equals("Cancel") == false)
    {
      if (Common.displaySplashScreen)
      {
        JSplashScreenUtils.show();

        JSplashScreenUtils.updateProgress(25, "Initialising....");
        JSplashScreenUtils.updateProgress(30, "Open SQL Library....");
        JSplashScreenUtils.updateProgress(35, "Building jdbc connection string....");
        JSplashScreenUtils.updateProgress(40, "Loading database SQL statements...");
        JSplashScreenUtils.updateProgress(45, "Open Virtual Views....");
        JSplashScreenUtils.updateProgress(55, "Building jdbc connection string....");
        JSplashScreenUtils.updateProgress(60, "Loading database view statements...");
        JSplashScreenUtils.updateProgress(65, "Loading database view statements...");
        JSplashScreenUtils.updateProgress(70, "Connecting to Host database...");
      }

      if (Common.hostList.getHost(Common.selectedHostID).connect(Common.sessionID, Common.selectedHostID) == true)
      {
        JSplashScreenUtils.updateProgress(75, "Validating Schema Version...");

        JDBSchema schema = new JDBSchema(Common.sessionID, Common.hostList.getHost(Common.selectedHostID));

        schema.validate(true);
        JSplashScreenUtils.updateProgress(80, "Initialising Help Subsystem...");
        JSplashScreenUtils.updateProgress(85, "Loading EAN Barcode definitions...");

        JUtility.initEANBarcode();

        JSplashScreenUtils.updateProgress(90, "Initialising Reporting system...");

        JLaunchReport.init();

        JSplashScreenUtils.updateProgress(95, "Initialising Common values...");

        Common.init();

        JSplashScreenUtils.updateProgress(100, "Loading Logon dialog...");

        JSplashScreenUtils.hide();
        JSplashScreenUtils.remove();

        ctrl = new JDBControl(Common.selectedHostID, Common.sessionID);
        passwordMode = ctrl.getKeyValue("PASSWORD MODE");
       
        if (passwordMode.equals("PASSTHROUGH"))
        {
          user = new JDBUser(Common.selectedHostID, Common.sessionID);
          user.getUserProperties(System.getProperty("user.name"));
          if (user.login())
          {
            Common.userList.addUser(Common.sessionID, user);
            loggedIn = true;
          } else
          {
            JUtility.errorBeep();
            JOptionPane.showMessageDialog(null, user.getErrorMessage(), "Login Error", JOptionPane.ERROR_MESSAGE);
          }
        }
       
        if (passwordMode.equals("LOCAL") || (loggedIn == false))
        {
View Full Code Here

  public JDialogLogin(Frame parent) {

    super(parent, "Login", true);
    setModal(true);
    user = new JDBUser(Common.selectedHostID, Common.sessionID);

    setTitle("Login (" + Common.hostList.getHost(Common.selectedHostID).getSiteDescription() + ")");

    JLabel lname = new JLabel("User name");
    lname.setFont(Common.font_std);
View Full Code Here

    setLocation((screen.width - window.width) / 2, (screen.height - window.height) / 2);

  }

  private void resetLists() {
    JDBUser tempUser = new JDBUser(Common.selectedHostID, Common.sessionID);
    tempUser.setUserId(lUserId);

    assignedUserList.clear();
    assignedUserList = tempUser.getUserGroupsAssigned();
    populateAssignedList();

    unAssignedUserList.clear();
    unAssignedUserList = tempUser.getUserGroupsUnAssigned();
    populateUnAssignedList();

    jButtonUndo.setEnabled(false);
    jButtonSave.setEnabled(false);
  }
View Full Code Here

          jButtonSave.setText(lang.get("btn_Save"));
          jButtonSave.setBounds(150, 357, 105, 30);
          jButtonSave.setMnemonic(lang.getMnemonicChar());
          jButtonSave.addActionListener(new ActionListener() {
            public void actionPerformed(ActionEvent evt) {
              JDBUser u = new JDBUser(Common.selectedHostID, Common.sessionID);

              u.setUserId(lUserId);
              for (int j = 0; j < unAssignedUserList.size(); j++)
              {
                u.removefromGroup(unAssignedUserList.get(j).toString());
              }
              for (int j = 0; j < assignedUserList.size(); j++)
              {
                u.addtoGroup(assignedUserList.get(j).toString());
              }
              jButtonUndo.setEnabled(false);
              jButtonSave.setEnabled(false);
            }
          });
View Full Code Here

  public void run()
  {
    logger.debug("AutoLabeller Thread running");
    setSessionID(JUnique.getUniqueID());
    JDBUser user = new JDBUser(getHostID(), getSessionID());
    user.setUserId("INTERFACE");
    user.setPassword("INTERFACE");
    Common.userList.addUser(getSessionID(), user);
    Common.sd.setData(getSessionID(), "silentExceptions", "Yes", true);

    Boolean dbconnected = false;
View Full Code Here

          JUtility.initEANBarcode();
          JLaunchReport.init();
          Common.init();

          JDBUser user = new JDBUser(getHostID(), getSessionID());
          JDBControl ctrl = new JDBControl(getHostID(), getSessionID());
          JeMail mail = new JeMail(getHostID(), getSessionID());

          user.setUserId("INTERFACE");
          user.setPassword("INTERFACE");
          Common.userList.addUser(getSessionID(), user);

          enableEnterfaceStatusEmails = Boolean.parseBoolean(ctrl.getKeyValueWithDefault("INTERFACE EMAIL NOTIFY", "false", "Email startup and shutdown events :- true or false"));

          interfaceEmailAddresses = ctrl.getKeyValueWithDefault("INTERFACE ADMIN EMAIL", "someone@somewhere.com", "Email address for startup and shutdown events.");

          StringConverter stringConverter = new StringConverter();
          ArrayConverter arrayConverter = new ArrayConverter(String[].class, stringConverter);
          arrayConverter.setDelimiter(';');
          arrayConverter.setAllowedChars(new char[] { '@','_' });
          String[] emailList = (String[]) arrayConverter.convert(String[].class, interfaceEmailAddresses);
          siteName = Common.hostList.getHost(getHostID()).getSiteDescription();

          if (user.login())
          {

            if (enableEnterfaceStatusEmails == true)
            {
              try
              {
                String subject = "";
                if (houseKeeping == true)
                {
                //   subject = "Commander4j "+JVersion.getProgramVersion()+" Interface maintenance restart for [" + siteName + "] on "+JUtility.getClientName();
                //   mail.postMail(emailList, subject, "Interface service has started.", "", "");
                }
                else
                {
                  subject = "Commander4j "+JVersion.getProgramVersion()+" Interface startup for [" + siteName + "] on "+JUtility.getClientName();
                  mail.postMail(emailList, subject, "Interface service has started.", "", "");
                }
              }
              catch (Exception ex)
              {
                logger.error("InterfaceThread Unable to send emails");
              }
            }
           
            houseKeeping = false;
           
            logger.debug("Interface Logged on successfully");

            logger.debug("Starting Threads....");

            secondsBeforeHousekeeping = Integer.valueOf(ctrl.getKeyValueWithDefault("INTERFACE HOUSEKEEPING INTERVAL", "86400", "Frequency in seconds."));
            secondsRemaining = secondsBeforeHousekeeping;

            startupThreads();

            while ((shutdown == false) & (houseKeeping == false))
            {
              com.commander4j.util.JWait.milliSec(1000);
              secondsRemaining--;
              // logger.debug("Housekeeping scheduled in "+String.valueOf(secondsRemaining)+" seconds.");

              if (secondsRemaining == 0)
              {
                houseKeeping = true;

              }
            }

            logger.debug("Stopping Threads....");
            shutdownThreads();

            user.logout();
            logger.debug("Interface Logged out successfully");

            if (enableEnterfaceStatusEmails == true)
            {
              try
View Full Code Here

    inputPath = path;
    this.errorPath = errorPath;
    this.backupPath = backupPath;
    setHostID(host);
    setSessionID(JUnique.getUniqueID());
    JDBUser user = new JDBUser(getHostID(), getSessionID());
    user.setUserId("INTERFACE");
    user.setPassword("INTERFACE");
    Common.userList.addUser(getSessionID(), user);
    Common.sd.setData(getSessionID(), "silentExceptions", "Yes", true);
  }
View Full Code Here

    populateList("");
  }

  private void add() {
    JDBUser u = new JDBUser(Common.selectedHostID, Common.sessionID);

    luser_id = JOptionPane.showInputDialog(Common.mainForm, "Enter new user id");
    if (luser_id != null)
    {
      if (luser_id.equals("") == false)
      {
        luser_id = luser_id.toUpperCase();
        if (u.create(luser_id, "password", "", true, true, false, "EN", false, "") == false)
        {
          JUtility.errorBeep();
          JOptionPane.showMessageDialog(Common.mainForm, u.getErrorMessage(), "Error", JOptionPane.ERROR_MESSAGE);
        }
        else
        {

          JLaunchMenu.runForm("FRM_ADMIN_USER_EDIT", luser_id);
View Full Code Here

TOP

Related Classes of com.commander4j.db.JDBUser

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.