Finally - a compilable version of sqlj Adempiere - as sqlj is very unused lately I forgot totally how to program there :-)

This commit is contained in:
Carlos Ruiz 2010-04-20 03:58:10 +00:00
parent 29d9f526ab
commit d856ad08a5
3 changed files with 28 additions and 5 deletions

View File

@ -20,6 +20,11 @@ CREATE OR REPLACE FUNCTION adempiereProperty(p_key VARCHAR2)
AS LANGUAGE JAVA AS LANGUAGE JAVA
NAME 'org.compiere.sqlj.Adempiere.getProperty(java.lang.String) return java.lang.String'; NAME 'org.compiere.sqlj.Adempiere.getProperty(java.lang.String) return java.lang.String';
/ /
CREATE OR REPLACE FUNCTION get_Sysconfig(Name VARCHAR2, defaultValue VARCHAR2, AD_Client_ID NUMBER, AD_Org_ID NUMBER)
RETURN VARCHAR2
AS LANGUAGE JAVA
NAME 'org.compiere.sqlj.Adempiere.get_Sysconfig(java.lang.String,java.lang.String,int,int) return java.lang.String';
/
/** Product **/ /** Product **/
CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID NUMBER) CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID NUMBER)

View File

@ -27,6 +27,11 @@ SQLActions[ ] = {
AS 'org.compiere.sqlj.Adempiere.nextIDfunc(int,java.lang.String)' AS 'org.compiere.sqlj.Adempiere.nextIDfunc(int,java.lang.String)'
LANGUAGE java VOLATILE; LANGUAGE java VOLATILE;
CREATE OR REPLACE FUNCTION get_Sysconfig(Name VARCHAR, defaultValue VARCHAR, AD_Client_ID INTEGER, AD_Client_ID INTEGER)
RETURNS VARCHAR
AS 'org.compiere.sqlj.Adempiere.get_Sysconfig(java.lang.String,java.lang.String,int,int)'
LANGUAGE java VOLATILE;
/** Product **/ /** Product **/
CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID NUMERIC) CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID NUMERIC)
RETURNS VARCHAR RETURNS VARCHAR

View File

@ -28,9 +28,6 @@ import java.util.Calendar;
import java.util.Enumeration; import java.util.Enumeration;
import java.util.GregorianCalendar; import java.util.GregorianCalendar;
import org.compiere.model.MSysConfig;
/** /**
* SQLJ Adempiere Control and Utility Class * SQLJ Adempiere Control and Utility Class
* *
@ -576,10 +573,26 @@ public class Adempiere implements Serializable
* @param Client ID * @param Client ID
* @param Organization ID * @param Organization ID
* @return String * @return String
* @throws SQLException
*/ */
public static String getValue(String Name, String defaultValue, int AD_Client_ID, int AD_Org_ID) public static String get_Sysconfig(String Name, String defaultValue, int AD_Client_ID, int AD_Org_ID) throws SQLException
{ {
return MSysConfig.getValue(Name, defaultValue, AD_Client_ID, AD_Org_ID); String value = null;
String sql = "SELECT Value FROM AD_SysConfig WHERE Name=? AND AD_Client_ID IN (0, ?) AND AD_Org_ID IN (0, ?) AND IsActive='Y' ORDER BY AD_Client_ID DESC, AD_Org_ID DESC";
PreparedStatement pstmt = Adempiere.prepareStatement(sql);
pstmt.setString(1, Name);
pstmt.setInt(2, AD_Client_ID);
pstmt.setInt(3, AD_Org_ID);
ResultSet rs = pstmt.executeQuery();
if (rs.next()) {
value = rs.getString(1);
} else {
value = defaultValue;
}
rs.close();
pstmt.close();
return value;
} }
} // Adempiere } // Adempiere