1 14 package org.compiere.print; 15 16 import java.util.*; 17 import java.math.*; 18 19 import org.compiere.process.*; 20 21 29 public class MPrintFormatProcess extends SvrProcess 30 { 31 34 public MPrintFormatProcess() 35 { 36 super(); 37 } 39 40 private BigDecimal m_AD_PrintFormat_ID; 41 42 private BigDecimal m_AD_Table_ID; 43 44 47 protected void prepare() 48 { 49 ProcessInfoParameter[] para = getParameter(); 50 for (int i = 0; i < para.length; i++) 51 { 52 String name = para[i].getParameterName(); 53 if (para[i].getParameter() == null) 54 ; 55 else if (name.equals("AD_PrintFormat_ID")) 56 m_AD_PrintFormat_ID = ((BigDecimal)para[i].getParameter()); 57 else if (name.equals("AD_Table_ID")) 58 m_AD_Table_ID = ((BigDecimal)para[i].getParameter()); 59 else 60 log.equals("prepare - Unknown Parameter=" + para[i].getParameterName()); 61 } 62 } 64 73 protected String doIt() throws Exception 74 { 75 if (m_AD_Table_ID != null && m_AD_Table_ID.intValue() > 0) 76 { 77 log.info("Create from AD_Table_ID=" + m_AD_Table_ID); 78 MPrintFormat pf = MPrintFormat.createFromTable(getCtx(), m_AD_Table_ID.intValue(), getRecord_ID()); 79 return pf.getName() + " #" + pf.getItemCount(); 80 } 81 else if (m_AD_PrintFormat_ID != null && m_AD_PrintFormat_ID.intValue() > 0) 82 { 83 log.info("MPrintFormatProcess - Copy from AD_PrintFormat_ID=" + m_AD_PrintFormat_ID); 84 MPrintFormat pf = MPrintFormat.copy (getCtx(), m_AD_PrintFormat_ID.intValue(), getRecord_ID()); 85 return pf.getName() + " #" + pf.getItemCount(); 86 } 87 else 88 throw new Exception (MSG_InvalidArguments); 89 } 91 } | Popular Tags |