Adempiere 3.1.2

This commit is contained in:
vpj-cd 2006-12-07 03:21:41 +00:00
parent 6c5fa90281
commit ee46d9e792
24 changed files with 9257 additions and 8777 deletions

View File

@ -42,7 +42,7 @@ public final class Adempiere
/** Timestamp */
static public final String ID = "$Id: Adempiere.java,v 1.8 2006/08/11 02:58:14 jjanke Exp $";
/** Main Version String */
static public final String MAIN_VERSION = "Release 3.1.1";
static public final String MAIN_VERSION = "Release 3.1.2";
/** Detail Version as date Used for Client/Server */
static public final String DATE_VERSION = "2006-11-02";
/** Database Version as date Compared with AD_System */
@ -72,7 +72,7 @@ public final class Adempiere
static private String s_supportEmail = "";
/** Subtitle */
static public final String SUB_TITLE = "The Open Source Profesional ERP,CRM and SCM ";
static public final String SUB_TITLE = "Smart Suite ERP,CRM and SCM ";
/** Adempiere is a wordwide registered Trademark
* - Don't modify this - Program will someday fail unexpectedly */
static public final String ADEMPIERE_R = "Adempiere\u00AE";

View File

@ -27,7 +27,7 @@ import org.compiere.interfaces.*;
import org.compiere.util.*;
/**
* Adempiere Connection Descriptor
* Compiere Connection Descriptor
*
* @author Jorg Janke
* @author Marek Mosiewicz<marek.mosiewicz@jotel.com.pl> - support for RMI over HTTP
@ -138,7 +138,7 @@ public class CConnection implements Serializable
/**************************************************************************
* Adempiere Connection
* Compiere Connection
* @param host optional application/db host
*/
private CConnection (String host)
@ -182,9 +182,9 @@ public class CConnection implements Serializable
private int m_fw_port = 0;
/** DB User name */
private String m_db_uid = "adempiere";
private String m_db_uid = "compiere";
/** DB User password */
private String m_db_pwd = "adempiere";
private String m_db_pwd = "compiere";
/** Database */
private AdempiereDatabase m_db = null;
@ -210,9 +210,6 @@ public class CConnection implements Serializable
/** DB Info */
private String m_dbInfo = null;
/** Had application server been query **/
private boolean m_queryAppsServer = false;
/*************************************************************************
* Get Name
@ -259,7 +256,6 @@ public class CConnection implements Serializable
m_apps_host = apps_host;
m_name = toString ();
m_okApps = false;
m_queryAppsServer = false;
}
/**
@ -279,7 +275,6 @@ public class CConnection implements Serializable
{
m_apps_port = apps_port;
m_okApps = false;
m_queryAppsServer = false;
}
/**
@ -308,11 +303,9 @@ public class CConnection implements Serializable
*/
public boolean isAppsServerOK (boolean tryContactAgain)
{
if (!tryContactAgain && m_queryAppsServer)
if (!tryContactAgain)
return m_okApps;
m_queryAppsServer = true;
// Get Context
if (m_iContext == null)
{
@ -347,9 +340,8 @@ public class CConnection implements Serializable
*/
public Exception testAppsServer ()
{
//if (queryAppsServerInfo ())
// testDatabase (false);
queryAppsServerInfo ();
if (queryAppsServerInfo ())
testDatabase (false);
return getAppsServerException ();
} // testAppsServer
@ -809,24 +801,11 @@ public class CConnection implements Serializable
if (getDbPort () != DB_DB2.DEFAULT_PORT)
setDbPort (DB_DB2.DEFAULT_PORT);
}
else if (isDerby())
/*else if (isDerby())
{
// if (getDbPort () != DB_Derby.DEFAULT_PORT)
// setDbPort (DB_Derby.DEFAULT_PORT);
}
// begin vpj-cd e-evolution 09 ene 2006
// PostgreSQL
if (isPostgreSQL ())
{
if (getDbPort () != DB_PostgreSQL.DEFAULT_PORT)
setDbPort (DB_PostgreSQL.DEFAULT_PORT);
}
//end vpj-cd e-evolution 09 ene 2006
if (isFyracle())
{
if (getDbPort () != DB_Fyracle.DEFAULT_PORT)
setDbPort (DB_Fyracle.DEFAULT_PORT);
}
if (getDbPort () != DB_Derby.DEFAULT_PORT)
setDbPort (DB_Derby.DEFAULT_PORT);
}*/
} // setType
/**
@ -875,15 +854,6 @@ public class CConnection implements Serializable
return Database.DB_MSSQLServer.equals (m_type);
} // isMSSQLServer
//begin e-evolution vpj-cd 30 nov 2005
/**
* Is PostgreSQL DB
* @return true if PostgreSQL
*/
// public boolean isEDB ()
// {
// return Database.DB_EDB.equals (m_type);
// } // isPostgreSQL
/**
* Is PostgreSQL DB
* @return true if PostgreSQL
@ -902,6 +872,7 @@ public class CConnection implements Serializable
return Database.DB_FYRACLE.equals (m_type);
} // isPostgreSQL
//end
/**
* Is Database Connection OK
* @return true if database connection is OK
@ -989,7 +960,16 @@ public class CConnection implements Serializable
{
try
{
readInfo(conn);
DatabaseMetaData dbmd = conn.getMetaData ();
m_info[0] = "Database=" + dbmd.getDatabaseProductName ()
+ " - " + dbmd.getDatabaseProductVersion ();
m_info[0] = m_info[0].replace ('\n', ' ');
m_info[1] = "Driver =" + dbmd.getDriverName ()
+ " - " + dbmd.getDriverVersion ();
if (isDataSource())
m_info[1] += " - via DataSource";
m_info[1] = m_info[1].replace ('\n', ' ');
log.config(m_info[0] + " - " + m_info[1]);
conn.close ();
}
catch (Exception e)
@ -1014,6 +994,7 @@ public class CConnection implements Serializable
log.config(m_info[0] + " - " + m_info[1]);
}
/*************************************************************************
* Short String representation
* @return appsHost{dbHost-dbName-uid}
@ -1224,7 +1205,15 @@ public class CConnection implements Serializable
{
try
{
m_db = Database.getDatabase(m_type);
for (int i = 0; i < Database.DB_NAMES.length; i++)
{
if (Database.DB_NAMES[i].equals (m_type))
{
m_db = (AdempiereDatabase)Database.DB_CLASSES[i].
newInstance ();
break;
}
}
}
catch (Exception e)
{
@ -1507,19 +1496,12 @@ public class CConnection implements Serializable
log.finer(getAppsHost());
long start = System.currentTimeMillis();
m_okApps = false;
m_queryAppsServer = true;
m_appsException = null;
//
getInitialContext (false);
if (m_iContext == null)
return m_okApps; // false
// Carlos Ruiz - globalqss - speed up when jnp://MyAppsServer:1099 is set
if (getAppsHost().equalsIgnoreCase("MyAppsServer")) {
log.warning (getAppsHost() + " ignored");
return m_okApps; // false
}
// Prevent error trace
// CLogMgtLog4J.enable(false);
try
@ -1643,6 +1625,7 @@ public class CConnection implements Serializable
} // getTransactionIsolationInfo
/**************************************************************************
* Testing
* @param args ignored
@ -1664,7 +1647,7 @@ public class CConnection implements Serializable
Adempiere.startup(true);
//
System.out.println ("Connection = ");
// CConnection[name=localhost{dev-dev1-adempiere},AppsHost=localhost,AppsPort=1099,type=Oracle,DBhost=dev,DBport=1521,DBname=dev1,BQ=false,FW=false,FWhost=,FWport=1630,UID=adempiere,PWD=adempiere]
// CConnection[name=localhost{dev-dev1-compiere},AppsHost=localhost,AppsPort=1099,type=Oracle,DBhost=dev,DBport=1521,DBname=dev1,BQ=false,FW=false,FWhost=,FWport=1630,UID=compiere,PWD=compiere]
System.out.println (Ini.getProperty (Ini.P_CONNECTION));
CConnection cc = CConnection.get ();

View File

@ -220,7 +220,7 @@ public class CConnectionDialog extends CDialog implements ActionListener
,GridBagConstraints.EAST, GridBagConstraints.NONE, new Insets(0, 12, 5, 5), 0, 0));
centerPanel.add(dbUidField, new GridBagConstraints(1, 9, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 0, 5, 0), 0, 0));
centerPanel.add(dbPwdField, new GridBagConstraints(2, 9, 1, 1, 1.0, 0.0
centerPanel.add(dbPwdField, new GridBagConstraints(2, 9, 1, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.HORIZONTAL, new Insets(0, 5, 5, 12), 0, 0));
centerPanel.add(cbFirewall, new GridBagConstraints(1, 10, 2, 1, 0.0, 0.0
,GridBagConstraints.WEST, GridBagConstraints.NONE, new Insets(0, 0, 0, 12), 0, 0));

View File

@ -624,4 +624,10 @@ class DataSourceImpl implements DataSource {
return impl.toString();
}
public boolean isWrapperFor(java.lang.Class<?> iface) throws java.sql.SQLException
{
return false;
}
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException{return null;}
}

View File

@ -1,16 +1,17 @@
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Portions created by Victor Perez are Copyright (C) 1999-2005 e-Evolution,S.C
* Contributor(s): Victor Perez
* Product: Adempiere ERP & CRM Smart Business Solution
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
*****************************************************************************/
package org.compiere.db;

