Examples of MPInstance


Examples of org.compiere.model.MPInstance

        }
        else
        {
            AD_Process_ID = 134// HARDCODED    C_InvoiceCreate
        }
    MPInstance instance = new MPInstance(Env.getCtx(), AD_Process_ID, 0);
    if (!instance.save())
    {
      info = Msg.getMsg(Env.getCtx(), "ProcessNoInstance");
      return info;
    }
   
    //insert selection
    StringBuffer insert = new StringBuffer();
    insert.append("INSERT INTO T_SELECTION(AD_PINSTANCE_ID, T_SELECTION_ID) ");
    int counter = 0;
    for(Integer selectedId : getSelection())
    {
      counter++;
      if (counter > 1)
        insert.append(" UNION ");
      insert.append("SELECT ");
      insert.append(instance.getAD_PInstance_ID());
      insert.append(", ");
      insert.append(selectedId);
      insert.append(" FROM DUAL ");
     
      if (counter == 1000)
      {
        if ( DB.executeUpdate(insert.toString(), trxName) < 0 )
        {
          String msg = "No Invoices";     //  not translated!
          info = msg;
          log.config(msg);
          trx.rollback();
          return info;
        }
        insert = new StringBuffer();
        insert.append("INSERT INTO T_SELECTION(AD_PINSTANCE_ID, T_SELECTION_ID) ");
        counter = 0;
      }
    }
    if (counter > 0)
    {
      if ( DB.executeUpdate(insert.toString(), trxName) < 0 )
      {
        String msg = "No Invoices";     //  not translated!
        info = msg;
        log.config(msg);
        trx.rollback();
        return info;
      }
    }
   
    ProcessInfo pi = new ProcessInfo ("", AD_Process_ID);
    pi.setAD_PInstance_ID (instance.getAD_PInstance_ID());

    //  Add Parameters
    MPInstancePara para = new MPInstancePara(instance, 10);
    para.setParameter("Selection", "Y");
    if (!para.save())
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. 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.