KickJava   Java API By Example, From Geeks To Geeks.

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


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.sql.*;
17 import java.util.*;
18 import java.math.*;
19
20 import org.compiere.util.*;
21
22 /**
23  * Material Transaction Model
24  *
25  * @author Jorg Janke
26  * @version $Id: MTransaction.java,v 1.1 2003/09/05 04:59:48 jjanke Exp $
27  */

28 public class MTransaction extends X_M_Transaction
29 {
30     /**
31      * Standard Constructor
32      * @param ctx context
33      * @param M_Transaction_ID id
34      */

35     public MTransaction (Properties ctx, int M_Transaction_ID)
36     {
37         super (ctx, M_Transaction_ID);
38         if (M_Transaction_ID == 0)
39         {
40         // setM_Transaction_ID (0); // PK
41
setM_Locator_ID (0);
42             setM_Product_ID (0);
43             setMovementDate (new Timestamp(System.currentTimeMillis()));
44             setMovementQty (Env.ZERO);
45             setMovementType (null);
46         }
47     } // MTransaction
48

49     /**
50      * Load Constructor
51      * @param ctx context
52      * @param rs result set
53      */

54     public MTransaction (Properties ctx, ResultSet rs)
55     {
56         super (ctx, rs);
57     } // MTransaction
58

59     /**
60      * Detail Constructor
61      * @param ctx context
62      * @param MovementType movement type
63      * @param M_Locator_ID locator
64      * @param M_Product_ID product
65      * @param M_AttributeSetInstance_ID attribute
66      * @param MovementQty qty
67      * @param MovementDate optional date
68      */

69     public MTransaction (Properties ctx, String JavaDoc MovementType, int M_Locator_ID,
70         int M_Product_ID, int M_AttributeSetInstance_ID, BigDecimal MovementQty, Timestamp MovementDate)
71     {
72         super (ctx, 0);
73         setMovementType (MovementType);
74         if (M_Locator_ID == 0)
75             throw new IllegalArgumentException JavaDoc("MTransaction - No Locator");
76         setM_Locator_ID (M_Locator_ID);
77         if (M_Product_ID == 0)
78             throw new IllegalArgumentException JavaDoc("MTransaction - No Product");
79         setM_Product_ID (M_Product_ID);
80         setM_AttributeSetInstance_ID(M_AttributeSetInstance_ID);
81         if (MovementQty == null || MovementQty.compareTo(Env.ZERO) == 0)
82             throw new IllegalArgumentException JavaDoc("MTransaction - No Qty");
83         setMovementQty (MovementQty);
84         if (MovementDate == null)
85             setMovementDate (new Timestamp(System.currentTimeMillis()));
86         else
87             setMovementDate(MovementDate);
88     } // MTransaction
89

90 } // MTransaction
91
Popular Tags