Package com.commander4j.db

Examples of com.commander4j.db.JDBQMDictionary


  private JSpinner.NumberEditor ne;
 
  private void populateTestList(String inspectionid,String activityid,String testid)
  {
    testList.clear();
    testList.add(new JDBQMDictionary(Common.selectedHostID, Common.sessionID));
    testList.addAll(dictionary.getTests());
   
    comboBoxTestModel = new DefaultComboBoxModel<JDBQMDictionary>(testList);

    comboBoxTestID.setModel(comboBoxTestModel);
View Full Code Here


      for (int sel = 0; sel < x; sel++)
      {
        tempItem = (JCheckListItem) listDictionary.getModel().getElementAt(sel);
        if (tempItem.isSelected())
        {
          JDBQMDictionary dictItem = (JDBQMDictionary) tempItem.getValue();
          String testID = dictItem.getTestID();
          String description = dictItem.getDescription();
          String tempField = ",MAX(CASE TEST_ID WHEN '" + testID + "' THEN RESULT ELSE NULL END) AS '" + description + "'";
          if (fieldsSQL.equals(""))
          {
            fieldsSQL = tempField;
          } else
          {
            fieldsSQL = fieldsSQL + tempField;
          }
        }
      }
    }

    String joinSQL = "FROM VIEW_QM_RESULTS WHERE 1 = 1";

    String whereSQL = "";

    if (textFieldProcessOrder.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND PROCESS_ORDER = '" + textFieldProcessOrder.getText() + "'";
    }

    if (textFieldMaterial.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND MATERIAL = '" + textFieldMaterial.getText() + "'";
    }

    if (textFieldInspectionID.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND INSPECTION_ID = '" + textFieldInspectionID.getText() + "'";
    }

    if (textFieldUserData1.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND USER_DATA_1 = '" + textFieldUserData1.getText() + "'";
    }

    if (textFieldUserData2.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND USER_DATA_2 = '" + textFieldUserData2.getText() + "'";
    }

    int dateParams = 0;

    if (checkBoxSampleFrom.isSelected())
    {
      dateParams++;
    }
    if (checkBoxSampleTo.isSelected())
    {
      dateParams++;
    }

    if (dateParams > 0)
    {
      if (dateParams == 1)
      {
        if (checkBoxSampleFrom.isSelected())
        {
          whereSQL = whereSQL + " AND SAMPLE_DATE >= ? ";
        }
        if (checkBoxSampleTo.isSelected())
        {
          whereSQL = whereSQL + " AND SAMPLE_DATE <= ? ";
        }
      } else
      {
        if (dateParams == 2)
        {
          whereSQL = whereSQL + " AND SAMPLE_DATE >= ? AND SAMPLE_DATE <= ? ";
        }
      }
    }

    String groupSQL = "GROUP BY SAMPLE_ID,SAMPLE_DATE,Inspection_ID,Activity_ID,MATERIAL,PROCESS_ORDER,USER_DATA_1,USER_DATA_2";

    String sqlHaving = "";
   
    if (x > 0)
    {
      int count = 0;
      String limit = Common.hostList.getHost(Common.selectedHostID).getDatabaseParameters().getjdbcDatabaseSelectLimit();
      String fieldDelim1 = "";
      String fieldDelim2 = "";
      if (limit.equals("top"))
      {
        fieldDelim1 = "'";
        fieldDelim2 = "'";
      }
      if (limit.equals("rownum"))
      {
        fieldDelim1 = "\"";
        fieldDelim2 = "\"";
      }
      if (limit.equals("limit"))
      {
        fieldDelim1 = "`";
        fieldDelim2 = "`";
      }     
      JCheckListItem tempItem;
      for (int sel = 0; sel < x; sel++)
      {
        tempItem = (JCheckListItem) listDictionary.getModel().getElementAt(sel);
        if (tempItem.isSelected())
        {
          JDBQMDictionary dictItem = (JDBQMDictionary) tempItem.getValue();
          String description = dictItem.getDescription();

          if (count == 0)
          {
             sqlHaving = " HAVING ("+fieldDelim1+description+fieldDelim2+" IS NOT NULL) ";
          }
View Full Code Here

  private void populateList(String defaultid, String defaultval)
  {

    DefaultComboBoxModel DefComboBoxMod = new DefaultComboBoxModel();

    JDBQMDictionary tempSelectList = new JDBQMDictionary(Common.selectedHostID, Common.sessionID);

    LinkedList<JDBQMDictionary> tempList = tempSelectList.getTests();
    int sel = -1;
    for (int j = 0; j < tempList.size(); j++)
    {
      JDBQMDictionary t = (JDBQMDictionary) tempList.get(j);
      DefComboBoxMod.addElement(t);
      if (t.getTestID().equals(defaultid))
      {
        sel = j;
      }
    }
View Full Code Here

    {
      ltestid = ((JDBQMDictionary) jListDictionary.getSelectedValue()).getTestID();
      int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Dictionary_Delete") + " " + ltestid + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION);
      if (question == 0)
      {
        JDBQMDictionary u = new JDBQMDictionary(Common.selectedHostID, Common.sessionID);
        u.setTestID(ltestid);
        u.delete();
        populateList("", "");
      }
    }
  }
View Full Code Here

    }
  }

  private void excel()
  {
    JDBQMDictionary dict = new JDBQMDictionary(Common.selectedHostID, Common.sessionID);
    JExcel export = new JExcel();
    PreparedStatement ps = dict.getDictionaryDataPreparedStatement();
    export.saveAs("qm_dictionary.xls", dict.getDictionaryDataResultSet(ps), Common.mainForm);
    try
    {
      ps.close();
    } catch (SQLException e)
    {
View Full Code Here

  private void populateList(String defaultid, String defaultval)
  {

    DefaultComboBoxModel<JDBQMDictionary> DefComboBoxMod = new DefaultComboBoxModel<JDBQMDictionary>();

    JDBQMDictionary tempSelectList = new JDBQMDictionary(Common.selectedHostID, Common.sessionID);

    LinkedList<JDBQMDictionary> tempList = tempSelectList.getTests();
    int sel = -1;
    for (int j = 0; j < tempList.size(); j++)
    {
      JDBQMDictionary t = (JDBQMDictionary) tempList.get(j);
      DefComboBoxMod.addElement(t);
      if (t.getTestID().equals(defaultid))
      {
        sel = j;
      }
    }
View Full Code Here

    {
      ltestid = ((JDBQMDictionary) jListDictionary.getSelectedValue()).getTestID();
      int question = JOptionPane.showConfirmDialog(Common.mainForm, lang.get("dlg_Dictionary_Delete") + " " + ltestid + " ?", lang.get("dlg_Confirm"), JOptionPane.YES_NO_OPTION, 0, Common.icon_confirm);
      if (question == 0)
      {
        JDBQMDictionary u = new JDBQMDictionary(Common.selectedHostID, Common.sessionID);
        u.setTestID(ltestid);
        u.delete();
        populateList("", "");
      }
    }
  }
View Full Code Here

    }
  }

  private void excel()
  {
    JDBQMDictionary dict = new JDBQMDictionary(Common.selectedHostID, Common.sessionID);
    JExcel export = new JExcel();
    PreparedStatement ps = dict.getDictionaryDataPreparedStatement();
    export.saveAs("qm_dictionary.xls", dict.getDictionaryDataResultSet(ps), Common.mainForm);
    try
    {
      ps.close();
    } catch (SQLException e)
    {
View Full Code Here

  private JSpinner.NumberEditor ne;
 
  private void populateTestList(String inspectionid,String activityid,String testid)
  {
    testList.clear();
    testList.add(new JDBQMDictionary(Common.selectedHostID, Common.sessionID));
    testList.addAll(dictionary.getTests());
   
    comboBoxTestModel = new DefaultComboBoxModel(testList);

    comboBoxTestID.setModel(comboBoxTestModel);
View Full Code Here

      for (int sel = 0; sel < x; sel++)
      {
        tempItem = (JCheckListItem) listDictionary.getModel().getElementAt(sel);
        if (tempItem.isSelected())
        {
          JDBQMDictionary dictItem = (JDBQMDictionary) tempItem.getValue();
          String testID = dictItem.getTestID();
          String description = dictItem.getDescription();
          String tempField = ",MAX(CASE TEST_ID WHEN '" + testID + "' THEN RESULT ELSE NULL END) AS '" + description + "'";
          if (fieldsSQL.equals(""))
          {
            fieldsSQL = tempField;
          } else
          {
            fieldsSQL = fieldsSQL + tempField;
          }
        }
      }
    }

    String joinSQL = "FROM VIEW_QM_RESULTS WHERE 1 = 1";

    String whereSQL = "";

    if (textFieldProcessOrder.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND PROCESS_ORDER = '" + textFieldProcessOrder.getText() + "'";
    }

    if (textFieldMaterial.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND MATERIAL = '" + textFieldMaterial.getText() + "'";
    }

    if (textFieldInspectionID.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND INSPECTION_ID = '" + textFieldInspectionID.getText() + "'";
    }

    if (textFieldUserData1.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND USER_DATA_1 = '" + textFieldUserData1.getText() + "'";
    }

    if (textFieldUserData2.getText().equals("") == false)
    {
      whereSQL = whereSQL + " AND USER_DATA_2 = '" + textFieldUserData2.getText() + "'";
    }

    int dateParams = 0;

    if (checkBoxSampleFrom.isSelected())
    {
      dateParams++;
    }
    if (checkBoxSampleTo.isSelected())
    {
      dateParams++;
    }

    if (dateParams > 0)
    {
      if (dateParams == 1)
      {
        if (checkBoxSampleFrom.isSelected())
        {
          whereSQL = whereSQL + " AND SAMPLE_DATE >= ? ";
        }
        if (checkBoxSampleTo.isSelected())
        {
          whereSQL = whereSQL + " AND SAMPLE_DATE <= ? ";
        }
      } else
      {
        if (dateParams == 2)
        {
          whereSQL = whereSQL + " AND SAMPLE_DATE >= ? AND SAMPLE_DATE <= ? ";
        }
      }
    }

    String groupSQL = "GROUP BY SAMPLE_ID,SAMPLE_DATE,Inspection_ID,Activity_ID,MATERIAL,PROCESS_ORDER,USER_DATA_1,USER_DATA_2";

    String sqlHaving = "";
   
    if (x > 0)
    {
      int count = 0;
      String limit = Common.hostList.getHost(Common.selectedHostID).getDatabaseParameters().getjdbcDatabaseSelectLimit();
      String fieldDelim1 = "";
      String fieldDelim2 = "";
      if (limit.equals("top"))
      {
        fieldDelim1 = "'";
        fieldDelim2 = "'";
      }
      if (limit.equals("rownum"))
      {
        fieldDelim1 = "\"";
        fieldDelim2 = "\"";
      }
      if (limit.equals("limit"))
      {
        fieldDelim1 = "`";
        fieldDelim2 = "`";
      }     
      JCheckListItem tempItem;
      for (int sel = 0; sel < x; sel++)
      {
        tempItem = (JCheckListItem) listDictionary.getModel().getElementAt(sel);
        if (tempItem.isSelected())
        {
          JDBQMDictionary dictItem = (JDBQMDictionary) tempItem.getValue();
          String description = dictItem.getDescription();

          if (count == 0)
          {
             sqlHaving = " HAVING ("+fieldDelim1+description+fieldDelim2+" IS NOT NULL) ";
          }
View Full Code Here

TOP

Related Classes of com.commander4j.db.JDBQMDictionary

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.