コード例 #1
0
  /**
   * This Method returns the 2D Array which is the list of the Items for the selected WorkOrder of
   * the Customer.
   *
   * @param workorderId - WorkOrder Id Foreign Key of WRK_ORDR_DETS table
   * @return Object[][] - 2D Array which is List of the Items for the WorkOrder
   */
  public Object[][] getWorkOrderItems(long workorderId) throws RemoteException {

    WrkOrdrDets wrkordrdts_obj = new WrkOrdrDets(conn);

    RHCCBlgKeys blgkeys_obj = new RHCCBlgKeys(conn);

    Vector workorderdetList = wrkordrdts_obj.getProductList(workorderId);

    // Hashtable BSysList = (Hashtable) USFEnv.getBillSystems();
    BlgSys blgsys = new BlgSys();

    Hashtable BSysList = (Hashtable) blgsys.searchBlgSys();

    Enumeration BSys = BSysList.keys();

    // The 2-Dimensional array to hold the Items Billing System wise.
    Object[][] prodList = new Object[BSysList.size()][workorderdetList.size() + 1];

    // The Number of Billing Systems are assumed to be equal to the
    // Static Load Billing Systems Hashtable size. The Billing Systems will
    // be in order starting from 1 and incrementing by one.
    for (int i = 0; i < BSysList.size(); i++) {
      // Set the 2D array to store the Billing System as the first element
      // of each row.
      prodList[i][0] = String.valueOf(i + 1);
    }

    // Loop throught the WorkOrder Items List and place them in the appropriate
    // positions in the 2D array.
    for (int j = 0; j < workorderdetList.size(); j++) {
      // Determine the Billing System of the Product
      Vector tmpVector = new Vector();

      WrkOrdrDets workorderObj = (WrkOrdrDets) workorderdetList.elementAt(j);

      RHCCBlgKeys bkObj =
          blgkeys_obj.searchRHCCBlgKeys(((WrkOrdrDets) workorderdetList.elementAt(j)).getRBKID());
      int bsid = (new Long(bkObj.getBsId())).intValue();

      tmpVector.addElement(bkObj);
      tmpVector.addElement(workorderObj);

      // Based on the Billing System Id retreived place the Product Object
      // in the 2D array.
      int k = 1;
      while (prodList[bsid - 1][k] != null) {
        k = k + 1;
      }
      prodList[bsid - 1][k] = tmpVector;
    }

    // Return the 2D array
    return prodList;
  }
コード例 #2
0
ファイル: JNDITomcat.java プロジェクト: ajmas/Experimental
  /** Constructor for LDAPQuery. */
  public JNDITomcat() throws Exception {
    super();

    Hashtable<String, String> env = new Hashtable<String, String>();

    env.put(Context.INITIAL_CONTEXT_FACTORY, "org.apache.naming.java.javaURLContextFactory");
    env.put(Context.PROVIDER_URL, "jndi://nadetrou2:8080/");

    // Obtain our environment naming context

    Context initCtx = new InitialContext(env);

    // Context envCtx = (Context) initCtx.lookup("comp/env");

    // Look up our data source

    // DataSource datasource = (DataSource)
    // initialContext.lookup((String)settings.get(CONNECTION_POOL_NAME));

    DataSource ds = (DataSource) initCtx.lookup("/jdbc/vrdb");

    // Allocate and use a connection from the pool

    Connection conn = ds.getConnection();

    System.out.println(conn);
    // ... use this connection to access the database ...

    conn.close();

    // Hashtable env = new Hashtable();
    // //env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    // //env.put(Context.PROVIDER_URL, "t3://192.168.0.55:17001/" );
    //
    // env.put(Context.INITIAL_CONTEXT_FACTORY,"weblogic.jndi.WLInitialContextFactory");
    // env.put(Context.PROVIDER_URL, "3://127.0.0.1:7001/" );
    //
    // // env.put(Context.SECURITY_PRINCIPAL, "system");
    // // env.put(Context.SECURITY_CREDENTIALS, "12345678");
    // System.out.println(env);
    // //System.out.println("--A");
    // // Create initial context
    // DirContext ctx = new InitialDirContext(env);

    // exploreNext(0, envCtx, "");
  }