IDEMPIERE-460 Integrate and migrate 3e services. Fixed lookup. Refactoring and cleanup.
This commit is contained in:
parent
eac774fb67
commit
e436719065
|
@ -13,5 +13,10 @@ import org.idempiere.adInterface.x10.CompositeResponsesDocument;
|
|||
@SOAPBinding(style=Style.RPC,use=Use.LITERAL,parameterStyle=ParameterStyle.WRAPPED)
|
||||
public interface CompositeService {
|
||||
|
||||
/**
|
||||
*
|
||||
* @param reqs
|
||||
* @return CompositeResponsesDocument
|
||||
*/
|
||||
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs);
|
||||
}
|
||||
|
|
|
@ -14,7 +14,7 @@
|
|||
package com.trekglobal.ws;
|
||||
|
||||
import java.util.ArrayList;
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import javax.jws.WebService;
|
||||
|
||||
|
@ -26,8 +26,6 @@ import org.idempiere.adInterface.x10.CompositeRequestDocument;
|
|||
import org.idempiere.adInterface.x10.CompositeResponse;
|
||||
import org.idempiere.adInterface.x10.CompositeResponses;
|
||||
import org.idempiere.adInterface.x10.CompositeResponsesDocument;
|
||||
import org.idempiere.adInterface.x10.DataField;
|
||||
import org.idempiere.adInterface.x10.ModelCRUD;
|
||||
import org.idempiere.adInterface.x10.ModelCRUDRequest;
|
||||
import org.idempiere.adInterface.x10.ModelCRUDRequestDocument;
|
||||
import org.idempiere.adInterface.x10.ModelRunProcessRequest;
|
||||
|
@ -41,7 +39,6 @@ import org.idempiere.adInterface.x10.RunProcessResponseDocument;
|
|||
import org.idempiere.adInterface.x10.StandardResponse;
|
||||
import org.idempiere.adInterface.x10.StandardResponseDocument;
|
||||
import org.idempiere.adInterface.x10.WindowTabDataDocument;
|
||||
import org.idempiere.adinterface.CompiereService;
|
||||
import org.idempiere.adinterface.ModelADServiceImpl;
|
||||
import org.idempiere.webservices.AbstractService;
|
||||
|
||||
|
@ -59,14 +56,20 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
|||
private static String webServiceName = new String("CompositeInterface");
|
||||
|
||||
public CompositeServiceImpl() {
|
||||
|
||||
log.info("Creating session object BiziInterface");
|
||||
if (log.isLoggable(Level.INFO))
|
||||
log.info("Creating session object compositeInterface");
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* @see CompositeService#compositeOperation(CompositeRequestDocument)
|
||||
*/
|
||||
@Override
|
||||
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
CompiereService m_cs = getCompiereService();
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
CompositeResponsesDocument ret = CompositeResponsesDocument.Factory.newInstance();
|
||||
CompositeResponses resps = ret.addNewCompositeResponses();
|
||||
|
@ -86,11 +89,11 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
|||
|
||||
ModelADServiceImpl modelADService = new ModelADServiceImpl(ctx);
|
||||
|
||||
String trxName = m_cs.getM_trx_name();
|
||||
trxName = Trx.createTrxName("ws_biziInterface");
|
||||
String trxName = Trx.createTrxName(webServiceName);
|
||||
|
||||
Trx trx = Trx.get(trxName, true);
|
||||
|
||||
try {
|
||||
modelADService.setLocalTrxName(trxName);
|
||||
|
||||
Operations operationsArr[] = req.getOperationsArray();
|
||||
|
@ -109,10 +112,15 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
|||
|
||||
}
|
||||
}
|
||||
|
||||
} finally {
|
||||
trx.close();
|
||||
}
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -260,6 +268,12 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
|||
return wrapperDoc;
|
||||
}
|
||||
|
||||
/**
|
||||
*
|
||||
* @param ctx
|
||||
* @param crud
|
||||
*/
|
||||
/*
|
||||
public void resolveContextCRUD(Properties ctx, ModelCRUD crud) {
|
||||
DataField fields[] = crud.getDataRow().getFieldArray();
|
||||
for (DataField field : fields) {
|
||||
|
@ -271,7 +285,7 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
|||
field.setVal(val);
|
||||
}
|
||||
}
|
||||
}
|
||||
}*/
|
||||
|
||||
/**
|
||||
* Rollback and set error on response
|
||||
|
|
|
@ -1,44 +0,0 @@
|
|||
/**
|
||||
* reportServer for JasperReport.
|
||||
* Copyright (C) 2004 Peter Shen.
|
||||
* Shanghai, China.
|
||||
* Email: zpshen@gmail.com
|
||||
*
|
||||
* This library is free software; you can redistribute it and/or
|
||||
* modify it under the terms of the GNU Lesser General Public
|
||||
* License as published by the Free Software Foundation; either
|
||||
* version 2.1 of the License, or (at your option) any later version.
|
||||
*
|
||||
* This library 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
|
||||
* Lesser General Public License for more details.
|
||||
*
|
||||
* You should have received a copy of the GNU Lesser General Public
|
||||
* License along with this library; if not, write to the Free Software
|
||||
* Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
|
||||
*
|
||||
* Contributor: Marco LOMBARDO, Compilo subAdministrator.
|
||||
* lombardo@mayking.com, mar9000@gmail.com
|
||||
* Italy.
|
||||
**/
|
||||
package net.sf.compilo.data;
|
||||
|
||||
/**
|
||||
* @author Peter Shen
|
||||
* @version $Id: sqlProcessor.java,v 1.1 2005/07/15 10:29:40 pshen Exp $
|
||||
*
|
||||
* TODO To change the template for this generated type comment go to
|
||||
* Window - Preferences - Java - Code Generation - Code and Comments
|
||||
*/
|
||||
public class sqlProcessor
|
||||
{
|
||||
/**
|
||||
*
|
||||
*/
|
||||
public sqlProcessor()
|
||||
{
|
||||
super();
|
||||
// TODO Auto-generated constructor stub
|
||||
}
|
||||
}
|
|
@ -150,10 +150,6 @@ public class ReportInfo
|
|||
JasperReport res = null;
|
||||
try
|
||||
{
|
||||
String compiere_home = (String)System.getProperty("COMPIERE_HOME");
|
||||
// compiere_home = "C:/compiere/acompiere2/";
|
||||
//log.info( "compiere_home = "+compiere_home);
|
||||
System.setProperty("jasper.reports.compile.class.path", compiere_home+"/lib/reporttools.jar;"+compiere_home+"/lib/Compiere.jar");
|
||||
JasperCompileManager.compileReportToFile( reportFile.getAbsolutePath(), jasperFile.getAbsolutePath());
|
||||
jasperFile.setLastModified( reportFile.lastModified());
|
||||
res = (JasperReport)JRLoader.loadObjectFromFile(jasperFile.getAbsolutePath());
|
||||
|
@ -235,49 +231,6 @@ public class ReportInfo
|
|||
}
|
||||
log.info("Get ReportDefinition-" + this.toString());
|
||||
}
|
||||
/*
|
||||
private void getResource()
|
||||
{
|
||||
// Resources
|
||||
File[] resources =
|
||||
reportInfo.getReportFile().getParentFile().listFiles(
|
||||
new FileFilter( jasperName, reportInfo.getReportFile().getParentFile(), ".properties"));
|
||||
File resFile = null;
|
||||
// try baseName + "_" + language
|
||||
for( int i=0; i<resources.length; i++)
|
||||
{
|
||||
if ( resources[i].getName().equals( jasperName+currLang.getLocale().getLanguage()+".properties"))
|
||||
{
|
||||
resFile=resources[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
if (resFile==null)
|
||||
{
|
||||
// try baseName only
|
||||
for( int i=0; i<resources.length; i++)
|
||||
{
|
||||
if ( resources[i].getName().equals( jasperName+".properties"))
|
||||
{
|
||||
resFile=resources[i];
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
if (resFile!=null)
|
||||
{
|
||||
try
|
||||
{
|
||||
PropertyResourceBundle res = new PropertyResourceBundle( new FileInputStream(resFile));
|
||||
m_Param.put("RESOURCE", res);
|
||||
}
|
||||
catch (IOException e)
|
||||
{}
|
||||
}
|
||||
}
|
||||
*/
|
||||
|
||||
|
||||
|
||||
protected boolean isDirty()
|
||||
{
|
||||
|
|
|
@ -41,6 +41,7 @@ import org.compiere.process.ProcessInfo;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.Ini;
|
||||
import org.compiere.util.Language;
|
||||
|
||||
/**
|
||||
|
@ -52,17 +53,12 @@ import org.compiere.util.Language;
|
|||
*/
|
||||
public class ReportProcessor
|
||||
{
|
||||
public static final String REPORT_PATH__fix = "c:/compiere/compiere-all/reports";
|
||||
|
||||
public static File REPORT_HOME = null;
|
||||
private static CLogger log = CLogger.getCLogger(ReportProcessor.class);
|
||||
|
||||
static
|
||||
{
|
||||
String reportPath = REPORT_PATH__fix;// "c:/compiere/compiere-all/reports";//System.getProperty("REPORT_HOME");
|
||||
if (reportPath == null || reportPath.length() == 0)
|
||||
reportPath = System.getProperty("COMPIERE_HOME")+ System.getProperty("file.separator")+ "reports";
|
||||
//System.setProperty("jasper.reports.compiler.class", "net.sf.jasperreports.engine.design.JRCompiler");
|
||||
String reportPath = Ini.getAdempiereHome();
|
||||
String classpath = Thread.currentThread().getContextClassLoader().getResource("net/sf/jasperreports/engine").toString();
|
||||
System.setProperty("jasper.reports.compile.temp", reportPath);
|
||||
System.setProperty("jasper.reports.compile.class.path", classpath.split("file:/")[1].split("!")[0]);
|
||||
|
@ -101,7 +97,7 @@ public class ReportProcessor
|
|||
addProcessParameters( m_AD_PInstance_ID, m_Param);
|
||||
m_Param.put("RECORD_ID", new Integer( m_Record_ID));
|
||||
// Marco LOMBARDO: REPORT_HOME used to express subreports path.
|
||||
m_Param.put("REPORT_HOME", REPORT_PATH__fix ); //System.getProperty("REPORT_HOME"));
|
||||
m_Param.put("REPORT_HOME", REPORT_HOME);
|
||||
// End Marco LOMBARDO.
|
||||
Language currLang = Env.getLanguage(Env.getCtx());
|
||||
m_Param.put("CURRENT_LANG", currLang.getAD_Language());
|
||||
|
@ -109,17 +105,13 @@ public class ReportProcessor
|
|||
java.sql.Connection conn = DB.getConnectionRO();
|
||||
m_Param.put("REPORT_CONNECTION", conn ); //DB_CONN
|
||||
m_Param.put("DB_CONN", conn );
|
||||
System.out.println( "REPORT_CONNECTION = "+conn.toString() );
|
||||
log.saveError("REPORT_CONNECTION = "+conn.toString(), "");
|
||||
//System.out.println( "REPORT_HOME = "+System.getProperty("REPORT_HOME") );
|
||||
|
||||
// fill report
|
||||
compiereDataSource ds = null;
|
||||
try
|
||||
{
|
||||
compiereDataSource ds = CompiereDataSourceFactory.createDataSource(m_ctx, reportInfo, m_pi, m_Param);
|
||||
//compiereDataSource ds = new compiereDataSource (m_ctx, reportInfo.getJasperReport());
|
||||
ds = CompiereDataSourceFactory.createDataSource(m_ctx, reportInfo, m_pi, m_Param);
|
||||
m_jasperPrint = JasperFillManager.fillReport( reportInfo.getJasperReport(), m_Param, ds);
|
||||
ds.close();
|
||||
|
||||
log.finest("ReportProcessor.fillReport");
|
||||
}
|
||||
|
@ -132,6 +124,11 @@ public class ReportProcessor
|
|||
{
|
||||
e.printStackTrace();
|
||||
}
|
||||
finally
|
||||
{
|
||||
if (ds != null)
|
||||
ds.close();
|
||||
}
|
||||
}
|
||||
else
|
||||
System.out.println("Error:" + reportInfo.getErrorMsg());
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/******************************************************************************
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.adinterface;
|
||||
|
||||
import org.compiere.model.Lookup;
|
||||
|
@ -18,7 +29,13 @@ public class ADLookup {
|
|||
|
||||
protected static CLogger log = CLogger.getCLogger(ADLookup.class);
|
||||
|
||||
|
||||
/**
|
||||
* @param lvs
|
||||
* @param lookup
|
||||
* @param isMandatory
|
||||
* @param isReadOnly
|
||||
* @param isShortList
|
||||
*/
|
||||
public static void fillLookupValues( LookupValues lvs, Lookup lookup, boolean isMandatory, boolean isReadOnly, boolean isShortList) // IDEMPIERE 90
|
||||
{
|
||||
|
||||
|
|
|
@ -1,3 +1,14 @@
|
|||
/******************************************************************************
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.adinterface;
|
||||
|
||||
import java.sql.PreparedStatement;
|
||||
|
@ -18,6 +29,11 @@ import org.compiere.util.KeyNamePair;
|
|||
import org.compiere.util.Language;
|
||||
import org.compiere.util.Login;
|
||||
|
||||
/**
|
||||
* @author deepak
|
||||
* @author hengsin
|
||||
*
|
||||
*/
|
||||
public class CompiereService {
|
||||
|
||||
private static CLogger log = CLogger.getCLogger(CompiereService.class);
|
||||
|
@ -25,17 +41,16 @@ public class CompiereService {
|
|||
public final static String datePattern = "dd-MM-yyyy";
|
||||
|
||||
private Properties m_ctx;
|
||||
private String m_trx_name;
|
||||
|
||||
private int m_AD_Client_ID;
|
||||
private int m_AD_Org_ID;
|
||||
private int m_AD_User_ID;
|
||||
private int m_AD_Role_ID;
|
||||
private int m_AD_Warehouse_ID;
|
||||
private String m_Lang;
|
||||
private String m_User;
|
||||
private int m_M_Warehouse_ID;
|
||||
private String m_locale;
|
||||
private String m_userName;
|
||||
|
||||
private boolean LoggedIn = false;
|
||||
private boolean m_loggedin = false;
|
||||
|
||||
|
||||
/** Localized Date format */
|
||||
|
@ -66,57 +81,60 @@ public class CompiereService {
|
|||
/** Localized Quantity format */
|
||||
public DecimalFormat modelQuantityFormat = null;
|
||||
|
||||
private Language m_lang;
|
||||
private Language m_language;
|
||||
|
||||
public final String dateFormatOnlyForCtx = "yyyy-MM-dd";
|
||||
|
||||
public int getM_AD_Client_ID() {
|
||||
private boolean m_connected;
|
||||
|
||||
/**
|
||||
*
|
||||
* @return AD_Client_ID of current request
|
||||
*/
|
||||
public int getAD_Client_ID() {
|
||||
return m_AD_Client_ID;
|
||||
}
|
||||
|
||||
public void setM_AD_Client_ID(int client_ID) {
|
||||
m_AD_Client_ID = client_ID;
|
||||
}
|
||||
|
||||
public int getM_AD_Org_ID() {
|
||||
/**
|
||||
*
|
||||
* @return AD_Org_ID of current request
|
||||
*/
|
||||
public int getAD_Org_ID() {
|
||||
return m_AD_Org_ID;
|
||||
}
|
||||
|
||||
public void setM_AD_Org_ID(int org_ID) {
|
||||
m_AD_Org_ID = org_ID;
|
||||
}
|
||||
|
||||
public Properties getM_ctx() {
|
||||
/**
|
||||
*
|
||||
* @return context of current request
|
||||
*/
|
||||
public Properties getCtx() {
|
||||
return m_ctx;
|
||||
}
|
||||
|
||||
public void setM_ctx(Properties m_ctx) {
|
||||
this.m_ctx = m_ctx;
|
||||
}
|
||||
|
||||
public String getM_trx_name() {
|
||||
return m_trx_name;
|
||||
}
|
||||
|
||||
public void setM_trx_name(String m_trx_name) {
|
||||
this.m_trx_name = m_trx_name;
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* default constructor
|
||||
*/
|
||||
public CompiereService()
|
||||
{
|
||||
m_trx_name= null; //Trx.createTrxName();
|
||||
m_ctx = new Properties();
|
||||
LoggedIn = false;
|
||||
m_loggedin = false;
|
||||
m_connected = false;
|
||||
}
|
||||
|
||||
/**
|
||||
* setup request
|
||||
*/
|
||||
public void connect()
|
||||
{
|
||||
if (!m_connected)
|
||||
{
|
||||
CompiereUtil.initWeb();
|
||||
|
||||
m_ctx = new Properties();
|
||||
m_connected = true;
|
||||
|
||||
ServerContext.setCurrentInstance(m_ctx);
|
||||
Env.setContext( m_ctx, "#AD_Language", "en_US" );
|
||||
m_lang = Language.getLanguage("en_US");
|
||||
m_language = Language.getLanguage("en_US");
|
||||
|
||||
// These variables are needed for ADClient.exe
|
||||
Language m_lang2 = Language.getLanguage("pl_PL");
|
||||
|
@ -129,20 +147,43 @@ public class CompiereService {
|
|||
integerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_lang2);
|
||||
numberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_lang2);
|
||||
quantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, m_lang2);
|
||||
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
public Language getM_lang() {
|
||||
return m_lang;
|
||||
/**
|
||||
* cleanup request
|
||||
*/
|
||||
public void disconnect()
|
||||
{
|
||||
if (m_connected)
|
||||
{
|
||||
ServerContext.dispose();
|
||||
m_ctx = null;
|
||||
m_loggedin = false;
|
||||
m_connected = false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setM_lang(Language m_lang) {
|
||||
this.m_lang = m_lang;
|
||||
/**
|
||||
* @return true if started
|
||||
*/
|
||||
public boolean isConnected()
|
||||
{
|
||||
return m_connected;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return Language of current request
|
||||
*/
|
||||
public Language getLanguage() {
|
||||
return m_language;
|
||||
}
|
||||
|
||||
/**
|
||||
* @return true if already logged in
|
||||
*/
|
||||
public boolean isLoggedIn() {
|
||||
return LoggedIn;
|
||||
return m_loggedin;
|
||||
}
|
||||
|
||||
/**
|
||||
|
@ -170,14 +211,16 @@ public class CompiereService {
|
|||
+ " AND (o.AD_Client_ID = 0 OR o.AD_Client_ID=c.AD_Client_ID)"
|
||||
+ " AND c.AD_Client_ID IN (SELECT AD_Client_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)"
|
||||
+ " AND o.AD_Org_ID IN (SELECT AD_Org_ID FROM AD_Role_OrgAccess ca WHERE ca.AD_Role_ID=ur.AD_Role_ID)";
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, AD_User_ID);
|
||||
pstmt.setInt(2, AD_Client_ID);
|
||||
pstmt.setInt(3, AD_Org_ID);
|
||||
pstmt.setInt(4, AD_Role_ID);
|
||||
ResultSet rs = pstmt.executeQuery();
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
loginInfo = rs.getString(1);
|
||||
rs.close();
|
||||
|
@ -185,7 +228,9 @@ public class CompiereService {
|
|||
}
|
||||
catch (SQLException e)
|
||||
{
|
||||
// log.log(Level.SEVERE, "checkLogin", e);
|
||||
e.printStackTrace();
|
||||
} finally {
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
// not verified
|
||||
|
@ -202,16 +247,23 @@ public class CompiereService {
|
|||
String printer = null;
|
||||
Login login = new Login(ctx);
|
||||
login.loadPreferences(org, wh, date, printer);
|
||||
// Don't Show Acct/Trl Tabs on HTML UI
|
||||
Env.setContext(ctx, "#ShowAcct", "N");
|
||||
Env.setContext(ctx, "#ShowTrl", "N");
|
||||
//
|
||||
return loginInfo;
|
||||
} // checkLogin
|
||||
|
||||
public boolean login( int AD_User_ID, int AD_Role_ID, int AD_Client_ID, int AD_Org_ID, int AD_Warehouse_ID, String Lang ) {
|
||||
LoggedIn = false;
|
||||
String loginInfo = checkLogin (getM_ctx(), AD_User_ID, AD_Role_ID, AD_Client_ID, AD_Org_ID, AD_Warehouse_ID );
|
||||
/**
|
||||
*
|
||||
* @param AD_User_ID
|
||||
* @param AD_Role_ID
|
||||
* @param AD_Client_ID
|
||||
* @param AD_Org_ID
|
||||
* @param M_Warehouse_ID
|
||||
* @param Lang
|
||||
* @return true if login is successful
|
||||
*/
|
||||
public boolean login( int AD_User_ID, int AD_Role_ID, int AD_Client_ID, int AD_Org_ID, int M_Warehouse_ID, String Lang ) {
|
||||
m_loggedin = false;
|
||||
String loginInfo = checkLogin (getCtx(), AD_User_ID, AD_Role_ID, AD_Client_ID, AD_Org_ID, M_Warehouse_ID );
|
||||
if (loginInfo == null)
|
||||
return false;
|
||||
|
||||
|
@ -219,75 +271,74 @@ public class CompiereService {
|
|||
m_AD_Org_ID = AD_Org_ID;
|
||||
m_AD_User_ID = AD_User_ID;
|
||||
m_AD_Role_ID = AD_Role_ID;
|
||||
m_AD_Warehouse_ID = AD_Warehouse_ID;
|
||||
m_Lang = Lang;
|
||||
m_User = MUser.getNameOfUser(m_AD_User_ID);
|
||||
m_M_Warehouse_ID = M_Warehouse_ID;
|
||||
m_locale = Lang;
|
||||
m_userName = MUser.getNameOfUser(m_AD_User_ID);
|
||||
|
||||
Env.setContext( m_ctx, "#AD_Language", Lang);
|
||||
m_lang = Language.getLanguage(Lang);
|
||||
Env.verifyLanguage( getM_ctx(), m_lang );
|
||||
m_language = Language.getLanguage(Lang);
|
||||
Env.verifyLanguage( getCtx(), m_language );
|
||||
|
||||
modelDateFormat = new SimpleDateFormat( datePattern );
|
||||
modelDateTimeFormat = new SimpleDateFormat( datePattern );
|
||||
|
||||
modelAmountFormat = DisplayType.getNumberFormat(DisplayType.Amount, m_lang);
|
||||
modelIntegerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_lang);
|
||||
modelNumberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_lang);
|
||||
modelQuantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, m_lang);
|
||||
modelAmountFormat = DisplayType.getNumberFormat(DisplayType.Amount, m_language);
|
||||
modelIntegerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_language);
|
||||
modelNumberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_language);
|
||||
modelQuantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, m_language);
|
||||
|
||||
// Set Date
|
||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||
|
||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat( dateFormatOnlyForCtx );
|
||||
Env.setContext( getM_ctx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||
log.info(" #Date = "+ Env.getContextAsDate( getM_ctx(), "#Date"));
|
||||
Env.setContext( getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||
log.info(" #Date = "+ Env.getContextAsDate( getCtx(), "#Date"));
|
||||
|
||||
Env.setContext( getM_ctx(), "#M_Warehouse_ID", AD_Warehouse_ID );
|
||||
Env.setContext(m_ctx, Env.LANGUAGE, m_lang.getAD_Language());
|
||||
//Env.setContext( getM_ctx(), "#AD_Language", Lang );
|
||||
Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID );
|
||||
Env.setContext(m_ctx, Env.LANGUAGE, m_language.getAD_Language());
|
||||
|
||||
LoggedIn = true;
|
||||
m_loggedin = true;
|
||||
return true;
|
||||
}
|
||||
|
||||
public void setM_AD_User_ID(int m_AD_User_ID) {
|
||||
this.m_AD_User_ID = m_AD_User_ID;
|
||||
}
|
||||
|
||||
public int getM_AD_User_ID() {
|
||||
/**
|
||||
*
|
||||
* @return AD_User_ID of current request
|
||||
*/
|
||||
public int getAD_User_ID() {
|
||||
return m_AD_User_ID;
|
||||
}
|
||||
|
||||
public void setM_AD_Role_ID(int m_AD_Role_ID) {
|
||||
this.m_AD_Role_ID = m_AD_Role_ID;
|
||||
}
|
||||
|
||||
public int getM_AD_Role_ID() {
|
||||
/**
|
||||
*
|
||||
* @return AD_Role_ID of current request
|
||||
*/
|
||||
public int getAD_Role_ID() {
|
||||
return m_AD_Role_ID;
|
||||
}
|
||||
|
||||
public void setM_Lang(String m_Lang) {
|
||||
this.m_Lang = m_Lang;
|
||||
/**
|
||||
*
|
||||
* @return locale code of current request
|
||||
*/
|
||||
public String getLocale() {
|
||||
return m_locale;
|
||||
}
|
||||
|
||||
public String getM_Lang() {
|
||||
return m_Lang;
|
||||
/**
|
||||
*
|
||||
* @return M_Warehouse_ID of current request
|
||||
*/
|
||||
public int getM_Warehouse_ID() {
|
||||
return m_M_Warehouse_ID;
|
||||
}
|
||||
|
||||
public void setM_AD_Warehouse_ID(int m_AD_Warehouse_ID) {
|
||||
this.m_AD_Warehouse_ID = m_AD_Warehouse_ID;
|
||||
}
|
||||
|
||||
public int getM_AD_Warehouse_ID() {
|
||||
return m_AD_Warehouse_ID;
|
||||
}
|
||||
|
||||
public void setUser(String m_User) {
|
||||
this.m_User = m_User;
|
||||
}
|
||||
|
||||
public String getUser() {
|
||||
return m_User;
|
||||
/**
|
||||
*
|
||||
* @return logged in user name of current request
|
||||
*/
|
||||
public String getUserName() {
|
||||
return m_userName;
|
||||
}
|
||||
|
||||
}
|
||||
|
|
|
@ -1,12 +1,20 @@
|
|||
/******************************************************************************
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.adinterface;
|
||||
|
||||
|
||||
import java.util.Properties;
|
||||
import java.util.logging.Level;
|
||||
|
||||
import org.compiere.Adempiere;
|
||||
import org.compiere.model.MClient;
|
||||
import org.compiere.model.MSystem;
|
||||
import org.compiere.util.CLogger;
|
||||
|
||||
|
||||
|
@ -15,7 +23,9 @@ public class CompiereUtil {
|
|||
private static CLogger log = CLogger.getCLogger(CompiereUtil.class);
|
||||
private static boolean s_initOK = false;
|
||||
|
||||
|
||||
/**
|
||||
* @return startup idempiere environment if needed
|
||||
*/
|
||||
public static boolean initWeb()
|
||||
{
|
||||
if (s_initOK)
|
||||
|
@ -23,16 +33,8 @@ public class CompiereUtil {
|
|||
return true;
|
||||
}
|
||||
|
||||
// TODO:
|
||||
// Load Environment Variables (serverApps/src/web/WEB-INF/web.xml)
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
//CLogMgt.setLevel(Level.OFF);
|
||||
|
||||
/* ADEMPIERE/COMPIERE */
|
||||
//s_initOK = Compiere.startup(false);
|
||||
s_initOK = Adempiere.startup(false);
|
||||
}
|
||||
catch (Exception ex)
|
||||
|
@ -42,16 +44,6 @@ public class CompiereUtil {
|
|||
if (!s_initOK)
|
||||
return false;
|
||||
|
||||
// Logging now initiated
|
||||
|
||||
//
|
||||
Properties ctx = new Properties();
|
||||
@SuppressWarnings("unused")
|
||||
MClient client = MClient.get(ctx, 0);
|
||||
@SuppressWarnings("unused")
|
||||
MSystem system = MSystem.get(ctx);
|
||||
|
||||
|
||||
return s_initOK;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -45,6 +45,7 @@ import javax.xml.ws.WebServiceContext;
|
|||
import org.apache.xmlbeans.StringEnumAbstractBase.Table;
|
||||
import org.compiere.model.Lookup;
|
||||
import org.compiere.model.MColumn;
|
||||
import org.compiere.model.MLookup;
|
||||
import org.compiere.model.MRefTable;
|
||||
import org.compiere.model.MRole;
|
||||
import org.compiere.model.MTable;
|
||||
|
@ -57,9 +58,7 @@ import org.compiere.model.X_WS_WebService_Para;
|
|||
import org.compiere.util.CLogger;
|
||||
import org.compiere.util.DB;
|
||||
import org.compiere.util.Env;
|
||||
import org.compiere.util.KeyNamePair;
|
||||
import org.compiere.util.Trx;
|
||||
import org.compiere.util.ValueNamePair;
|
||||
import org.idempiere.adInterface.x10.ADLoginRequest;
|
||||
import org.idempiere.adInterface.x10.DataField;
|
||||
import org.idempiere.adInterface.x10.DataRow;
|
||||
|
@ -161,6 +160,11 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
* use the runProcess web service
|
||||
*/
|
||||
public StandardResponseDocument setDocAction(ModelSetDocActionRequestDocument req) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||
StandardResponse resp = ret.addNewStandardResponse();
|
||||
|
@ -190,7 +194,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
return ret;
|
||||
}
|
||||
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
|
||||
// start a trx
|
||||
String trxName = localTrxName;
|
||||
|
@ -285,6 +289,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private String validateParameter(String parameterName, String string) {
|
||||
|
@ -348,6 +356,12 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
|
||||
|
||||
public RunProcessResponseDocument runProcess(ModelRunProcessRequestDocument req) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
RunProcessResponseDocument resbadlogin = RunProcessResponseDocument.Factory.newInstance();
|
||||
RunProcessResponse rbadlogin = resbadlogin.addNewRunProcessResponse();
|
||||
ModelRunProcess modelRunProcess = req.getModelRunProcessRequest().getModelRunProcess();
|
||||
|
@ -376,9 +390,19 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
reqprocess.setADRecordID(modelRunProcess.getADRecordID());
|
||||
reqprocess.setDocAction(modelRunProcess.getDocAction());
|
||||
return Process.runProcess(getCompiereService(), docprocess);
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public WindowTabDataDocument getList(ModelGetListRequestDocument req) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
WindowTabDataDocument resdoc = WindowTabDataDocument.Factory.newInstance();
|
||||
WindowTabData res = resdoc.addNewWindowTabData();
|
||||
DataSet ds = res.addNewDataSet();
|
||||
|
@ -410,7 +434,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
|
||||
CompiereService m_cs = getCompiereService();
|
||||
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
|
||||
X_AD_Reference ref = new X_AD_Reference(ctx, ref_id, null);
|
||||
|
||||
|
@ -585,9 +609,19 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
res.setStartRow(1);
|
||||
|
||||
return resdoc;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
} // getList
|
||||
|
||||
public StandardResponseDocument deleteData(ModelCRUDRequestDocument req) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||
StandardResponse resp = ret.addNewStandardResponse();
|
||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||
|
@ -615,7 +649,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
resp.setRecordID(recordID);
|
||||
|
||||
CompiereService m_cs = getCompiereService();
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
|
||||
// start a trx
|
||||
String trxName = localTrxName;
|
||||
|
@ -648,6 +682,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
trx.close();
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
private void validateCRUD(ModelCRUD modelCRUD) {
|
||||
|
@ -659,6 +697,12 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
|
||||
public StandardResponseDocument createData(ModelCRUDRequestDocument req){
|
||||
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||
StandardResponse resp = ret.addNewStandardResponse();
|
||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||
|
@ -684,7 +728,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
String tableName = modelCRUD.getTableName();
|
||||
|
||||
CompiereService m_cs= getCompiereService();
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
|
||||
// start a trx
|
||||
String trxName = localTrxName;
|
||||
|
@ -755,9 +799,20 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
setOuputFields(resp, m_webservicetype,po,poinfo);
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
|
||||
}
|
||||
} // createData
|
||||
|
||||
public StandardResponseDocument createUpdateData(ModelCRUDRequestDocument req) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||
StandardResponse resp = ret.addNewStandardResponse();
|
||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||
|
@ -783,7 +838,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
String tableName = modelCRUD.getTableName();
|
||||
|
||||
CompiereService m_cs = getCompiereService();
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
|
||||
// start a trx
|
||||
String trxName = localTrxName;
|
||||
|
@ -948,6 +1003,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
setOuputFields(resp, m_webservicetype, po, poinfo);
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
} // createUpdateData
|
||||
|
||||
private void setValueAccordingToClass(PO po, POInfo poinfo, DataField field, int idxcol) {
|
||||
|
@ -964,25 +1023,11 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
throw new IdempiereServiceFault(field.getColumn() + " is not lookup column. Pass Value in val element ", new QName(
|
||||
"LookupResolutionFailed"));
|
||||
}
|
||||
if (lookup.getSize() == 0)
|
||||
lookup.refresh();
|
||||
Object[] list = lookup.getData(true, true, true, false,false).toArray(); // IDEMPIERE 90
|
||||
|
||||
for (Object pair : list) {
|
||||
if (pair instanceof KeyNamePair) {
|
||||
KeyNamePair p = (KeyNamePair) pair;
|
||||
if (p.getName().equals(lookupValue)) {
|
||||
value = p.getID();
|
||||
break;
|
||||
}
|
||||
} else {
|
||||
ValueNamePair p = (ValueNamePair) pair;
|
||||
if (p.getName().equals(lookupValue)) {
|
||||
value = p.getValue();
|
||||
break;
|
||||
}
|
||||
}
|
||||
}
|
||||
String sql = getDirectAccessSQL(lookup, lookupValue.toUpperCase());
|
||||
int id = DB.getSQLValue(localTrxName, sql);
|
||||
if (id > 0)
|
||||
value = id;
|
||||
|
||||
if (value == null) {
|
||||
throw new IdempiereServiceFault(" Invalid Lookup value:" + lookupValue, new QName("LookupResolutionFailed"));
|
||||
|
@ -996,7 +1041,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
String varName = strValue.substring(1);
|
||||
if (varName.charAt(0) == '#') {
|
||||
varName = varName.substring(1);
|
||||
strValue = m_cs.getM_ctx().getProperty(varName);
|
||||
strValue = m_cs.getCtx().getProperty(varName);
|
||||
} else {
|
||||
int indDot = varName.indexOf(".");
|
||||
if (indDot == -1) {
|
||||
|
@ -1085,6 +1130,12 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
}
|
||||
|
||||
public StandardResponseDocument updateData(ModelCRUDRequestDocument req){
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||
StandardResponse resp = ret.addNewStandardResponse();
|
||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||
|
@ -1113,7 +1164,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
|
||||
CompiereService m_cs = getCompiereService();
|
||||
MWebServiceType m_webservicetype= getWebServiceType();
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
|
||||
// start a trx
|
||||
String trxName = localTrxName;
|
||||
|
@ -1162,9 +1213,19 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
setOuputFields(resp, m_webservicetype, po, poinfo);
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
} // updateData
|
||||
|
||||
public WindowTabDataDocument readData(ModelCRUDRequestDocument req) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
|
||||
WindowTabData resp = ret.addNewWindowTabData();
|
||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||
|
@ -1193,7 +1254,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
String trxName = localTrxName;
|
||||
|
||||
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
String tableName = modelCRUD.getTableName();
|
||||
|
||||
String recordIDVar = modelCRUD.getRecordIDVariable();
|
||||
|
@ -1249,9 +1310,19 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
resp.setStartRow(1);
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
public WindowTabDataDocument queryData(ModelCRUDRequestDocument req) {
|
||||
boolean connected = getCompiereService().isConnected();
|
||||
|
||||
try {
|
||||
if (!connected)
|
||||
getCompiereService().connect();
|
||||
|
||||
CompiereService m_cs = getCompiereService();
|
||||
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
|
||||
WindowTabData resp = ret.addNewWindowTabData();
|
||||
|
@ -1268,7 +1339,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
// Validate parameters vs service type
|
||||
validateCRUD(modelCRUD);
|
||||
|
||||
Properties ctx = m_cs.getM_ctx();
|
||||
Properties ctx = m_cs.getCtx();
|
||||
String tableName = modelCRUD.getTableName();
|
||||
|
||||
MWebServiceType m_webservicetype = getWebServiceType();
|
||||
|
@ -1351,6 +1422,276 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
|||
resp.setStartRow(1);
|
||||
|
||||
return ret;
|
||||
} finally {
|
||||
if (!connected)
|
||||
getCompiereService().disconnect();
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Generate Access SQL for Search.
|
||||
* The SQL returns the ID of the value entered
|
||||
* Also sets m_tableName and m_keyColumnName
|
||||
* @param text uppercase text for LIKE comparison
|
||||
* @return sql or ""
|
||||
* Example
|
||||
* SELECT C_Payment_ID FROM C_Payment WHERE UPPER(DocumentNo) LIKE x OR ...
|
||||
*/
|
||||
private String getDirectAccessSQL (Lookup lookup, String text)
|
||||
{
|
||||
String m_columnName = lookup.getColumnName();
|
||||
|
||||
String m_tableName = null;
|
||||
String m_keyColumnName = null;
|
||||
StringBuffer sql = new StringBuffer();
|
||||
if (m_columnName.indexOf(".") > 0) {
|
||||
m_tableName = m_columnName.substring(0, m_columnName.indexOf("."));
|
||||
m_keyColumnName = m_columnName.substring(m_columnName.indexOf(".")+1);
|
||||
} else {
|
||||
m_tableName = m_columnName.substring(0, m_columnName.length()-3);
|
||||
m_keyColumnName = m_columnName;
|
||||
}
|
||||
|
||||
if (m_columnName.equals("M_Product_ID"))
|
||||
{
|
||||
sql.append("SELECT M_Product_ID FROM M_Product WHERE (UPPER(Value) LIKE ")
|
||||
.append(DB.TO_STRING(text))
|
||||
.append(" OR UPPER(Name) LIKE ").append(DB.TO_STRING(text))
|
||||
.append(" OR UPC LIKE ").append(DB.TO_STRING(text)).append(")");
|
||||
}
|
||||
else if (m_columnName.equals("C_BPartner_ID"))
|
||||
{
|
||||
sql.append("SELECT C_BPartner_ID FROM C_BPartner WHERE (UPPER(Value) LIKE ")
|
||||
.append(DB.TO_STRING(text))
|
||||
.append(" OR UPPER(Name) LIKE ").append(DB.TO_STRING(text)).append(")");
|
||||
}
|
||||
else if (m_columnName.equals("C_Order_ID"))
|
||||
{
|
||||
sql.append("SELECT C_Order_ID FROM C_Order WHERE UPPER(DocumentNo) LIKE ")
|
||||
.append(DB.TO_STRING(text));
|
||||
}
|
||||
else if (m_columnName.equals("C_Invoice_ID"))
|
||||
{
|
||||
sql.append("SELECT C_Invoice_ID FROM C_Invoice WHERE UPPER(DocumentNo) LIKE ")
|
||||
.append(DB.TO_STRING(text));
|
||||
}
|
||||
else if (m_columnName.equals("M_InOut_ID"))
|
||||
{
|
||||
sql.append("SELECT M_InOut_ID FROM M_InOut WHERE UPPER(DocumentNo) LIKE ")
|
||||
.append(DB.TO_STRING(text));
|
||||
}
|
||||
else if (m_columnName.equals("C_Payment_ID"))
|
||||
{
|
||||
sql.append("SELECT C_Payment_ID FROM C_Payment WHERE UPPER(DocumentNo) LIKE ")
|
||||
.append(DB.TO_STRING(text));
|
||||
}
|
||||
else if (m_columnName.equals("GL_JournalBatch_ID"))
|
||||
{
|
||||
sql.append("SELECT GL_JournalBatch_ID FROM GL_JournalBatch WHERE UPPER(DocumentNo) LIKE ")
|
||||
.append(DB.TO_STRING(text));
|
||||
}
|
||||
else if (m_columnName.equals("SalesRep_ID"))
|
||||
{
|
||||
sql.append("SELECT AD_User_ID FROM AD_User WHERE UPPER(Name) LIKE ")
|
||||
.append(DB.TO_STRING(text));
|
||||
|
||||
m_tableName = "AD_User";
|
||||
m_keyColumnName = "AD_User_ID";
|
||||
}
|
||||
|
||||
// Predefined
|
||||
|
||||
if (sql.length() > 0)
|
||||
{
|
||||
String wc = getWhereClause(lookup);
|
||||
|
||||
if (wc != null && wc.length() > 0)
|
||||
sql.append(" AND ").append(wc);
|
||||
|
||||
sql.append(" AND IsActive='Y'");
|
||||
// ***
|
||||
|
||||
if (log.isLoggable(Level.FINEST))
|
||||
log.finest(m_columnName + " (predefined) " + sql.toString());
|
||||
|
||||
return MRole.getDefault().addAccessSQL(sql.toString(),
|
||||
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
}
|
||||
|
||||
// Check if it is a Table Reference
|
||||
|
||||
if (lookup != null && lookup instanceof MLookup)
|
||||
{
|
||||
int AD_Reference_ID = ((MLookup)lookup).getAD_Reference_Value_ID();
|
||||
|
||||
if (AD_Reference_ID != 0)
|
||||
{
|
||||
boolean isValueDisplayed = false;
|
||||
String query = "SELECT kc.ColumnName, dc.ColumnName, t.TableName, rt.IsValueDisplayed "
|
||||
+ "FROM AD_Ref_Table rt"
|
||||
+ " INNER JOIN AD_Column kc ON (rt.AD_Key=kc.AD_Column_ID)"
|
||||
+ " INNER JOIN AD_Column dc ON (rt.AD_Display=dc.AD_Column_ID)"
|
||||
+ " INNER JOIN AD_Table t ON (rt.AD_Table_ID=t.AD_Table_ID) "
|
||||
+ "WHERE rt.AD_Reference_ID=?";
|
||||
|
||||
String displayColumnName = null;
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(query, null);
|
||||
pstmt.setInt(1, AD_Reference_ID);
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
if (rs.next())
|
||||
{
|
||||
m_keyColumnName = rs.getString(1);
|
||||
displayColumnName = rs.getString(2);
|
||||
m_tableName = rs.getString(3);
|
||||
String t = rs.getString(4);
|
||||
isValueDisplayed = "Y".equalsIgnoreCase(t);
|
||||
}
|
||||
}
|
||||
catch (Exception e)
|
||||
{
|
||||
log.log(Level.SEVERE, query, e);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
}
|
||||
|
||||
|
||||
if (displayColumnName != null)
|
||||
{
|
||||
sql = new StringBuffer();
|
||||
sql.append("SELECT ").append(m_keyColumnName)
|
||||
.append(" FROM ").append(m_tableName)
|
||||
.append(" WHERE (UPPER(").append(displayColumnName)
|
||||
.append(") LIKE ").append(DB.TO_STRING(text));
|
||||
if (isValueDisplayed)
|
||||
{
|
||||
sql.append(" OR UPPER(").append("Value")
|
||||
.append(") LIKE ").append(DB.TO_STRING(text));
|
||||
}
|
||||
sql.append(")");
|
||||
sql.append(" AND IsActive='Y'");
|
||||
|
||||
String wc = getWhereClause(lookup);
|
||||
|
||||
if (wc != null && wc.length() > 0)
|
||||
sql.append(" AND ").append(wc);
|
||||
|
||||
// ***
|
||||
|
||||
if (log.isLoggable(Level.FINEST))
|
||||
log.finest(m_columnName + " (Table) " + sql.toString());
|
||||
|
||||
return MRole.getDefault().addAccessSQL(sql.toString(),
|
||||
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
}
|
||||
} // Table Reference
|
||||
} // MLookup
|
||||
|
||||
/** Check Well Known Columns of Table - assumes TableDir **/
|
||||
|
||||
String query = "SELECT t.TableName, c.ColumnName "
|
||||
+ "FROM AD_Column c "
|
||||
+ " INNER JOIN AD_Table t ON (c.AD_Table_ID=t.AD_Table_ID AND t.IsView='N') "
|
||||
+ "WHERE (c.ColumnName IN ('DocumentNo', 'Value', 'Name') OR c.IsIdentifier='Y')"
|
||||
+ " AND c.AD_Reference_ID IN (10,14)"
|
||||
+ " AND EXISTS (SELECT * FROM AD_Column cc WHERE cc.AD_Table_ID=t.AD_Table_ID"
|
||||
+ " AND cc.IsKey='Y' AND cc.ColumnName=?)";
|
||||
|
||||
sql = new StringBuffer();
|
||||
PreparedStatement pstmt = null;
|
||||
ResultSet rs = null;
|
||||
try
|
||||
{
|
||||
pstmt = DB.prepareStatement(query, null);
|
||||
pstmt.setString(1, m_keyColumnName);
|
||||
rs = pstmt.executeQuery();
|
||||
|
||||
while (rs.next())
|
||||
{
|
||||
if (sql.length() != 0)
|
||||
sql.append(" OR ");
|
||||
|
||||
m_tableName = rs.getString(1);
|
||||
sql.append("UPPER(").append(rs.getString(2)).append(") LIKE ").append(DB.TO_STRING(text));
|
||||
}
|
||||
}
|
||||
catch (SQLException ex)
|
||||
{
|
||||
log.log(Level.SEVERE, query, ex);
|
||||
}
|
||||
finally
|
||||
{
|
||||
DB.close(rs, pstmt);
|
||||
rs = null;
|
||||
pstmt = null;
|
||||
}
|
||||
//
|
||||
if (sql.length() == 0)
|
||||
{
|
||||
log.log(Level.SEVERE, m_columnName + " (TableDir) - no standard/identifier columns");
|
||||
return "";
|
||||
}
|
||||
//
|
||||
StringBuffer retValue = new StringBuffer ("SELECT ")
|
||||
.append(m_columnName).append(" FROM ").append(m_tableName)
|
||||
.append(" WHERE ").append(sql)
|
||||
.append(" AND IsActive='Y'");
|
||||
|
||||
String wc = getWhereClause(lookup);
|
||||
|
||||
if (wc != null && wc.length() > 0)
|
||||
retValue.append(" AND ").append(wc);
|
||||
// ***
|
||||
if (log.isLoggable(Level.FINEST))
|
||||
log.finest(m_columnName + " (TableDir) " + sql.toString());
|
||||
return MRole.getDefault().addAccessSQL(retValue.toString(),
|
||||
m_tableName, MRole.SQL_NOTQUALIFIED, MRole.SQL_RO);
|
||||
}
|
||||
|
||||
private String getWhereClause(Lookup lookup)
|
||||
{
|
||||
String whereClause = "";
|
||||
|
||||
if (lookup == null)
|
||||
return "";
|
||||
|
||||
if (lookup.getZoomQuery() != null)
|
||||
whereClause = lookup.getZoomQuery().getWhereClause();
|
||||
|
||||
String validation = lookup.getValidation();
|
||||
|
||||
if (validation == null)
|
||||
validation = "";
|
||||
|
||||
if (whereClause.length() == 0)
|
||||
whereClause = validation;
|
||||
else if (validation.length() > 0)
|
||||
whereClause += " AND " + validation;
|
||||
|
||||
// log.finest("ZoomQuery=" + (lookup.getZoomQuery()==null ? "" : lookup.getZoomQuery().getWhereClause())
|
||||
// + ", Validation=" + lookup.getValidation());
|
||||
|
||||
if (whereClause.indexOf('@') != -1)
|
||||
{
|
||||
String validated = Env.parseContext(Env.getCtx(), lookup.getWindowNo(), whereClause, false);
|
||||
|
||||
if (validated.length() == 0)
|
||||
log.severe(lookup.getColumnName() + " - Cannot Parse=" + whereClause);
|
||||
else
|
||||
{
|
||||
if (log.isLoggable(Level.FINE))
|
||||
log.fine(lookup.getColumnName() + " - Parsed: " + validated);
|
||||
return validated;
|
||||
}
|
||||
}
|
||||
return whereClause;
|
||||
} // getWhereClause
|
||||
}
|
|
@ -66,10 +66,10 @@ public class Process {
|
|||
MProcess process = null;
|
||||
|
||||
if (AD_Menu_ID>0 && AD_Process_ID==0 )
|
||||
process = MProcess.getFromMenu( cs.getM_ctx(), AD_Menu_ID);
|
||||
process = MProcess.getFromMenu( cs.getCtx(), AD_Menu_ID);
|
||||
else
|
||||
if (AD_Menu_ID==0 && AD_Process_ID>0 )
|
||||
process = new MProcess( cs.getM_ctx(), AD_Process_ID, null);
|
||||
process = new MProcess( cs.getCtx(), AD_Process_ID, null);
|
||||
|
||||
if (process != null)
|
||||
{
|
||||
|
@ -101,7 +101,7 @@ public class Process {
|
|||
if (para.getDefaultValue().indexOf( "@#Date@")>=0) {
|
||||
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
||||
//String t = Env.getContext( cs.getM_ctx(), "#Date" );
|
||||
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getM_ctx(), "#Date") );
|
||||
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getCtx(), "#Date") );
|
||||
|
||||
p.setDefaultValue( t ); //cs.dateFormat.format( t ));
|
||||
}
|
||||
|
@ -125,7 +125,7 @@ public class Process {
|
|||
if (para.getDefaultValue2().indexOf( "@#Date@")>=0) {
|
||||
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
||||
//String t = Env.getContext( cs.getM_ctx(), "#Date" );
|
||||
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getM_ctx(), "#Date") );
|
||||
String t= cs.dateFormat.format( Env.getContextAsDate( cs.getCtx(), "#Date") );
|
||||
p.setDefaultValue2( t ); //cs.dateFormat.format( t ) );
|
||||
}
|
||||
}
|
||||
|
@ -165,7 +165,7 @@ public class Process {
|
|||
int m_record_id = rp.getADRecordID();
|
||||
//WebSessionCtx wsc = WebSessionCtx.get (request);
|
||||
|
||||
MProcess process = MProcess.get (m_cs.getM_ctx() , AD_Process_ID);
|
||||
MProcess process = MProcess.get (m_cs.getCtx() , AD_Process_ID);
|
||||
// need to check if Role can access
|
||||
if (process == null)
|
||||
{
|
||||
|
@ -183,13 +183,13 @@ public class Process {
|
|||
// Requirements
|
||||
// - the process must be a workflow document
|
||||
if (process.getAD_Workflow_ID() > 0) {
|
||||
MWorkflow wf = MWorkflow.get(m_cs.getM_ctx(), process.getAD_Workflow_ID());
|
||||
MWorkflow wf = MWorkflow.get(m_cs.getCtx(), process.getAD_Workflow_ID());
|
||||
if (wf.getWorkflowType().equals(MWorkflow.WORKFLOWTYPE_DocumentProcess)) {
|
||||
// - get the table associated with the workflow document
|
||||
// - set DocAction in such table
|
||||
|
||||
// get the PO for the tablename and record ID
|
||||
MTable table = MTable.get(m_cs.getM_ctx(), wf.getAD_Table_ID());
|
||||
MTable table = MTable.get(m_cs.getCtx(), wf.getAD_Table_ID());
|
||||
if (table != null) {
|
||||
PO po = table.getPO(m_record_id, null);
|
||||
if (po != null) {
|
||||
|
@ -222,8 +222,8 @@ public class Process {
|
|||
}
|
||||
//
|
||||
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID());
|
||||
pi.setAD_User_ID(Env.getAD_User_ID(m_cs.getM_ctx()));
|
||||
pi.setAD_Client_ID(Env.getAD_Client_ID(m_cs.getM_ctx()));
|
||||
pi.setAD_User_ID(Env.getAD_User_ID(m_cs.getCtx()));
|
||||
pi.setAD_Client_ID(Env.getAD_Client_ID(m_cs.getCtx()));
|
||||
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());
|
||||
if (m_record_id >0)
|
||||
pi.setRecord_ID( m_record_id );
|
||||
|
@ -332,7 +332,7 @@ public class Process {
|
|||
if (pf.isTableBased())
|
||||
{
|
||||
CharArrayWriter wr = new CharArrayWriter();
|
||||
ok = ReportEngineEx.createEXCEL_HTML_wr( re, m_cs.getM_ctx(), wr, false, re.getPrintFormat().getLanguage() );
|
||||
ok = ReportEngineEx.createEXCEL_HTML_wr( re, m_cs.getCtx(), wr, false, re.getPrintFormat().getLanguage() );
|
||||
file_type ="xls";
|
||||
String data = wr.toString();
|
||||
if (data!=null)
|
||||
|
@ -351,7 +351,7 @@ public class Process {
|
|||
}
|
||||
else
|
||||
{
|
||||
JasperPrint jp = getJasperReportPrint( m_cs.getM_ctx(), pi);
|
||||
JasperPrint jp = getJasperReportPrint( m_cs.getCtx(), pi);
|
||||
//file = File.createTempFile("WProcess", ".pdf");
|
||||
ByteArrayOutputStream wr = new ByteArrayOutputStream();
|
||||
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(jp, wr);
|
||||
|
@ -368,7 +368,7 @@ public class Process {
|
|||
//file.getAbsolutePath()
|
||||
|
||||
// Marker that Process is OK
|
||||
m_cs.getM_ctx().put("AD_PInstance_ID=" + pInstance.getAD_PInstance_ID(), "ok");
|
||||
m_cs.getCtx().put("AD_PInstance_ID=" + pInstance.getAD_PInstance_ID(), "ok");
|
||||
}
|
||||
else
|
||||
{
|
||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Properties;
|
|||
|
||||
import javax.annotation.Resource;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpSession;
|
||||
import javax.xml.namespace.QName;
|
||||
import javax.xml.ws.WebServiceContext;
|
||||
import javax.xml.ws.handler.MessageContext;
|
||||
|
@ -64,6 +63,7 @@ import org.idempiere.adinterface.CompiereService;
|
|||
*/
|
||||
public class AbstractService {
|
||||
|
||||
private static final String COMPIERE_SERVICE = "CompiereService";
|
||||
@Resource
|
||||
protected WebServiceContext ctx;
|
||||
|
||||
|
@ -79,16 +79,16 @@ public class AbstractService {
|
|||
|
||||
CompiereService m_cs = getCompiereService();
|
||||
|
||||
if (m_cs.isLoggedIn() && m_cs.getM_AD_Client_ID() == loginRequest.getClientID() && loginRequest.getClientID() == Env.getAD_Client_ID(Env.getCtx())
|
||||
&& m_cs.getM_AD_Org_ID() == loginRequest.getOrgID() && m_cs.getM_AD_Role_ID() == loginRequest.getRoleID()
|
||||
&& m_cs.getM_AD_Warehouse_ID() == loginRequest.getWarehouseID() && loginRequest.getUser().equals(m_cs.getUser()))
|
||||
if (m_cs.isLoggedIn() && m_cs.getAD_Client_ID() == loginRequest.getClientID() && loginRequest.getClientID() == Env.getAD_Client_ID(Env.getCtx())
|
||||
&& m_cs.getAD_Org_ID() == loginRequest.getOrgID() && m_cs.getAD_Role_ID() == loginRequest.getRoleID()
|
||||
&& m_cs.getM_Warehouse_ID() == loginRequest.getWarehouseID() && loginRequest.getUser().equals(m_cs.getUserName()))
|
||||
return authenticate(webService, method, serviceType, m_cs); // already logged with same data
|
||||
|
||||
String ret =invokeLoginValidator(loginRequest, m_cs.getM_ctx(), null, IWSValidator.TIMING_BEFORE_LOGIN);
|
||||
String ret =invokeLoginValidator(loginRequest, m_cs.getCtx(), null, IWSValidator.TIMING_BEFORE_LOGIN);
|
||||
if(ret!=null && ret.length()>0)
|
||||
return ret;
|
||||
|
||||
Login login = new Login(m_cs.getM_ctx());
|
||||
Login login = new Login(m_cs.getCtx());
|
||||
KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), loginRequest.getPass());
|
||||
if (roles != null) {
|
||||
boolean okrole = false;
|
||||
|
@ -112,7 +112,7 @@ public class AbstractService {
|
|||
if (!okclient)
|
||||
return "Error logging in - client not allowed for this role";
|
||||
|
||||
m_cs.getM_ctx().setProperty("#AD_Client_ID", "" + loginRequest.getClientID());
|
||||
m_cs.getCtx().setProperty("#AD_Client_ID", "" + loginRequest.getClientID());
|
||||
|
||||
KeyNamePair[] orgs = login.getOrgs(new KeyNamePair(loginRequest.getRoleID(), ""));
|
||||
|
||||
|
@ -146,7 +146,7 @@ public class AbstractService {
|
|||
if (error != null && error.length() > 0)
|
||||
return error;
|
||||
|
||||
int AD_User_ID = Env.getAD_User_ID(m_cs.getM_ctx());
|
||||
int AD_User_ID = Env.getAD_User_ID(m_cs.getCtx());
|
||||
|
||||
|
||||
if (!m_cs.login(AD_User_ID, loginRequest.getRoleID(), loginRequest.getClientID(), loginRequest.getOrgID(), loginRequest.getWarehouseID(), loginRequest.getLang()))
|
||||
|
@ -158,7 +158,7 @@ public class AbstractService {
|
|||
return "Error logging in - no roles or user/pwd invalid for user " + loginRequest.getUser();
|
||||
}
|
||||
|
||||
ret =invokeLoginValidator(loginRequest, m_cs.getM_ctx(), null, IWSValidator.TIMING_AFTER_LOGIN);
|
||||
ret =invokeLoginValidator(loginRequest, m_cs.getCtx(), null, IWSValidator.TIMING_AFTER_LOGIN);
|
||||
if(ret!=null && ret.length()>0)
|
||||
return ret;
|
||||
|
||||
|
@ -177,7 +177,7 @@ public class AbstractService {
|
|||
|
||||
HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
|
||||
|
||||
MWebService m_webservice = MWebService.get(m_cs.getM_ctx(), webServiceValue);
|
||||
MWebService m_webservice = MWebService.get(m_cs.getCtx(), webServiceValue);
|
||||
if (m_webservice == null || !m_webservice.isActive())
|
||||
return "Web Service " + webServiceValue + " not registered";
|
||||
|
||||
|
@ -192,13 +192,13 @@ public class AbstractService {
|
|||
ResultSet rs = null;
|
||||
try {
|
||||
pstmt = DB.prepareStatement(sql, null);
|
||||
pstmt.setInt(1, m_cs.getM_AD_Client_ID());
|
||||
pstmt.setInt(1, m_cs.getAD_Client_ID());
|
||||
pstmt.setInt(2, m_webservice.getWS_WebService_ID());
|
||||
pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID());
|
||||
pstmt.setString(4, serviceTypeValue);
|
||||
rs = pstmt.executeQuery();
|
||||
if (rs.next())
|
||||
m_webservicetype = new MWebServiceType(m_cs.getM_ctx(), rs, null);
|
||||
m_webservicetype = new MWebServiceType(m_cs.getCtx(), rs, null);
|
||||
} catch (Exception e) {
|
||||
throw new IdempiereServiceFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName(
|
||||
"authenticate"));
|
||||
|
@ -213,7 +213,7 @@ public class AbstractService {
|
|||
|
||||
req.setAttribute("MWebServiceType", m_webservicetype);
|
||||
|
||||
String ret=invokeLoginValidator(null, m_cs.getM_ctx(), m_webservicetype, IWSValidator.TIMING_ON_AUTHORIZATION);
|
||||
String ret=invokeLoginValidator(null, m_cs.getCtx(), m_webservicetype, IWSValidator.TIMING_ON_AUTHORIZATION);
|
||||
if(ret!=null && ret.length()>0)
|
||||
return ret;
|
||||
|
||||
|
@ -240,16 +240,14 @@ public class AbstractService {
|
|||
|
||||
/**
|
||||
*
|
||||
* @return Compiere Service object for current session
|
||||
* @return Compiere Service object for current request
|
||||
*/
|
||||
protected CompiereService getCompiereService() {
|
||||
HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
|
||||
HttpSession session = req.getSession();
|
||||
CompiereService m_cs = (CompiereService) session.getAttribute("CompiereServiceBean");
|
||||
CompiereService m_cs = (CompiereService) req.getAttribute(COMPIERE_SERVICE);
|
||||
if (m_cs == null) {
|
||||
m_cs = new CompiereService();
|
||||
m_cs.connect();
|
||||
session.setAttribute("CompiereServiceBean", m_cs);
|
||||
req.setAttribute(COMPIERE_SERVICE, m_cs);
|
||||
}
|
||||
return m_cs;
|
||||
}
|
||||
|
@ -394,10 +392,10 @@ public class AbstractService {
|
|||
if (indDot == -1) {
|
||||
if (varName.charAt(0) == '#') {
|
||||
varName = varName.substring(1);
|
||||
val = getCompiereService().getM_ctx().getProperty(varName);
|
||||
val = getCompiereService().getCtx().getProperty(varName);
|
||||
} else {
|
||||
// If there is no table name, then it should be
|
||||
// premitive data type
|
||||
// primitive data type
|
||||
if (po != null && poInfo.getColumnIndex(varName)!=-1)
|
||||
val = po.get_Value(varName);
|
||||
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.webservices;
|
||||
|
||||
import org.osgi.framework.BundleActivator;
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.webservices;
|
||||
|
||||
import java.util.Map;
|
||||
|
@ -10,6 +23,11 @@ import org.idempiere.webservices.fault.IdempiereServiceFault;
|
|||
import org.idempiere.adInterface.x10.ADLoginRequest;
|
||||
import org.idempiere.adInterface.x10.DataField;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author deepak
|
||||
*
|
||||
*/
|
||||
public interface IWSValidator {
|
||||
public static final int TIMING_BEFORE_PARSE=1;
|
||||
public static final int TIMING_AFTER_PARSE=2;
|
||||
|
@ -23,6 +41,25 @@ public interface IWSValidator {
|
|||
public static final int TIMING_BEFORE_PROCESS=8;
|
||||
public static final int TIMING_AFTER_PROCESS=9;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param po
|
||||
* @param m_webserviceType
|
||||
* @param fields
|
||||
* @param time
|
||||
* @param trxName
|
||||
* @param requestCtx
|
||||
* @throws IdempiereServiceFault
|
||||
*/
|
||||
public void validate(PO po,MWebServiceType m_webserviceType,DataField[] fields,int time,String trxName,Map<String, Object> requestCtx) throws IdempiereServiceFault;
|
||||
|
||||
/**
|
||||
*
|
||||
* @param loginRequest
|
||||
* @param ctx
|
||||
* @param m_webserviceType
|
||||
* @param time
|
||||
* @throws IdempiereServiceFault
|
||||
*/
|
||||
public void login(ADLoginRequest loginRequest,Properties ctx,MWebServiceType m_webserviceType,int time) throws IdempiereServiceFault;
|
||||
}
|
||||
|
|
|
@ -1,3 +1,16 @@
|
|||
/******************************************************************************
|
||||
* Copyright (C) 2012 Trek Global *
|
||||
* Product: iDempiere ERP & CRM Smart Business Solution *
|
||||
* 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. *
|
||||
*****************************************************************************/
|
||||
package org.idempiere.webservices.fault;
|
||||
|
||||
import javax.xml.namespace.QName;
|
||||
|
|
Loading…
Reference in New Issue