KickJava   Java API By Example, From Geeks To Geeks.

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


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 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.ResultSet JavaDoc;
17 import java.util.Properties JavaDoc;
18
19 /**
20  * Serial Number Control Model
21  *
22  * @author Jorg Janke
23  * @version $Id: MSerNoCtl.java,v 1.2 2003/10/25 06:07:16 jjanke Exp $
24  */

25 public class MSerNoCtl extends X_M_SerNoCtl
26 {
27     /**
28      * Standard Constructor
29      * @param ctx context
30      * @param M_SerNoCtl_ID id
31      */

32     public MSerNoCtl(Properties JavaDoc ctx, int M_SerNoCtl_ID)
33     {
34         super(ctx, M_SerNoCtl_ID);
35         if (M_SerNoCtl_ID == 0)
36         {
37         // setM_SerNoCtl_ID (0);
38
setStartNo (1);
39             setCurrentNext (1);
40             setIncrementNo (1);
41         // setName (null);
42
}
43     } // MSerNoCtl
44

45     /**
46      * Load Constructor
47      * @param ctx context
48      * @param rs result set
49      */

50     public MSerNoCtl(Properties JavaDoc ctx, ResultSet JavaDoc rs)
51     {
52         super(ctx, rs);
53     } // MSerNoCtl
54

55     /**
56      * Create new Lot.
57      * Increments Current Next and Commits
58      * @param M_Product_ID product
59      * @return saved Lot
60      */

61     public String JavaDoc createSerNo ()
62     {
63         StringBuffer JavaDoc name = new StringBuffer JavaDoc();
64         if (getPrefix() != null)
65             name.append(getPrefix());
66         int no = getCurrentNext();
67         name.append(no);
68         if (getSuffix() != null)
69             name.append(getSuffix());
70         //
71
no += getIncrementNo();
72         setCurrentNext(no);
73         save();
74         return name.toString();
75     } // createSerNo
76

77 } // MSerNoCtl
78
Popular Tags