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:
parent
29d9f526ab
commit
d856ad08a5
|
@ -20,6 +20,11 @@ CREATE OR REPLACE FUNCTION adempiereProperty(p_key VARCHAR2)
|
|||
AS LANGUAGE JAVA
|
||||
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 **/
|
||||
CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID NUMBER)
|
||||
|
|
|
@ -27,6 +27,11 @@ SQLActions[ ] = {
|
|||
AS 'org.compiere.sqlj.Adempiere.nextIDfunc(int,java.lang.String)'
|
||||
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 **/
|
||||
CREATE OR REPLACE FUNCTION productAttribute (M_AttributeSetInstance_ID NUMERIC)
|
||||
RETURNS VARCHAR
|
||||
|
|
|
@ -28,9 +28,6 @@ import java.util.Calendar;
|
|||
import java.util.Enumeration;
|
||||
import java.util.GregorianCalendar;
|
||||
|
||||
import org.compiere.model.MSysConfig;
|
||||
|
||||
|
||||
/**
|
||||
* SQLJ Adempiere Control and Utility Class
|
||||
*
|
||||
|
@ -576,10 +573,26 @@ public class Adempiere implements Serializable
|
|||
* @param Client ID
|
||||
* @param Organization ID
|
||||
* @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
|
||||
|
|
Loading…
Reference in New Issue