KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > model > MInOut


1 /******************************************************************************
2  * The contents of this file are subject to the Compiere License Version 1.1
3  * ("License"); You may not use this file except in compliance with the License
4  * You may obtain a copy of the License at http://www.compiere.org/license.html
5  * Software distributed under the License is distributed on an "AS IS" basis,
6  * WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
7  * the specific language governing rights and limitations under the License.
8  * The Original Code is Compiere ERP & CRM Smart Business Solution
9  * The Initial Developer of the Original Code is Jorg Janke and ComPiere, Inc.
10  * Portions created by Jorg Janke are Copyright (C) 1999-2003 Jorg Janke, parts
11  * created by ComPiere are Copyright (C) ComPiere, Inc.; All Rights Reserved.
12  * Contributor(s): ______________________________________.
13  *****************************************************************************/

14 package org.compiere.model;
15
16 import java.util.*;
17 import java.sql.*;
18 import java.math.*;
19
20 import org.compiere.util.*;
21
22 /**
23  * Shipment Model
24  *
25  * @author Jorg Janke
26  * @version $Id: MInOut.java,v 1.6 2003/09/05 04:59:48 jjanke Exp $
27  */

28 public class MInOut extends X_M_InOut
29 {
30     public MInOut (Properties ctx, int M_InOut_ID)
31     {
32         super (ctx, M_InOut_ID);
33         if (M_InOut_ID == 0)
34         {
35             setM_Warehouse_ID (0);
36             setDateAcct (new Timestamp (System.currentTimeMillis ()));
37         // setMovementType (MOVEMENTTYPE_CustomerShipment);
38
// setDocAction (null);
39
setMovementDate (new Timestamp (System.currentTimeMillis ()));
40         // setDeliveryViaRule (null);
41
setProcessed (false);
42         // setPriorityRule (null);
43
setC_BPartner_Location_ID (0);
44             setIsSOTrx (false);
45             setDeliveryRule (null);
46             setIsPrinted (false);
47             setFreightCostRule (null);
48             setC_BPartner_ID (0);
49             setC_DocType_ID (0);
50             setSendEMail (false);
51         // setDocStatus (null);
52
// setDocumentNo (null);
53
}
54     } // MInOut
55

56     /**
57      * Load Constructor
58      * @param ctx context
59      * @param rs result set record
60      */

61     public MInOut (Properties ctx, ResultSet rs)
62     {
63         super (ctx, rs);
64     } // MInOut
65

66     /**
67      * Get Document Status
68      * @return Document Status Clear Text
69      */

70     public String JavaDoc getDocStatusName()
71     {
72         return MRef_List.getListName(getCtx(), 131, getDocStatus());
73     } // getDocStatusName
74

75     /**
76      * String representation
77      * @return info
78      */

79     public String JavaDoc toString ()
80     {
81         StringBuffer JavaDoc sb = new StringBuffer JavaDoc ("MInOut[")
82             .append (getID()).append("-").append(getDocumentNo())
83             .append(",DocStatus=").append(getDocStatus())
84             .append ("]");
85         return sb.toString ();
86     } // toString
87

88     /**
89      * Get Lines of Project
90      * @return lines
91      */

92     public MInOutLine[] getMInOutLines()
93     {
94         ArrayList list = new ArrayList();
95         String JavaDoc sql = "SELECT * FROM M_InOutLine WHERE M_InOut_ID=? ORDER BY Line";
96         PreparedStatement pstmt = null;
97         try
98         {
99             pstmt = DB.prepareStatement(sql);
100             pstmt.setInt(1, getM_InOut_ID());
101             ResultSet rs = pstmt.executeQuery();
102             while (rs.next())
103                 list.add(new MInOutLine(getCtx(), rs));
104             rs.close();
105             pstmt.close();
106             pstmt = null;
107         }
108         catch (SQLException ex)
109         {
110             log.error("", ex);
111         }
112         try
113         {
114             if (pstmt != null)
115                 pstmt.close();
116         }
117         catch (SQLException ex1)
118         {
119         }
120         pstmt = null;
121         //
122
MInOutLine[] retValue = new MInOutLine[list.size()];
123         list.toArray(retValue);
124         return retValue;
125     } // getMInOutLines
126

127 } // MInOut
128
Popular Tags