1 14 package org.compiere.process; 15 16 import java.sql.*; 17 import java.math.*; 18 19 import org.compiere.report.*; 20 21 27 public class ReportLineSet_Copy extends SvrProcess 28 { 29 32 public ReportLineSet_Copy() 33 { 34 super(); 35 } 37 38 private int m_PA_ReportLineSet_ID = 0; 39 40 43 protected void prepare() 44 { 45 ProcessInfoParameter[] para = getParameter(); 46 for (int i = 0; i < para.length; i++) 47 { 48 String name = para[i].getParameterName(); 49 if (para[i].getParameter() == null) 50 ; 51 else if (name.equals("PA_ReportLineSet_ID")) 52 m_PA_ReportLineSet_ID = ((BigDecimal)para[i].getParameter()).intValue(); 53 else 54 log.error("prepare - Unknown Parameter: " + name); 55 } 56 } 58 63 protected String doIt() throws Exception  64 { 65 int to_ID = super.getRecord_ID(); 66 log.info("From PA_ReportLineSet_ID=" + m_PA_ReportLineSet_ID + ", To=" + to_ID); 67 if (to_ID < 1) 68 throw new Exception (MSG_SaveErrorRowNotFound); 69 MReportLineSet to = new MReportLineSet(getCtx(), to_ID); 71 MReportLineSet rlSet = new MReportLineSet(getCtx(), m_PA_ReportLineSet_ID); 72 MReportLine[] rls = rlSet.getLiness(); 73 for (int i = 0; i < rls.length; i++) 74 { 75 MReportLine rl = MReportLine.copy (getCtx(), to.getAD_Client_ID(), to.getAD_Org_ID(), to_ID, rls[i]); 76 rl.save(); 77 MReportSource[] rss = rls[i].getSources(); 78 if (rss != null) 79 { 80 for (int ii = 0; ii < rss.length; ii++) 81 { 82 MReportSource rs = MReportSource.copy (getCtx(), to.getAD_Client_ID(), to.getAD_Org_ID(), rl.getID(), rss[ii]); 83 rs.save(); 84 } 85 } 86 } 87 return "@Copied@=" + rls.length; 88 } 90 } | Popular Tags |