KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > compiere > process > ProjectClose


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.process;
15
16 import java.math.*;
17 import java.util.*;
18 import java.sql.*;
19
20 import org.compiere.model.*;
21 import org.compiere.util.*;
22
23 /**
24  * Close Project.
25  *
26  * @author Jorg Janke
27  * @version $Id: ProjectClose.java,v 1.2 2003/09/07 04:47:40 jjanke Exp $
28  */

29 public class ProjectClose extends SvrProcess
30 {
31     /** Project from Record */
32     private int m_C_Project_ID = 0;
33
34     /**
35      * Prepare - e.g., get Parameters.
36      */

37     protected void prepare()
38     {
39         ProcessInfoParameter[] para = getParameter();
40         for (int i = 0; i < para.length; i++)
41         {
42             String JavaDoc name = para[i].getParameterName();
43             if (para[i].getParameter() == null)
44                 ;
45             else
46                 log.error("prepare - Unknown Parameter: " + name);
47         }
48         m_C_Project_ID = getRecord_ID();
49     } // prepare
50

51     /**
52      * Perrform process.
53      * @return Message (clear text)
54      * @throws Exception if not successful
55      */

56     protected String JavaDoc doIt() throws Exception JavaDoc
57     {
58         MProject project = new MProject (getCtx(), m_C_Project_ID);
59         log.info("doIt - " + project);
60
61         MProjectLine[] projectLines = project.getLines();
62         if (MProject.PROJECTCATEGORY_WorkOrderJob.equals(project.getProjectCategory())
63             || MProject.PROJECTCATEGORY_AssetProject.equals(project.getProjectCategory()))
64         {
65             /** @todo Check if we should close it */
66         }
67
68         // Close lines
69
for (int line = 0; line < projectLines.length; line++)
70         {
71             projectLines[line].setProcessed(true);
72             projectLines[line].save();
73         }
74
75         project.setProcessed(true);
76         project.save();
77
78         return "";
79     } // doIt
80

81 } // ProjectClose
82
Popular Tags