KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > org > openbravo > erpCommon > utility > WindowTreeChecks


1 /*
2  *************************************************************************
3  * The contents of this file are subject to the Openbravo Public License
4  * Version 1.0 (the "License"), being the Mozilla Public License
5  * Version 1.1 with a permitted attribution clause; you may not use this
6  * file except in compliance with the License. You may obtain a copy of
7  * the License at http://www.openbravo.com/legal/license.html
8  * Software distributed under the License is distributed on an "AS IS"
9  * basis, WITHOUT WARRANTY OF ANY KIND, either express or implied. See the
10  * License for the specific language governing rights and limitations
11  * under the License.
12  * The Original Code is Openbravo ERP.
13  * The Initial Developer of the Original Code is Openbravo SL
14  * All portions are Copyright (C) 2001-2006 Openbravo SL
15  * All Rights Reserved.
16  * Contributor(s): ______________________________________.
17  ************************************************************************
18 */

19 package org.openbravo.erpCommon.utility;
20
21 import org.openbravo.database.ConnectionProvider;
22 import org.openbravo.base.secureApp.*;
23 import javax.servlet.*;
24 import org.apache.log4j.Logger ;
25
26
27 public class WindowTreeChecks {
28   static Logger log4j = Logger.getLogger(WindowTreeChecks.class);
29   
30   public static String JavaDoc checkChanges(ConnectionProvider conn, VariablesSecureApp vars, String JavaDoc tabId, String JavaDoc topNodeId, String JavaDoc nodeId, boolean isChild) throws ServletException {
31     String JavaDoc result = "";
32     if (topNodeId.equals(nodeId)) return Utility.messageBD(conn, "SameElement", vars.getLanguage());
33     try {
34       String JavaDoc table = WindowTreeData.selectTableName(conn, tabId);
35       String JavaDoc key = WindowTreeData.selectKey(conn, tabId);
36       String JavaDoc TreeType = WindowTreeUtility.getTreeType(key);
37       if (isChild && WindowTreeChecksData.selectIsSummary(conn, table, key, topNodeId).equals("N")) return Utility.messageBD(conn, "NotIsSummary", vars.getLanguage());
38       if (log4j.isDebugEnabled()) log4j.debug("key:"+key+", nodeId:"+nodeId+",topNodeId:"+topNodeId);
39       String JavaDoc treeID;
40       WindowTreeData[] data = WindowTreeData.selectTreeID(conn, vars.getClient(), TreeType);
41     
42       if (!(data==null || data.length==0)) {
43         treeID = data[0].id;
44         if (!WindowTreeChecksData.isItsOwnChild(conn,treeID, topNodeId,nodeId).equals("0")) return Utility.messageBD(conn,"RecursiveTree",vars.getLanguage());
45       }
46       result = WindowTreeChecks.checkSpecificChanges(conn, vars, tabId, topNodeId, nodeId, isChild, TreeType, key);
47     } catch (ServletException ex) {
48       log4j.error(ex);
49       return Utility.messageBD(conn, "Error", vars.getLanguage());
50     }
51     return result;
52   }
53
54   public static String JavaDoc checkSpecificChanges(ConnectionProvider conn, VariablesSecureApp vars, String JavaDoc tabId, String JavaDoc topNodeId, String JavaDoc nodeId, boolean isChild, String JavaDoc TreeType, String JavaDoc key) throws ServletException {
55     String JavaDoc result = "";
56     if(TreeType.equals("MM")) { //Menu
57
result = "";
58     } else if (TreeType.equals("OO")) { //Organization
59
result = "";
60     } else if (TreeType.equals("PR")) { //Product
61
result = "";
62     } else if (TreeType.equals("PC")) { //Product Category
63
result = "";
64     } else if (TreeType.equals("BB")) { //Product BOM
65
result = "";
66     } else if (TreeType.equals("EV")) { //Element Value
67
result = "";
68     } else if (TreeType.equals("BP")) { //BusinessPartner
69
result = "";
70     } else if (TreeType.equals("MC")) { //Campaign
71
result = "";
72     } else if (TreeType.equals("PJ")) { //Project
73
result = "";
74     } else if (TreeType.equals("AY")) { //Activity
75
result = "";
76     } else if (TreeType.equals("SR")) { //Sales Region
77
result = "";
78     } else if (TreeType.equals("AR")){ //Accounting report
79
result = "";
80     } else result = WindowTreeChecksClient.checkChanges(conn, vars, tabId, topNodeId, nodeId, isChild, TreeType, key);
81     return result;
82   }
83 }
84
Popular Tags