View File

@ -0,0 +1,426 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
*****************************************************************************/
package org.compiere.db;
import java.io.*;
import java.net.*;
import java.sql.*;
import java.util.*;
import java.util.logging.*;
import org.apache.derby.drda.*;
import org.apache.derby.impl.drda.*;
import org.apache.derby.jdbc.*;
import org.compiere.util.*;
/**
* Derby DB Server
*
* @author Jorg Janke
* @version $Id: DerbyServer.java,v 1.5 2006/07/30 00:55:13 jjanke Exp $
*/
public class DerbyServer extends Thread
{
/**
* Get/Create Derby Server
* @return server
*/
public static synchronized DerbyServer get()
{
if (s_server == null)
{
InetAddress address = null;
int port = PORT;
try
{
address = InetAddress.getByAddress(new byte[] {0,0,0,0}); // all ports
s_server = new DerbyServer(address, port);
s_server.start();
}
catch (Exception e)
{
String msg = null;
if (address == null)
msg = "";
else
msg = address.toString();
msg += ":" + port;
log.log(Level.SEVERE, msg, e);
}
}
return s_server;
} // get
/**
* Start Server
* @return true if started
*/
public static boolean startServer()
{
if (get() == null)
return false;
return s_server.isServerStarted();
} // startServer
/**
* Stop Server
* @return true if stopped / not running
*/
public static boolean stopServer()
{
if (s_server == null)
return true;
try
{
s_server.shutdown();
s_server = null;
return true;
}
catch (Exception e)
{
log.log(Level.SEVERE, e.getMessage(), e);
}
return false;
} // stopServer
/** Singleton */
private static DerbyServer s_server = null;
/** Default Port 1527 */
public static final int PORT = NetworkServerControl.DEFAULT_PORTNUMBER;
/** Logger */
private static CLogger log = CLogger.getCLogger (DerbyServer.class);
/**************************************************************************
* Derby Server
* @param address server address
* @param port port
* @throws Exception
*/
private DerbyServer (InetAddress address, int port) throws Exception
{
super("CompiereDerby");
if (s_impl != null)
throw new IllegalStateException("Derby Server already started");
//
String compiereHome = Ini.getAdempiereHome();
s_derbyHome = compiereHome + File.separator + "derby";
File dir = new File(s_derbyHome);
if (!dir.exists())
dir.mkdir();
//
System.setProperty("derby.system.home", s_derbyHome);
System.setProperty("derby.drda.traceDirectory", s_derbyHome);
//
String logIt = "false";
if (CLogMgt.isLevelFiner())
logIt = "true";
System.setProperty("derby.drda.logConnections", logIt);
System.setProperty("derby.drda.traceAll", logIt);
//
System.setProperty("derby.connection.requireAuthentication", "true");
System.setProperty("derby.authentication.provider", "BUILTIN");
addUser("compiere", "compiere");
//
s_address = address;
s_port = port;
s_impl = new NetworkServerControlImpl (s_address, s_port);
} // DerbyServer
/** Singleton */
private static NetworkServerControlImpl s_impl = null;
/** Derby Home */
private static String s_derbyHome = "";
/** Address */
private static InetAddress s_address = null;
/** Port */
private static int s_port = 0;
/**
* Run
*/
public void run()
{
log.info("starting ...");
PrintWriter consoleWriter = new PrintWriter(System.out, true); // flush
try
{
s_impl.blockingStart(consoleWriter);
}
catch (Exception e)
{
log.log(Level.SEVERE, e.getMessage(), e);
s_impl = null;
}
log.info("done");
} // run
/**
* Interrupt - shutdown
*/
public void interrupt ()
{
super.interrupt ();
shutdown();
} // interrupt
/**
* Is Server Started
* @return server started
*/
public boolean isServerStarted()
{
if (s_impl == null)
return false;
try
{
s_impl.ping();
}
catch (Exception e)
{
return false;
}
return true;
} // isServerStarted
/**
* Shutdown
* @return true if shut down
*/
public boolean shutdown()
{
if (s_impl != null)
{
try
{
log.info("shutting down ...");
s_impl.shutdown();
log.info("shutdown");
return true;
}
catch (Exception e)
{
return false;
}
}
return true;
} // shutdown
/**
* String Representation
* @return info
*/
public String toString ()
{
StringBuffer sb = new StringBuffer ("DerbyServer[");
sb.append (s_derbyHome)
.append(";").append(s_address)
.append(":").append(s_port)
.append(";Alive=").append(isAlive())
.append(";Started=").append(isServerStarted());
sb.append ("]");
return sb.toString ();
} // toString
/**
* Get Derby Home
* @return home
*/
public String getDerbyHome()
{
return s_derbyHome;
} // getDerbyHome
/**
* Get Runtime Info
* @return info
*/
public String getRuntimeInfo()
{
try
{
if (s_impl != null)
return s_impl.runtimeInfo();
}
catch (Exception e)
{
return e.getMessage();
}
return "";
} // getRuntimeInfo
/**
* Get System Info
* @return info
*/
public String getSysInfo()
{
try
{
if (s_impl != null)
return s_impl.sysinfo();
}
catch (Exception e)
{
return e.getMessage();
}
return "";
} // getSysInfo
/**
* Get current Network server properties.
* @return Properties object containing Network server properties
* @exception Exception throws an exception if an error occurs
*/
public Properties getCurrentProperties() throws Exception
{
return s_impl.getCurrentProperties();
} // getCurrentProperties
/**
* Add User
* @param dbUid user id
* @param dbPwd user password
*/
public void addUser (String dbUid, String dbPwd)
{
System.setProperty("derby.user." + dbUid, dbPwd);
Properties dp = new Properties();
} // addUser
/**
* Create Database
* @param dbName database name
* @param dbUid user id
* @param dbPwd user password
* @return true if exists or created
*/
public boolean createDatabase (String dbName,
String dbUid, String dbPwd)
{
addUser (dbUid, dbPwd);
// Embedded Driver
try
{
EmbeddedDriver driver = new EmbeddedDriver();
DriverManager.registerDriver (driver);
}
catch (Exception e)
{
log.log(Level.SEVERE, "DriverIssue", e);
return false;
}
// Connection
String dbUrl = "jdbc:derby:" + dbName;
Connection conn = null;
try
{
String urlAttributes = ";create=true"
// + "dataEncryption=true;bootPassword=cLo4u922sc23aPe"
// + ";territory=en_US"
+ ";user=" + dbUid
+ ";password=" + dbPwd;
conn = DriverManager.getConnection(dbUrl + urlAttributes);
log.info("Created DB: " + dbName);
// new JDBCInfo(conn);
}
catch (Exception e)
{
log.severe(e.getMessage());
}
try
{
if (conn != null)
conn.close();
conn = null;
}
catch (Exception e)
{
}
// Connection test
try
{
conn = DriverManager.getConnection(dbUrl, dbUid, dbPwd);
log.info("Connected to DB: " + dbName);
// new JDBCInfo(conn);
}
catch (Exception e)
{
log.severe(e.getMessage());
conn = null;
return false;
}
// Connection test
Statement stmt = null;
try
{
stmt = conn.createStatement();
stmt.executeUpdate("CREATE TABLE XX (XX VARCHAR(5))");
stmt.executeUpdate("INSERT INTO XX (XX) VALUES ('A')");
}
catch (Exception e)
{
log.info(e.getMessage());
}
try
{
if (stmt != null)
stmt.close();
if (conn != null)
conn.close();
conn = null;
}
catch (Exception e)
{
}
return true;
} // createDatabase
/**************************************************************************
* Start Derby Server
* @param args
*/
public static void main (String[] args)
{
CLogMgt.setLevel(Level.FINE);
DerbyServer server = DerbyServer.get();
startServer();
server.createDatabase("compiere", "compiere", "compiere");
// log.info(server.getRuntimeInfo());
// log.info(server.getSysInfo());
try
{
// log.info(server.getCurrentProperties().toString());
//
log.info("Sleeping " + get());
Thread.sleep(5000);
}
catch (Exception e)
{
}
// stopServer();
} // main
} // DerbyServer

