[cleanup] Remove java methods which have been already deprecated in 2.40
authorStefan Hühner <stefan.huehner@openbravo.com>
Mon, 09 May 2011 21:51:45 +0200
changeset 12077 648e70cc595a
parent 12076 b9ee34858734
child 12078 480d39749726
[cleanup] Remove java methods which have been already deprecated in 2.40
Only remove methods which have been deprecated for 2 stable releases already
to minimize impact on any custom code using those.
Effectively only remove a couple of old access checking methods and their
related xsql-methods (which can't be marked as deprecated so far)
src/org/openbravo/erpCommon/utility/Utility.java
src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql
--- a/src/org/openbravo/erpCommon/utility/Utility.java	Tue May 10 11:58:35 2011 +0200
+++ b/src/org/openbravo/erpCommon/utility/Utility.java	Mon May 09 21:51:45 2011 +0200
@@ -1149,45 +1149,6 @@
   }
 
   /**
-   * Deprecated. Used in the old order by window.
-   * 
-   * @deprecated
-   * @param SQL
-   * @param fields
-   */
-  @Deprecated
-  public static String getOrderByFromSELECT(String[] SQL, Vector<String> fields) {
-    if (SQL == null || SQL.length == 0)
-      return "";
-    else if (fields == null || fields.size() == 0)
-      return "";
-    final StringBuffer script = new StringBuffer();
-    for (int i = 0; i < fields.size(); i++) {
-      String token = fields.elementAt(i);
-      token = token.trim();
-      boolean isnegative = false;
-      if (token.startsWith("-")) {
-        token = token.substring(1);
-        isnegative = true;
-      }
-      if (Integer.valueOf(token).intValue() > SQL.length)
-        log4j.error("Field not found in select - at position: " + token);
-      if (!script.toString().equals(""))
-        script.append(", ");
-      String strAux = SQL[Integer.valueOf(token).intValue() - 1];
-      strAux = strAux.toUpperCase().trim();
-      final int pos = strAux.indexOf(" AS ");
-      if (pos != -1)
-        strAux = strAux.substring(0, pos);
-      strAux = strAux.trim();
-      script.append(strAux);
-      if (isnegative)
-        script.append(" DESC");
-    }
-    return script.toString();
-  }
-
-  /**
    * Gets the window id for a tab.
    * 
    * @param conn
@@ -1202,17 +1163,6 @@
     return UtilityData.getWindowID(conn, strTabID);
   }
 
-  /*
-   * public static String getRegistryKey(String key) { RegistryKey aKey = null; RegStringValue
-   * regValue = null;
-   * 
-   * try{ aKey =com.ice.jni.registry.Registry.HKEY_LOCAL_MACHINE.openSubKey(
-   * "SYSTEM\\CurrentControlSet\\Control\\Session Manager\\Environment"); regValue =
-   * (RegStringValue)aKey.getValue("PATH"); } catch(NoSuchValueException e) { //Key value does not
-   * exist. } catch(RegistryException e) { //Any other registry API error. } return
-   * regValue.toString(); }
-   */
-
   /**
    * Saves the content into a fisical file.
    * 
@@ -1326,47 +1276,6 @@
   }
 
   /**
-   * Auxiliar method, used by fillSQLParameters and fillTableSQLParameters to get the values for
-   * each parameter.
-   * 
-   * Deprecated as only internal utility function for ComboTableData and TableSQLData code, should
-   * never be used directly by other code.
-   * 
-   * @param conn
-   *          Handler for the database connection.
-   * @param vars
-   *          Handler for the session info.
-   * @param data
-   *          FieldProvider with the columns values.
-   * @param name
-   *          Name of the parameter.
-   * @param window
-   *          Window id.
-   * @param actual_value
-   *          Actual value.
-   * @return String with the parsed parameter.
-   * @throws Exception
-   */
-  @Deprecated
-  public static String parseParameterValue(ConnectionProvider conn, VariablesSecureApp vars,
-      FieldProvider data, String name, String window, String actual_value) throws Exception {
-    String strAux = null;
-    if (name.equalsIgnoreCase("@ACTUAL_VALUE@"))
-      return actual_value;
-    if (data != null)
-      strAux = data.getField(name);
-    if (strAux == null) {
-      strAux = vars.getStringParameter("inp" + Sqlc.TransformaNombreColumna(name));
-      if (log4j.isDebugEnabled())
-        log4j.debug("parseParameterValues - getStringParameter(inp"
-            + Sqlc.TransformaNombreColumna(name) + "): " + strAux);
-      if (strAux == null || strAux.equals(""))
-        strAux = getContext(conn, vars, name, window);
-    }
-    return strAux;
-  }
-
-  /**
    * Auxiliary method, used by fillSQLParameters and fillTableSQLParameters to get the values for
    * each parameter.
    * 
@@ -2017,105 +1926,6 @@
   }
 
   @Deprecated
-  public static boolean hasFormAccess(ConnectionProvider conn, VariablesSecureApp vars,
-      String process) {
-    return hasFormAccess(conn, vars, process, "");
-  }
-
-  @Deprecated
-  public static boolean hasFormAccess(ConnectionProvider conn, VariablesSecureApp vars,
-      String process, String processName) {
-    try {
-      if (process.equals("") && processName.equals(""))
-        return true;
-      else if (!process.equals("")) {
-
-        if (!WindowAccessData.hasFormAccess(conn, vars.getRole(), process))
-          return false;
-      } else {
-        if (!WindowAccessData.hasFormAccessName(conn, vars.getRole(), processName))
-          return false;
-      }
-    } catch (final ServletException e) {
-      return false;
-    }
-    return true;
-  }
-
-  @Deprecated
-  public static boolean hasProcessAccess(ConnectionProvider conn, VariablesSecureApp vars,
-      String process) {
-    return hasProcessAccess(conn, vars, process, "");
-  }
-
-  @Deprecated
-  public static boolean hasProcessAccess(ConnectionProvider conn, VariablesSecureApp vars,
-      String process, String processName) {
-    try {
-      if (process.equals("") && processName.equals(""))
-        return true;
-      else if (!process.equals("")) {
-        if (!WindowAccessData.hasProcessAccess(conn, vars.getRole(), process))
-          return false;
-      } else {
-        if (!WindowAccessData.hasProcessAccessName(conn, vars.getRole(), processName))
-          return false;
-      }
-    } catch (final ServletException e) {
-      return false;
-    }
-    return true;
-  }
-
-  @Deprecated
-  public static boolean hasAccess(ConnectionProvider conn, VariablesSecureApp vars,
-      String TableLevel, String AD_Client_ID, String AD_Org_ID, String window, String tab) {
-    final String command = vars.getCommand();
-    try {
-      if (!canViewInsert(conn, vars, TableLevel, window))
-        return false;
-      else if (!WindowAccessData.hasWindowAccess(conn, vars.getRole(), window))
-        return false;
-      else if (WindowAccessData.hasNoTableAccess(conn, vars.getRole(), tab))
-        return false;
-      else if (command.toUpperCase().startsWith("SAVE")) {
-        if (!canUpdate(conn, vars, AD_Client_ID, AD_Org_ID, window))
-          return false;
-      } else if (command.toUpperCase().startsWith("DELETE")) {
-        if (!canUpdate(conn, vars, AD_Client_ID, AD_Org_ID, window))
-          return false;
-      }
-    } catch (final ServletException e) {
-      return false;
-    }
-    return true;
-  }
-
-  @Deprecated
-  public static boolean canViewInsert(ConnectionProvider conn, VariablesSecureApp vars,
-      String TableLevel, String window) {
-    final String User_Level = getContext(conn, vars, "#User_Level", window);
-
-    boolean retValue = true;
-
-    if (TableLevel.equals("4") && User_Level.indexOf("S") == -1)
-      retValue = false;
-    else if (TableLevel.equals("1") && User_Level.indexOf("O") == -1)
-      retValue = false;
-    else if (TableLevel.equals("3")
-        && (!(User_Level.indexOf("C") != -1 || User_Level.indexOf("O") != -1)))
-      retValue = false;
-    else if (TableLevel.equals("6")
-        && (!(User_Level.indexOf("S") != -1 || User_Level.indexOf("C") != -1)))
-      retValue = false;
-
-    if (retValue)
-      return retValue;
-
-    return retValue;
-  }
-
-  @Deprecated
   // in 2.50
   public static boolean hasAttachments(ConnectionProvider conn, String userClient, String userOrg,
       String tableId, String recordId) throws ServletException {
--- a/src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql	Tue May 10 11:58:35 2011 +0200
+++ b/src/org/openbravo/erpCommon/utility/WindowAccess_data.xsql	Mon May 09 21:51:45 2011 +0200
@@ -23,34 +23,6 @@
 <SqlClass name="WindowAccessData" package="org.openbravo.erpCommon.utility" accessModifier="public">
   <SqlClassComment></SqlClassComment>
   
-	<SqlMethod name="hasWindowAccess" type="preparedStatement" return="boolean">
-		<SqlMethodComment></SqlMethodComment>
-		<Sql>
-			select Count(*) AS TOTAL
-			FROM AD_Window_Access
-			WHERE AD_Role_ID = ?
-			AND AD_Window_ID = ?
-			AND IsActive = 'Y'
-		</Sql>
-		<Parameter name="adRoleId"/>
-		<Parameter name="adWindowId"/>
-	</SqlMethod>
-	
-	<SqlMethod name="hasNoTableAccess" type="preparedStatement" return="boolean">
-		<SqlMethodComment></SqlMethodComment>
-		<Sql>
-			select Count(*) AS TOTAL
-			FROM AD_Table_Access t, AD_Tab tb
-			WHERE t.AD_Table_ID = tb.AD_Table_ID
-			AND t.AD_Role_ID = ?
-			AND tb.AD_Tab_ID = ?
-			AND t.IsActive = 'Y'
-			AND t.IsExclude = 'Y'
-		</Sql>
-		<Parameter name="adRoleId"/>
-		<Parameter name="adTabId"/>
-	</SqlMethod>
-	
 	 <SqlMethod name="hasReadOnlyAccess" type="preparedStatement" return="boolean">
     <SqlMethodComment></SqlMethodComment>
     <Sql>
@@ -122,60 +94,6 @@
     <Parameter name="adTabId"/>
   </SqlMethod>
   
-	<SqlMethod name="hasProcessAccess" type="preparedStatement" return="boolean">
-		<SqlMethodComment></SqlMethodComment>
-		<Sql>
-			select Count(*) AS TOTAL
-			FROM AD_Process_Access
-			WHERE AD_Role_ID = ?
-			AND AD_Process_ID = ?
-			AND IsActive = 'Y'
-		</Sql>
-		<Parameter name="adRoleId"/>
-		<Parameter name="adProcessId"/>
-	</SqlMethod>
-	
-	<SqlMethod name="hasProcessAccessName" type="preparedStatement" return="boolean">
-		<SqlMethodComment></SqlMethodComment>
-		<Sql>
-			select Count(*) AS TOTAL
-			FROM AD_Process_Access a, AD_Process p
-			WHERE a.AD_Role_ID = ?
-			AND a.AD_Process_ID = p.AD_Process_ID
-			AND UPPER(p.Value) = UPPER(?)
-			AND a.IsActive = 'Y'
-		</Sql>
-		<Parameter name="adRoleId"/>
-		<Parameter name="name"/>
-	</SqlMethod>
-	
-	<SqlMethod name="hasFormAccess" type="preparedStatement" return="boolean">
-		<SqlMethodComment></SqlMethodComment>
-		<Sql>
-			select Count(*) AS TOTAL
-			FROM AD_Form_Access
-			WHERE AD_Role_ID = ?
-			AND AD_Form_ID = ?
-			AND IsActive = 'Y'
-		</Sql>
-		<Parameter name="adRoleId"/>
-		<Parameter name="adFormId"/>
-	</SqlMethod>
-	
-	<SqlMethod name="hasFormAccessName" type="preparedStatement" return="boolean">
-		<SqlMethodComment></SqlMethodComment>
-		<Sql>
-			select Count(*) AS TOTAL
-			FROM AD_Form_Access a, AD_Form f
-			WHERE a.AD_Role_ID = ?
-			AND a.AD_Form_ID = f.AD_Form_ID
-			AND UPPER(f.ClassName) = UPPER(?)
-			AND a.IsActive = 'Y'
-		</Sql>
-		<Parameter name="adRoleId"/>
-		<Parameter name="name"/>
-	</SqlMethod>
-
 	<SqlMethod name="hasWriteAccess" type="preparedStatement" return="boolean">
 	   <SqlMethodComment></SqlMethodComment>
 	   <Sql>