View File

@ -1,18 +1,17 @@
/******************************************************************************
* Product: Adempiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
* Product: Adempiere ERP & CRM Smart Business Solution
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
*****************************************************************************/
package org.compiere.db;
@ -36,8 +35,8 @@ public class LDAP
{
/**
* Validate User
* @param ldapURL provider url - e.g. ldap://dc.adempiere.org
* @param domain domain name = e.g. adempiere.org
* @param ldapURL provider url - e.g. ldap://dc.compiere.org
* @param domain domain name = e.g. compiere.org
* @param userName user name - e.g. jjanke
* @param password password
* @return true if validated with ldap
@ -46,10 +45,10 @@ public class LDAP
{
Hashtable<String,String> env = new Hashtable<String,String>();
env.put(Context.INITIAL_CONTEXT_FACTORY, "com.sun.jndi.ldap.LdapCtxFactory");
// ldap://dc.adempiere.org
// ldap://dc.compiere.org
env.put(Context.PROVIDER_URL, ldapURL);
env.put(Context.SECURITY_AUTHENTICATION, "simple");
// jjanke@adempiere.org
// jjanke@compiere.org
StringBuffer principal = new StringBuffer (userName)
.append("@").append(domain);
env.put(Context.SECURITY_PRINCIPAL, principal.toString());
@ -65,7 +64,8 @@ public class LDAP
Attributes answer = ctx.getAttributes("");
// Print the answer
// dump (answer);
if (false)
dump (answer);
}
catch (AuthenticationException e)
{
@ -128,7 +128,7 @@ public class LDAP
// map.put("debugNative", "true");
Krb5LoginModule klogin = new Krb5LoginModule ();
System.out.println (klogin);
map.put ("principal", "username@adempiere.org");
map.put ("principal", "username@compiere.org");
map.put ("credential", "pass");
klogin.initialize (null, null, null, map);
System.out.println (klogin.login ());
@ -188,7 +188,7 @@ public class LDAP
{
try
{
validate("ldap://dc.adempiere.org", "adempiere.org", "red1", "ikeepforgetting");
validate("ldap://dc.compiere.org", "compiere.org", "jjanke", "ikeepforgetting");
}
catch (Exception e)
{

View File

@ -1,15 +1,17 @@
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Contributor(s): ______________________________________.
* Product: Adempiere ERP & CRM Smart Business Solution
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
*****************************************************************************/
package org.compiere.dbPort;

View File

@ -1,15 +1,17 @@
/******************************************************************************
* The contents of this file are subject to the Compiere License Version 1.1
* ("License"); You may not use this file except in compliance with the License
* You may obtain a copy of the License at http://www.compiere.org/license.html
* Software distributed under the License is distributed on an "AS IS" basis,
* WITHOUT WARRANTY OF ANY KIND, either express or implied. See the License for
* the specific language governing rights and limitations under the License.
* The Original Code is Compiere ERP & CRM Smart Business Solution. The Initial
* Developer of the Original Code is Jorg Janke. Portions created by Jorg Janke
* are Copyright (C) 1999-2005 Jorg Janke.
* All parts are Copyright (C) 1999-2005 ComPiere, Inc. All Rights Reserved.
* Contributor(s): ______________________________________.
* Product: Adempiere ERP & CRM Smart Business Solution
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
*****************************************************************************/
package org.compiere.dbPort;

View File

@ -188,7 +188,7 @@ public class AccessSqlParserTest extends TestCase
*/
public void testProductInstanceAttributeQuery()
{
String sql = "SELECT p.M_Product_ID, p.Discontinued, p.Value, p.Name, BOM_Qty_Available(p.M_Product_ID,?) AS QtyAvailable, bomQtyList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd, BOM_Qty_OnHand(p.M_Product_ID,?) AS QtyOnHand, BOM_Qty_Reserved(p.M_Product_ID,?) AS QtyReserved, BOM_Qty_Ordered(p.M_Product_ID,?) AS QtyOrdered, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin, bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit, pa.IsInstanceAttribute FROM M_Product p INNER JOIN M_ProductPrice pr ON (p.M_Product_ID=pr.M_Product_ID) LEFT OUTER JOIN M_AttributeSet pa ON (p.M_AttributeSet_ID=pa.M_AttributeSet_ID) WHERE p.IsSummary='N' AND p.IsActive='Y' AND pr.IsActive='Y' AND pr.M_PriceList_Version_ID=? AND EXISTS (SELECT * FROM M_Storage s INNER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) WHERE s.M_Product_ID=p.M_Product_ID AND asi.SerNo LIKE '33' AND asi.Lot LIKE '33' AND asi.M_Lot_ID=101 AND TRUNC(asi.GuaranteeDate,'DD')<TO_DATE('2003-10-16','YYYY-MM-DD') AND asi.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=103 AND Value LIKE '33') AND (M_Attribute_ID=102 AND M_AttributeValue_ID=106))) AND p.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=101 AND M_AttributeValue_ID=105) AND (M_Attribute_ID=100 AND M_AttributeValue_ID=102)) AND p.AD_Client_ID IN(0,11) AND p.AD_Org_ID IN(0,11,12) ORDER BY QtyAvailable DESC, Margin DESC";
String sql = "SELECT p.M_Product_ID, p.Discontinued, p.Value, p.Name, BOM_Qty_Available(p.M_Product_ID,?) AS QtyAvailable, bomQtyList(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceList, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceStd, BOM_Qty_OnHand(p.M_Product_ID,?) AS QtyOnHand, BOM_Qty_Reserved(p.M_Product_ID,?) AS QtyReserved, BOM_Qty_Ordered(p.M_Product_ID,?) AS QtyOrdered, bomQtyStd(p.M_Product_ID, pr.M_PriceList_Version_ID)-bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS Margin, bomQtyLimit(p.M_Product_ID, pr.M_PriceList_Version_ID) AS PriceLimit, pa.IsInstanceAttribute FROM M_Product p INNER JOIN M_ProductPrice pr ON (p.M_Product_ID=pr.M_Product_ID) LEFT OUTER JOIN M_AttributeSet pa ON (p.M_AttributeSet_ID=pa.M_AttributeSet_ID) WHERE p.IsSummary='N' AND p.IsActive='Y' AND pr.IsActive='Y' AND pr.M_PriceList_Version_ID=? AND EXISTS (SELECT * FROM M_Storage s INNER JOIN M_AttributeSetInstance asi ON (s.M_AttributeSetInstance_ID=asi.M_AttributeSetInstance_ID) WHERE s.M_Product_ID=p.M_Product_ID AND asi.SerNo LIKE '33' AND asi.Lot LIKE '33' AND asi.M_Lot_ID=101 AND TRUNC(asi.GuaranteeDate)<TO_DATE('2003-10-16','YYYY-MM-DD') AND asi.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=103 AND Value LIKE '33') AND (M_Attribute_ID=102 AND M_AttributeValue_ID=106))) AND p.M_AttributeSetInstance_ID IN (SELECT M_AttributeSetInstance_ID FROM M_AttributeInstance WHERE (M_Attribute_ID=101 AND M_AttributeValue_ID=105) AND (M_Attribute_ID=100 AND M_AttributeValue_ID=102)) AND p.AD_Client_ID IN(0,11) AND p.AD_Org_ID IN(0,11,12) ORDER BY QtyAvailable DESC, Margin DESC";
AccessSqlParser fixture = new AccessSqlParser(sql);
assertEquals("AccessSqlParser[M_AttributeInstance|M_Storage=s,M_AttributeSetInstance=asi|M_AttributeInstance|M_Product=p,M_ProductPrice=pr,M_AttributeSet=pa|3]", fixture.toString());
}

View File

@ -234,7 +234,7 @@ public class MClientShare extends X_AD_ClientShare
StringBuffer info = new StringBuffer();
String sql = "SELECT AD_Table_ID, TableName "
+ "FROM AD_Table t "
+ "WHERE AccessLevel='3' AND IsView='N'" //jz put quote for typing
+ "WHERE AccessLevel=3 AND IsView='N'"
+ " AND EXISTS (SELECT * FROM AD_Column c "
+ "WHERE t.AD_Table_ID=c.AD_Table_ID"
+ " AND c.IsParent='Y'"

View File

@ -243,7 +243,7 @@ public class MCostElement extends X_M_CostElement
if (COSTELEMENTTYPE_Material.equals(getCostElementType())
&& (newRecord || is_ValueChanged("CostingMethod")))
{
String sql = "SELECT MAX(COALESCE(M_CostElement_ID,0)) FROM M_CostElement "
String sql = "SELECT COALESCE(MAX(M_CostElement_ID),0) FROM M_CostElement "
+ "WHERE AD_Client_ID=? AND CostingMethod=?";
int id = DB.getSQLValue(get_TrxName(), sql, getAD_Client_ID(), getCostingMethod());
if (id > 0 && id != get_ID())

View File

@ -667,12 +667,6 @@ public class MLookupFactory
}
// Order by Display
if (DB.isDerby()) //jz derby restriction
{
if (size > 3)
realSQL.append(" ORDER BY " + ((LookupDisplayColumn)list.get(2)).ColumnName);
}
else
realSQL.append(" ORDER BY 3");
MQuery zoomQuery = null; // corrected in VLookup

View File

@ -203,17 +203,10 @@ public class MOrg extends X_AD_Org
* @return C_BPartner_ID
*/
public int getLinkedC_BPartner_ID()
{
return getLinkedC_BPartner_ID(null);
}
public int getLinkedC_BPartner_ID(String trxName)
{
if (m_linkedBPartner == null)
{
//jz int C_BPartner_ID = DB.getSQLValue(null,
int C_BPartner_ID = DB.getSQLValue(trxName,
int C_BPartner_ID = DB.getSQLValue(null,
"SELECT C_BPartner_ID FROM C_BPartner WHERE AD_OrgBP_ID=?",
getAD_Org_ID());
if (C_BPartner_ID < 0) // not found = -1

View File

@ -1,18 +1,17 @@
/******************************************************************************
* Product: Compiere ERP & CRM Smart Business Solution *
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved. *
* This program is free software; you can redistribute it and/or modify it *
* under the terms version 2 of the GNU General Public License as published *
* by the Free Software Foundation. This program is distributed in the hope *
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied *
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. *
* See the GNU General Public License for more details. *
* You should have received a copy of the GNU General Public License along *
* with this program; if not, write to the Free Software Foundation, Inc., *
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA. *
* For the text or an alternative of this public license, you may reach us *
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
* Product: Adempiere ERP & CRM Smart Business Solution
* Copyright (C) 1999-2006 ComPiere, Inc. All Rights Reserved.
* This program is free software; you can redistribute it and/or modify it
* under the terms version 2 of the GNU General Public License as published
* by the Free Software Foundation. This program is distributed in the hope
* that it will be useful, but WITHOUT ANY WARRANTY; without even the implied
* warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
* See the GNU General Public License for more details.
* You should have received a copy of the GNU General Public License along
* with this program; if not, write to the Free Software Foundation, Inc.,
* 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA.
* You may reach us at: ComPiere, Inc. - http://www.compiere.org/license.html
* 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA or info@compiere.org
*****************************************************************************/
package org.compiere.model;

View File

@ -14,6 +14,7 @@
* ComPiere, Inc., 2620 Augustine Dr. #245, Santa Clara, CA 95054, USA *
* or via info@compiere.org or http://www.compiere.org/license.html *
*****************************************************************************/
package org.compiere.util;
/**
@ -46,12 +47,16 @@ public class AmtInWords_IN implements AmtInWords
"Sepuluh",
"Sebelas",
};
private static final long POWER_THREE = 1000L;
private static final long POWER_SIX = 1000000L;
private static final long POWER_NINE = 1000000000L;
private static final long POWER_TWELVE = 1000000000000L;
private static final long POWER_FIFTEEN = 1000000000000000L;
/** Static Logger */
private static CLogger s_log = CLogger.getCLogger (AmtInWords_IN.class);
//-------------------------- STATIC METHODS --------------------------
/**
@ -60,9 +65,10 @@ public class AmtInWords_IN implements AmtInWords
* @param number number to say
* @return said number
*/
public static String sayNumber(long number) {
public static String sayNumber(double number) {
StringBuffer result = new StringBuffer();
sayNumber(result, number);
result.append(" Rupiah");
return result.toString();
}
@ -74,22 +80,27 @@ public class AmtInWords_IN implements AmtInWords
* @return said number
* @throws IllegalArgumentException if the number equals to {@link Long#MIN_VALUE}
*/
public static String sayNumber(StringBuffer appendTo, long number)
public static String sayNumber(StringBuffer appendTo, double number)
throws IllegalArgumentException {
if (number == Long.MIN_VALUE) {
if (number == Double.MIN_VALUE) {
throw new IllegalArgumentException("Out of range");
}
if (number < 0) {
appendTo.append("Minus ");
}
long abs = Math.abs(number);
double abs = Math.abs(number);
// s_log.warning("Debug=" + abs);
if (abs < POWER_THREE) {
saySimpleNumber(appendTo, (int) abs);
} else if (abs < 2000) {
int thousand = (int) (abs % POWER_THREE);
appendTo.append("Seribu ");
saySimpleNumber(appendTo, thousand);
} else if (abs < POWER_SIX) {
int thousand = (int) (abs % POWER_SIX / POWER_THREE);
saySimpleNumber(appendTo, thousand);
appendTo.append(" Ribu");
long remainder = abs - thousand * POWER_THREE;
double remainder = abs - thousand * POWER_THREE;
if (remainder > 0) {
appendTo.append(' ');
sayNumber(appendTo, remainder);
@ -98,7 +109,7 @@ public class AmtInWords_IN implements AmtInWords
int million = (int) (abs % POWER_NINE / POWER_SIX);
saySimpleNumber(appendTo, million);
appendTo.append(" Juta");
long remainder = abs - million * POWER_SIX;
double remainder = abs - million * POWER_SIX;
if (remainder > 0) {
appendTo.append(' ');
sayNumber(appendTo, remainder);
@ -107,7 +118,7 @@ public class AmtInWords_IN implements AmtInWords
int billion = (int) (abs % POWER_TWELVE / POWER_NINE);
saySimpleNumber(appendTo, billion);
appendTo.append(" Milyar");
long remainder = abs - billion * POWER_NINE;
double remainder = abs - billion * POWER_NINE;
if (remainder > 0) {
appendTo.append(' ');
sayNumber(appendTo, remainder);
@ -116,28 +127,13 @@ public class AmtInWords_IN implements AmtInWords
int trillion = (int) (abs % POWER_FIFTEEN / POWER_TWELVE);
saySimpleNumber(appendTo, trillion);
appendTo.append(" Trilyun");
long remainder = abs - trillion * POWER_TWELVE;
double remainder = abs - trillion * POWER_TWELVE;
if (remainder > 0) {
appendTo.append(' ');
sayNumber(appendTo, remainder);
}
} else {
int log = (int) Math.floor(Math.log(abs) / Math.log(10));
// we want to break the number to several billions.
int logWhole = log - log % 12;
long powerWhole = (long) Math.pow(10, logWhole);
long part = abs / powerWhole;
sayNumber(appendTo, part);
appendTo.append(" Trilyun");
long remainder = abs - part * powerWhole;
if (remainder > 0) {
appendTo.append(' ');
sayNumber(appendTo, remainder);
}
appendTo.append("Lebih Dari Seribu Triliun");
}
return appendTo.toString();
}
@ -196,18 +192,28 @@ public class AmtInWords_IN implements AmtInWords
* Get Amount in Words
* @param amount numeric amount (352.80)
* @return amount in words (three*five*two 80/100)
* @throws Exception
*/
public String getAmtInWords (String amount) throws Exception
{
if (amount == null)
return amount;
//
StringBuffer result = new StringBuffer();
int pos = amount.lastIndexOf ('.');
String oldamt = amount;
amount = amount.replaceAll (",", "");
float numFloat = Float.parseFloat(amount);
long number = 0L;
number = (long)numFloat;
return AmtInWords_IN.sayNumber(number);
String cents = pos > 0 ? oldamt.substring (pos + 1):null;
double numDouble = Double.parseDouble(amount);
sayNumber(result, numDouble);
if (cents != null)
{
result.append(" Koma ");
numDouble = Double.parseDouble(cents);
sayNumber(result, numDouble);
}
result.append(" Rupiah");
return result.toString();
} // getAmtInWords
/**
@ -233,16 +239,26 @@ public class AmtInWords_IN implements AmtInWords
public static void main (String[] args)
{
AmtInWords_IN aiw = new AmtInWords_IN();
// I doubt decimal support for rupiah is still needed ;)
aiw.print (".23");
aiw.print ("948,776,477,778,778,778");
aiw.print ("1.79");
// aiw.print ("12.345");
// aiw.print ("123.45");
// aiw.print ("1234.56");
// aiw.print ("12345.78");
// aiw.print ("123457.89");
aiw.print ("1,234,578.90");
aiw.print ("0.00");
aiw.print ("0.23");
aiw.print ("1.23876787");
aiw.print ("11.45");
aiw.print ("121.45");
aiw.print ("1231.56");
aiw.print ("10341.78");
aiw.print ("12341.78");
aiw.print ("123451.89");
aiw.print ("12234571.90");
aiw.print ("123234571.90");
aiw.print ("1987234571.90");
aiw.print ("11123234571.90");
aiw.print ("123123234571.90");
aiw.print ("2123123234571.90");
aiw.print ("23,123,123,234,571.90");
aiw.print ("100,000,000,000,000.90");
aiw.print ("111,111,111");
aiw.print ("222,222,222,222,222");
aiw.print ("222,222,222,222,222,222,222");
} // main
} // AmtInWords_IN

View File

@ -170,6 +170,9 @@ public class CLogger extends Logger implements Serializable
public boolean saveWarning (String AD_Message, String message)
{
s_lastWarning = new ValueNamePair (AD_Message, message);
// print it
if (true) // issueError
warning(AD_Message + " - " + message);
return true;
} // saveWarning

View File

@ -1067,6 +1067,113 @@ public class CPreparedStatement extends CStatement implements PreparedStatement
}
} // remote_executeUpdate
public void setAsciiStream(int parameterIndex, java.io.InputStream x, long length)
throws SQLException
{
}
//vpj-cd add support java 6
public void setBinaryStream(int parameterIndex, java.io.InputStream x,
long length) throws SQLException
{
}
public void setCharacterStream(int parameterIndex,
java.io.Reader reader,
long length) throws SQLException
{
}
public void setAsciiStream(int parameterIndex, java.io.InputStream x)
throws SQLException
{
}
public void setBinaryStream(int parameterIndex, java.io.InputStream x)
throws SQLException
{
}
public void setCharacterStream(int parameterIndex,
java.io.Reader reader) throws SQLException
{
}
public void setNCharacterStream(int parameterIndex, Reader value) throws SQLException
{
}
public void setNCharacterStream(int parameterIndex, Reader value, long length) throws SQLException
{
}
public void setClob(int parameterIndex, Reader reader)
throws SQLException
{
}
public void setClob(int parameterIndex, Reader reader, long length)
throws SQLException
{
}
public void setNClob(int parameterIndex, NClob value) throws SQLException
{
}
public void setNClob(int parameterIndex, Reader reader, long length)
throws SQLException
{
}
public void setNClob(int parameterIndex, Reader reader)
throws SQLException
{
}
public void setBlob(int parameterIndex, InputStream inputStream, long length)
throws SQLException
{
}
public void setBlob(int parameterIndex, InputStream inputStream)
throws SQLException
{
}
public void setSQLXML(int parameterIndex, SQLXML xmlObject) throws SQLException
{
}
public void setNString(int parameterIndex, String value) throws SQLException
{
}
public void setRowId(int parameterIndex, RowId x) throws SQLException{}
} // CPreparedStatement

View File

@ -906,4 +906,14 @@ public class CStatement implements Statement
return rowSet;
} // remote_getRowSet
public boolean isPoolable() throws SQLException{ return false;}
public void setPoolable(boolean a) throws SQLException{};
public boolean isClosed() throws SQLException{ return false;}
public boolean isWrapperFor(java.lang.Class c) throws SQLException{ return false;}
public <T> T unwrap(java.lang.Class<T> iface) throws java.sql.SQLException{return null;}
} // CStatement

View File

@ -47,7 +47,7 @@ public final class DB
/** Connection Cache r/o */
private static Connection[] s_connections = null;
/** Connection Cache Size */
private static int s_conCacheSize = Ini.isClient() ? 1 : 3;
private static int s_conCacheSize = Ini.isClient() ? 3 : 3;
/** Connection counter */
private static int s_conCount = 0;
/** Connection r/w */
@ -510,7 +510,19 @@ public final class DB
*/
public static AdempiereDatabase getDatabase(String URL)
{
return Database.getDatabaseFromURL(URL);
if (URL == null)
{
log.severe("No Database URL");
return null;
}
if (URL.indexOf("oracle") != -1)
return new DB_Oracle();
/*if (URL.indexOf("derby") != -1)
return new DB_Derby();*/
if (URL.indexOf("db2") != -1)
return new DB_DB2();
log.severe("No Database for " + URL);
return null;
} // getDatabase
/**

View File

@ -61,20 +61,6 @@ public final class Env
System.exit (status);
} // close
/**
* Logout from the system
*/
public static void logout()
{
// End Session
MSession session = MSession.get(Env.getCtx(), false); // finish
if (session != null)
session.logout();
//
reset(true); // final cache reset
//
}
/**
* Reset Cache
* @param finalCall everything otherwise login data remains
@ -1279,34 +1265,12 @@ public final class Env
URL url = Adempiere.class.getResource("images/" + fileNameInImageDir);
if (url == null)
{
s_log.log(Level.WARNING, "Not found: " + fileNameInImageDir);
s_log.log(Level.SEVERE, "Not found: " + fileNameInImageDir);
return null;
}
return new ImageIcon(url);
} // getImageIcon
/**
* Get ImageIcon. This method different from getImageIcon
* where the fileName parameter is without extension. The
* method will first try .gif and then .png if .gif does not
* exists.
*
* @param fileName file name in imgaes folder without the extension(e.g. Bean16)
* @return image
*/
public static ImageIcon getImageIcon2 (String fileName)
{
URL url = Adempiere.class.getResource("images/" + fileName+".gif");
if (url == null)
url = Adempiere.class.getResource("images/" + fileName+".png");
if (url == null)
{
s_log.log(Level.WARNING, "GIF/PNG Not found: " + fileName);
return null;
}
return new ImageIcon(url);
} // getImageIcon2
/***************************************************************************
* Start Browser
@ -1382,15 +1346,8 @@ public final class Env
window.setVisible(false);
s_log.info(window.toString());
// window.dispatchEvent(new WindowEvent(window, WindowEvent.WINDOW_ICONIFIED));
if (s_hiddenWindows.size() > 10) {
CFrame toClose = s_hiddenWindows.remove(0); // sort of lru
try {
s_closingWindows = true;
toClose.dispose();
} finally {
s_closingWindows = false;
}
}
if (s_hiddenWindows.size() > 10)
s_hiddenWindows.remove(0); // sort of lru
return true;
}
}
@ -1402,7 +1359,7 @@ public final class Env
* @param AD_Window_ID window
* @return true if window re-displayed
*/
static public CFrame showWindow (int AD_Window_ID)
static public boolean showWindow (int AD_Window_ID)
{
for (int i = 0; i < s_hiddenWindows.size(); i++)
{
@ -1413,10 +1370,10 @@ public final class Env
s_log.info(hidden.toString());
hidden.setVisible(true);
hidden.toFront();
return hidden;
return true;
}
}
return null;
return false;
} // showWindow
/**
@ -1452,46 +1409,6 @@ public final class Env
s_log.info("End");
} // sleep
/**
* Update all windows after look and feel changes.
* @since 2006-11-27
*/
public static Set<Window>updateUI()
{
Set<Window> updated = new HashSet<Window>();
for (Container c : s_windows)
{
Window w = getFrame(c);
if (w == null) continue;
if (updated.contains(w)) continue;
SwingUtilities.updateComponentTreeUI(w);
w.validate();
RepaintManager mgr = RepaintManager.currentManager(w);
Component childs[] = w.getComponents();
for (Component child : childs) {
if (child instanceof JComponent)
mgr.markCompletelyDirty((JComponent)child);
}
w.repaint();
updated.add(w);
}
for (Window w : s_hiddenWindows)
{
if (updated.contains(w)) continue;
SwingUtilities.updateComponentTreeUI(w);
w.validate();
RepaintManager mgr = RepaintManager.currentManager(w);
Component childs[] = w.getComponents();
for (Component child : childs) {
if (child instanceof JComponent)
mgr.markCompletelyDirty((JComponent)child);
}
w.repaint();
updated.add(w);
}
return updated;
}
/**************************************************************************
* Static Variables

View File

@ -143,7 +143,9 @@ public class GenerateModel
// Class
+ "/** Generated Model for ").append(tableName).append("\n"
+ " * @author Jorg Janke (generated) \n"
+ " * @version ").append(Adempiere.MAIN_VERSION).append(" - ").append(s_run).append(" */\n"
+ " * @version ").append(Adempiere.MAIN_VERSION).append(" - $Id$")
// .append(s_run) // Timestamp
.append(" */\n"
+ "public class ").append(className).append(" extends PO"
+ "{"
// Standard Constructor
@ -387,6 +389,7 @@ public class GenerateModel
{
sb.append ("throw new IllegalArgumentException (\"").append(columnName).append(" is virtual column\");");
}
// Integer
else if (clazz.equals(Integer.class))
{
if (columnName.endsWith("_ID"))
@ -409,6 +412,7 @@ public class GenerateModel
}
sb.append(setValue).append(" (\"").append(columnName).append("\", new Integer(").append(columnName).append("));");
}
// Boolean
else if (clazz.equals(Boolean.class))
sb.append(setValue).append(" (\"").append(columnName).append("\", new Boolean(").append(columnName).append("));");
else
@ -562,14 +566,18 @@ public class GenerateModel
else
statement.append(" || ").append(columnName)
.append(".equals(\"").append(value).append("\")");
//
if (!found)
{
found = true;
if (!nullable)
sb.append("if (")
.append (columnName).append (" == null)"
+ " throw new IllegalArgumentException (\"")
.append(columnName).append(" is mandatory\");");
}
// Name (SmallTalkNotation)
String name = rs.getString(2);
char[] nameArray = name.toCharArray();

View File

@ -335,6 +335,7 @@ public class Login
{
pstmt = null;
}
long ms = System.currentTimeMillis () - start;
return retValue;
} // getRoles

View File

@ -306,7 +306,7 @@ public final class Msg
else
{
int start = pos + SEPARATOR.length();
int end = retStr.length();
// int end = retStr.length();
retStr = retStr.substring (start);
}
}