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)
|
@SOAPBinding(style=Style.RPC,use=Use.LITERAL,parameterStyle=ParameterStyle.WRAPPED)
|
||||||
public interface CompositeService {
|
public interface CompositeService {
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param reqs
|
||||||
|
* @return CompositeResponsesDocument
|
||||||
|
*/
|
||||||
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs);
|
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs);
|
||||||
}
|
}
|
||||||
|
|
|
@ -14,7 +14,7 @@
|
||||||
package com.trekglobal.ws;
|
package com.trekglobal.ws;
|
||||||
|
|
||||||
import java.util.ArrayList;
|
import java.util.ArrayList;
|
||||||
import java.util.Properties;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import javax.jws.WebService;
|
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.CompositeResponse;
|
||||||
import org.idempiere.adInterface.x10.CompositeResponses;
|
import org.idempiere.adInterface.x10.CompositeResponses;
|
||||||
import org.idempiere.adInterface.x10.CompositeResponsesDocument;
|
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.ModelCRUDRequest;
|
||||||
import org.idempiere.adInterface.x10.ModelCRUDRequestDocument;
|
import org.idempiere.adInterface.x10.ModelCRUDRequestDocument;
|
||||||
import org.idempiere.adInterface.x10.ModelRunProcessRequest;
|
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.StandardResponse;
|
||||||
import org.idempiere.adInterface.x10.StandardResponseDocument;
|
import org.idempiere.adInterface.x10.StandardResponseDocument;
|
||||||
import org.idempiere.adInterface.x10.WindowTabDataDocument;
|
import org.idempiere.adInterface.x10.WindowTabDataDocument;
|
||||||
import org.idempiere.adinterface.CompiereService;
|
|
||||||
import org.idempiere.adinterface.ModelADServiceImpl;
|
import org.idempiere.adinterface.ModelADServiceImpl;
|
||||||
import org.idempiere.webservices.AbstractService;
|
import org.idempiere.webservices.AbstractService;
|
||||||
|
|
||||||
|
@ -59,14 +56,20 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
||||||
private static String webServiceName = new String("CompositeInterface");
|
private static String webServiceName = new String("CompositeInterface");
|
||||||
|
|
||||||
public CompositeServiceImpl() {
|
public CompositeServiceImpl() {
|
||||||
|
if (log.isLoggable(Level.INFO))
|
||||||
log.info("Creating session object BiziInterface");
|
log.info("Creating session object compositeInterface");
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @see CompositeService#compositeOperation(CompositeRequestDocument)
|
||||||
|
*/
|
||||||
|
@Override
|
||||||
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs) {
|
public CompositeResponsesDocument compositeOperation(CompositeRequestDocument reqs) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
CompiereService m_cs = getCompiereService();
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
CompositeResponsesDocument ret = CompositeResponsesDocument.Factory.newInstance();
|
CompositeResponsesDocument ret = CompositeResponsesDocument.Factory.newInstance();
|
||||||
CompositeResponses resps = ret.addNewCompositeResponses();
|
CompositeResponses resps = ret.addNewCompositeResponses();
|
||||||
|
@ -86,11 +89,11 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
||||||
|
|
||||||
ModelADServiceImpl modelADService = new ModelADServiceImpl(ctx);
|
ModelADServiceImpl modelADService = new ModelADServiceImpl(ctx);
|
||||||
|
|
||||||
String trxName = m_cs.getM_trx_name();
|
String trxName = Trx.createTrxName(webServiceName);
|
||||||
trxName = Trx.createTrxName("ws_biziInterface");
|
|
||||||
|
|
||||||
Trx trx = Trx.get(trxName, true);
|
Trx trx = Trx.get(trxName, true);
|
||||||
|
|
||||||
|
try {
|
||||||
modelADService.setLocalTrxName(trxName);
|
modelADService.setLocalTrxName(trxName);
|
||||||
|
|
||||||
Operations operationsArr[] = req.getOperationsArray();
|
Operations operationsArr[] = req.getOperationsArray();
|
||||||
|
@ -109,10 +112,15 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
} finally {
|
||||||
trx.close();
|
trx.close();
|
||||||
|
}
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -260,6 +268,12 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
||||||
return wrapperDoc;
|
return wrapperDoc;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @param ctx
|
||||||
|
* @param crud
|
||||||
|
*/
|
||||||
|
/*
|
||||||
public void resolveContextCRUD(Properties ctx, ModelCRUD crud) {
|
public void resolveContextCRUD(Properties ctx, ModelCRUD crud) {
|
||||||
DataField fields[] = crud.getDataRow().getFieldArray();
|
DataField fields[] = crud.getDataRow().getFieldArray();
|
||||||
for (DataField field : fields) {
|
for (DataField field : fields) {
|
||||||
|
@ -271,7 +285,7 @@ public class CompositeServiceImpl extends AbstractService implements CompositeSe
|
||||||
field.setVal(val);
|
field.setVal(val);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}*/
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Rollback and set error on response
|
* 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;
|
JasperReport res = null;
|
||||||
try
|
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());
|
JasperCompileManager.compileReportToFile( reportFile.getAbsolutePath(), jasperFile.getAbsolutePath());
|
||||||
jasperFile.setLastModified( reportFile.lastModified());
|
jasperFile.setLastModified( reportFile.lastModified());
|
||||||
res = (JasperReport)JRLoader.loadObjectFromFile(jasperFile.getAbsolutePath());
|
res = (JasperReport)JRLoader.loadObjectFromFile(jasperFile.getAbsolutePath());
|
||||||
|
@ -235,49 +231,6 @@ public class ReportInfo
|
||||||
}
|
}
|
||||||
log.info("Get ReportDefinition-" + this.toString());
|
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()
|
protected boolean isDirty()
|
||||||
{
|
{
|
||||||
|
|
|
@ -41,6 +41,7 @@ import org.compiere.process.ProcessInfo;
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
|
import org.compiere.util.Ini;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -52,17 +53,12 @@ import org.compiere.util.Language;
|
||||||
*/
|
*/
|
||||||
public class ReportProcessor
|
public class ReportProcessor
|
||||||
{
|
{
|
||||||
public static final String REPORT_PATH__fix = "c:/compiere/compiere-all/reports";
|
|
||||||
|
|
||||||
public static File REPORT_HOME = null;
|
public static File REPORT_HOME = null;
|
||||||
private static CLogger log = CLogger.getCLogger(ReportProcessor.class);
|
private static CLogger log = CLogger.getCLogger(ReportProcessor.class);
|
||||||
|
|
||||||
static
|
static
|
||||||
{
|
{
|
||||||
String reportPath = REPORT_PATH__fix;// "c:/compiere/compiere-all/reports";//System.getProperty("REPORT_HOME");
|
String reportPath = Ini.getAdempiereHome();
|
||||||
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 classpath = Thread.currentThread().getContextClassLoader().getResource("net/sf/jasperreports/engine").toString();
|
String classpath = Thread.currentThread().getContextClassLoader().getResource("net/sf/jasperreports/engine").toString();
|
||||||
System.setProperty("jasper.reports.compile.temp", reportPath);
|
System.setProperty("jasper.reports.compile.temp", reportPath);
|
||||||
System.setProperty("jasper.reports.compile.class.path", classpath.split("file:/")[1].split("!")[0]);
|
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);
|
addProcessParameters( m_AD_PInstance_ID, m_Param);
|
||||||
m_Param.put("RECORD_ID", new Integer( m_Record_ID));
|
m_Param.put("RECORD_ID", new Integer( m_Record_ID));
|
||||||
// Marco LOMBARDO: REPORT_HOME used to express subreports path.
|
// 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.
|
// End Marco LOMBARDO.
|
||||||
Language currLang = Env.getLanguage(Env.getCtx());
|
Language currLang = Env.getLanguage(Env.getCtx());
|
||||||
m_Param.put("CURRENT_LANG", currLang.getAD_Language());
|
m_Param.put("CURRENT_LANG", currLang.getAD_Language());
|
||||||
|
@ -109,17 +105,13 @@ public class ReportProcessor
|
||||||
java.sql.Connection conn = DB.getConnectionRO();
|
java.sql.Connection conn = DB.getConnectionRO();
|
||||||
m_Param.put("REPORT_CONNECTION", conn ); //DB_CONN
|
m_Param.put("REPORT_CONNECTION", conn ); //DB_CONN
|
||||||
m_Param.put("DB_CONN", 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
|
// fill report
|
||||||
|
compiereDataSource ds = null;
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
compiereDataSource ds = CompiereDataSourceFactory.createDataSource(m_ctx, reportInfo, m_pi, m_Param);
|
ds = CompiereDataSourceFactory.createDataSource(m_ctx, reportInfo, m_pi, m_Param);
|
||||||
//compiereDataSource ds = new compiereDataSource (m_ctx, reportInfo.getJasperReport());
|
|
||||||
m_jasperPrint = JasperFillManager.fillReport( reportInfo.getJasperReport(), m_Param, ds);
|
m_jasperPrint = JasperFillManager.fillReport( reportInfo.getJasperReport(), m_Param, ds);
|
||||||
ds.close();
|
|
||||||
|
|
||||||
log.finest("ReportProcessor.fillReport");
|
log.finest("ReportProcessor.fillReport");
|
||||||
}
|
}
|
||||||
|
@ -132,6 +124,11 @@ public class ReportProcessor
|
||||||
{
|
{
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
|
finally
|
||||||
|
{
|
||||||
|
if (ds != null)
|
||||||
|
ds.close();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
System.out.println("Error:" + reportInfo.getErrorMsg());
|
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;
|
package org.idempiere.adinterface;
|
||||||
|
|
||||||
import org.compiere.model.Lookup;
|
import org.compiere.model.Lookup;
|
||||||
|
@ -18,7 +29,13 @@ public class ADLookup {
|
||||||
|
|
||||||
protected static CLogger log = CLogger.getCLogger(ADLookup.class);
|
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
|
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;
|
package org.idempiere.adinterface;
|
||||||
|
|
||||||
import java.sql.PreparedStatement;
|
import java.sql.PreparedStatement;
|
||||||
|
@ -18,6 +29,11 @@ import org.compiere.util.KeyNamePair;
|
||||||
import org.compiere.util.Language;
|
import org.compiere.util.Language;
|
||||||
import org.compiere.util.Login;
|
import org.compiere.util.Login;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @author deepak
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
public class CompiereService {
|
public class CompiereService {
|
||||||
|
|
||||||
private static CLogger log = CLogger.getCLogger(CompiereService.class);
|
private static CLogger log = CLogger.getCLogger(CompiereService.class);
|
||||||
|
@ -25,17 +41,16 @@ public class CompiereService {
|
||||||
public final static String datePattern = "dd-MM-yyyy";
|
public final static String datePattern = "dd-MM-yyyy";
|
||||||
|
|
||||||
private Properties m_ctx;
|
private Properties m_ctx;
|
||||||
private String m_trx_name;
|
|
||||||
|
|
||||||
private int m_AD_Client_ID;
|
private int m_AD_Client_ID;
|
||||||
private int m_AD_Org_ID;
|
private int m_AD_Org_ID;
|
||||||
private int m_AD_User_ID;
|
private int m_AD_User_ID;
|
||||||
private int m_AD_Role_ID;
|
private int m_AD_Role_ID;
|
||||||
private int m_AD_Warehouse_ID;
|
private int m_M_Warehouse_ID;
|
||||||
private String m_Lang;
|
private String m_locale;
|
||||||
private String m_User;
|
private String m_userName;
|
||||||
|
|
||||||
private boolean LoggedIn = false;
|
private boolean m_loggedin = false;
|
||||||
|
|
||||||
|
|
||||||
/** Localized Date format */
|
/** Localized Date format */
|
||||||
|
@ -66,57 +81,60 @@ public class CompiereService {
|
||||||
/** Localized Quantity format */
|
/** Localized Quantity format */
|
||||||
public DecimalFormat modelQuantityFormat = null;
|
public DecimalFormat modelQuantityFormat = null;
|
||||||
|
|
||||||
private Language m_lang;
|
private Language m_language;
|
||||||
|
|
||||||
public final String dateFormatOnlyForCtx = "yyyy-MM-dd";
|
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;
|
return m_AD_Client_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setM_AD_Client_ID(int client_ID) {
|
/**
|
||||||
m_AD_Client_ID = client_ID;
|
*
|
||||||
}
|
* @return AD_Org_ID of current request
|
||||||
|
*/
|
||||||
public int getM_AD_Org_ID() {
|
public int getAD_Org_ID() {
|
||||||
return m_AD_Org_ID;
|
return m_AD_Org_ID;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setM_AD_Org_ID(int org_ID) {
|
/**
|
||||||
m_AD_Org_ID = org_ID;
|
*
|
||||||
}
|
* @return context of current request
|
||||||
|
*/
|
||||||
public Properties getM_ctx() {
|
public Properties getCtx() {
|
||||||
return m_ctx;
|
return m_ctx;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setM_ctx(Properties m_ctx) {
|
/**
|
||||||
this.m_ctx = m_ctx;
|
* default constructor
|
||||||
}
|
*/
|
||||||
|
|
||||||
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;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public CompiereService()
|
public CompiereService()
|
||||||
{
|
{
|
||||||
m_trx_name= null; //Trx.createTrxName();
|
m_loggedin = false;
|
||||||
m_ctx = new Properties();
|
m_connected = false;
|
||||||
LoggedIn = false;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* setup request
|
||||||
|
*/
|
||||||
public void connect()
|
public void connect()
|
||||||
|
{
|
||||||
|
if (!m_connected)
|
||||||
{
|
{
|
||||||
CompiereUtil.initWeb();
|
CompiereUtil.initWeb();
|
||||||
|
|
||||||
|
m_ctx = new Properties();
|
||||||
|
m_connected = true;
|
||||||
|
|
||||||
ServerContext.setCurrentInstance(m_ctx);
|
ServerContext.setCurrentInstance(m_ctx);
|
||||||
Env.setContext( m_ctx, "#AD_Language", "en_US" );
|
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
|
// These variables are needed for ADClient.exe
|
||||||
Language m_lang2 = Language.getLanguage("pl_PL");
|
Language m_lang2 = Language.getLanguage("pl_PL");
|
||||||
|
@ -129,20 +147,43 @@ public class CompiereService {
|
||||||
integerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_lang2);
|
integerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_lang2);
|
||||||
numberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_lang2);
|
numberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_lang2);
|
||||||
quantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, 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() {
|
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 (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 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)";
|
+ " 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
|
try
|
||||||
{
|
{
|
||||||
PreparedStatement pstmt = DB.prepareStatement(sql, null);
|
pstmt = DB.prepareStatement(sql, null);
|
||||||
pstmt.setInt(1, AD_User_ID);
|
pstmt.setInt(1, AD_User_ID);
|
||||||
pstmt.setInt(2, AD_Client_ID);
|
pstmt.setInt(2, AD_Client_ID);
|
||||||
pstmt.setInt(3, AD_Org_ID);
|
pstmt.setInt(3, AD_Org_ID);
|
||||||
pstmt.setInt(4, AD_Role_ID);
|
pstmt.setInt(4, AD_Role_ID);
|
||||||
ResultSet rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
if (rs.next())
|
||||||
loginInfo = rs.getString(1);
|
loginInfo = rs.getString(1);
|
||||||
rs.close();
|
rs.close();
|
||||||
|
@ -185,7 +228,9 @@ public class CompiereService {
|
||||||
}
|
}
|
||||||
catch (SQLException e)
|
catch (SQLException e)
|
||||||
{
|
{
|
||||||
// log.log(Level.SEVERE, "checkLogin", e);
|
e.printStackTrace();
|
||||||
|
} finally {
|
||||||
|
DB.close(rs, pstmt);
|
||||||
}
|
}
|
||||||
|
|
||||||
// not verified
|
// not verified
|
||||||
|
@ -202,16 +247,23 @@ public class CompiereService {
|
||||||
String printer = null;
|
String printer = null;
|
||||||
Login login = new Login(ctx);
|
Login login = new Login(ctx);
|
||||||
login.loadPreferences(org, wh, date, printer);
|
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;
|
return loginInfo;
|
||||||
} // checkLogin
|
} // 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)
|
if (loginInfo == null)
|
||||||
return false;
|
return false;
|
||||||
|
|
||||||
|
@ -219,75 +271,74 @@ public class CompiereService {
|
||||||
m_AD_Org_ID = AD_Org_ID;
|
m_AD_Org_ID = AD_Org_ID;
|
||||||
m_AD_User_ID = AD_User_ID;
|
m_AD_User_ID = AD_User_ID;
|
||||||
m_AD_Role_ID = AD_Role_ID;
|
m_AD_Role_ID = AD_Role_ID;
|
||||||
m_AD_Warehouse_ID = AD_Warehouse_ID;
|
m_M_Warehouse_ID = M_Warehouse_ID;
|
||||||
m_Lang = Lang;
|
m_locale = Lang;
|
||||||
m_User = MUser.getNameOfUser(m_AD_User_ID);
|
m_userName = MUser.getNameOfUser(m_AD_User_ID);
|
||||||
|
|
||||||
Env.setContext( m_ctx, "#AD_Language", Lang);
|
Env.setContext( m_ctx, "#AD_Language", Lang);
|
||||||
m_lang = Language.getLanguage(Lang);
|
m_language = Language.getLanguage(Lang);
|
||||||
Env.verifyLanguage( getM_ctx(), m_lang );
|
Env.verifyLanguage( getCtx(), m_language );
|
||||||
|
|
||||||
modelDateFormat = new SimpleDateFormat( datePattern );
|
modelDateFormat = new SimpleDateFormat( datePattern );
|
||||||
modelDateTimeFormat = new SimpleDateFormat( datePattern );
|
modelDateTimeFormat = new SimpleDateFormat( datePattern );
|
||||||
|
|
||||||
modelAmountFormat = DisplayType.getNumberFormat(DisplayType.Amount, m_lang);
|
modelAmountFormat = DisplayType.getNumberFormat(DisplayType.Amount, m_language);
|
||||||
modelIntegerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_lang);
|
modelIntegerFormat = DisplayType.getNumberFormat(DisplayType.Integer, m_language);
|
||||||
modelNumberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_lang);
|
modelNumberFormat = DisplayType.getNumberFormat(DisplayType.Number, m_language);
|
||||||
modelQuantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, m_lang);
|
modelQuantityFormat = DisplayType.getNumberFormat(DisplayType.Quantity, m_language);
|
||||||
|
|
||||||
// Set Date
|
// Set Date
|
||||||
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
Timestamp ts = new Timestamp(System.currentTimeMillis());
|
||||||
|
|
||||||
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat( dateFormatOnlyForCtx );
|
SimpleDateFormat dateFormat4Timestamp = new SimpleDateFormat( dateFormatOnlyForCtx );
|
||||||
Env.setContext( getM_ctx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
Env.setContext( getCtx(), "#Date", dateFormat4Timestamp.format(ts)+" 00:00:00" ); // JDBC format
|
||||||
log.info(" #Date = "+ Env.getContextAsDate( getM_ctx(), "#Date"));
|
log.info(" #Date = "+ Env.getContextAsDate( getCtx(), "#Date"));
|
||||||
|
|
||||||
Env.setContext( getM_ctx(), "#M_Warehouse_ID", AD_Warehouse_ID );
|
Env.setContext( getCtx(), "#M_Warehouse_ID", M_Warehouse_ID );
|
||||||
Env.setContext(m_ctx, Env.LANGUAGE, m_lang.getAD_Language());
|
Env.setContext(m_ctx, Env.LANGUAGE, m_language.getAD_Language());
|
||||||
//Env.setContext( getM_ctx(), "#AD_Language", Lang );
|
|
||||||
|
|
||||||
LoggedIn = true;
|
m_loggedin = true;
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void setM_AD_User_ID(int m_AD_User_ID) {
|
/**
|
||||||
this.m_AD_User_ID = m_AD_User_ID;
|
*
|
||||||
}
|
* @return AD_User_ID of current request
|
||||||
|
*/
|
||||||
public int getM_AD_User_ID() {
|
public int getAD_User_ID() {
|
||||||
return m_AD_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;
|
*
|
||||||
}
|
* @return AD_Role_ID of current request
|
||||||
|
*/
|
||||||
public int getM_AD_Role_ID() {
|
public int getAD_Role_ID() {
|
||||||
return m_AD_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;
|
*
|
||||||
}
|
* @return logged in user name of current request
|
||||||
|
*/
|
||||||
public int getM_AD_Warehouse_ID() {
|
public String getUserName() {
|
||||||
return m_AD_Warehouse_ID;
|
return m_userName;
|
||||||
}
|
|
||||||
|
|
||||||
public void setUser(String m_User) {
|
|
||||||
this.m_User = m_User;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getUser() {
|
|
||||||
return m_User;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -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;
|
package org.idempiere.adinterface;
|
||||||
|
|
||||||
|
|
||||||
import java.util.Properties;
|
|
||||||
import java.util.logging.Level;
|
import java.util.logging.Level;
|
||||||
|
|
||||||
import org.compiere.Adempiere;
|
import org.compiere.Adempiere;
|
||||||
import org.compiere.model.MClient;
|
|
||||||
import org.compiere.model.MSystem;
|
|
||||||
import org.compiere.util.CLogger;
|
import org.compiere.util.CLogger;
|
||||||
|
|
||||||
|
|
||||||
|
@ -15,7 +23,9 @@ public class CompiereUtil {
|
||||||
private static CLogger log = CLogger.getCLogger(CompiereUtil.class);
|
private static CLogger log = CLogger.getCLogger(CompiereUtil.class);
|
||||||
private static boolean s_initOK = false;
|
private static boolean s_initOK = false;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @return startup idempiere environment if needed
|
||||||
|
*/
|
||||||
public static boolean initWeb()
|
public static boolean initWeb()
|
||||||
{
|
{
|
||||||
if (s_initOK)
|
if (s_initOK)
|
||||||
|
@ -23,16 +33,8 @@ public class CompiereUtil {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
|
|
||||||
// TODO:
|
|
||||||
// Load Environment Variables (serverApps/src/web/WEB-INF/web.xml)
|
|
||||||
|
|
||||||
|
|
||||||
try
|
try
|
||||||
{
|
{
|
||||||
//CLogMgt.setLevel(Level.OFF);
|
|
||||||
|
|
||||||
/* ADEMPIERE/COMPIERE */
|
|
||||||
//s_initOK = Compiere.startup(false);
|
|
||||||
s_initOK = Adempiere.startup(false);
|
s_initOK = Adempiere.startup(false);
|
||||||
}
|
}
|
||||||
catch (Exception ex)
|
catch (Exception ex)
|
||||||
|
@ -42,16 +44,6 @@ public class CompiereUtil {
|
||||||
if (!s_initOK)
|
if (!s_initOK)
|
||||||
return false;
|
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;
|
return s_initOK;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -45,6 +45,7 @@ import javax.xml.ws.WebServiceContext;
|
||||||
import org.apache.xmlbeans.StringEnumAbstractBase.Table;
|
import org.apache.xmlbeans.StringEnumAbstractBase.Table;
|
||||||
import org.compiere.model.Lookup;
|
import org.compiere.model.Lookup;
|
||||||
import org.compiere.model.MColumn;
|
import org.compiere.model.MColumn;
|
||||||
|
import org.compiere.model.MLookup;
|
||||||
import org.compiere.model.MRefTable;
|
import org.compiere.model.MRefTable;
|
||||||
import org.compiere.model.MRole;
|
import org.compiere.model.MRole;
|
||||||
import org.compiere.model.MTable;
|
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.CLogger;
|
||||||
import org.compiere.util.DB;
|
import org.compiere.util.DB;
|
||||||
import org.compiere.util.Env;
|
import org.compiere.util.Env;
|
||||||
import org.compiere.util.KeyNamePair;
|
|
||||||
import org.compiere.util.Trx;
|
import org.compiere.util.Trx;
|
||||||
import org.compiere.util.ValueNamePair;
|
|
||||||
import org.idempiere.adInterface.x10.ADLoginRequest;
|
import org.idempiere.adInterface.x10.ADLoginRequest;
|
||||||
import org.idempiere.adInterface.x10.DataField;
|
import org.idempiere.adInterface.x10.DataField;
|
||||||
import org.idempiere.adInterface.x10.DataRow;
|
import org.idempiere.adInterface.x10.DataRow;
|
||||||
|
@ -161,6 +160,11 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
* use the runProcess web service
|
* use the runProcess web service
|
||||||
*/
|
*/
|
||||||
public StandardResponseDocument setDocAction(ModelSetDocActionRequestDocument req) {
|
public StandardResponseDocument setDocAction(ModelSetDocActionRequestDocument req) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||||
StandardResponse resp = ret.addNewStandardResponse();
|
StandardResponse resp = ret.addNewStandardResponse();
|
||||||
|
@ -190,7 +194,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
return ret;
|
return ret;
|
||||||
}
|
}
|
||||||
|
|
||||||
Properties ctx = m_cs.getM_ctx();
|
Properties ctx = m_cs.getCtx();
|
||||||
|
|
||||||
// start a trx
|
// start a trx
|
||||||
String trxName = localTrxName;
|
String trxName = localTrxName;
|
||||||
|
@ -285,6 +289,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
|
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private String validateParameter(String parameterName, String string) {
|
private String validateParameter(String parameterName, String string) {
|
||||||
|
@ -348,6 +356,12 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
|
|
||||||
|
|
||||||
public RunProcessResponseDocument runProcess(ModelRunProcessRequestDocument req) {
|
public RunProcessResponseDocument runProcess(ModelRunProcessRequestDocument req) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
RunProcessResponseDocument resbadlogin = RunProcessResponseDocument.Factory.newInstance();
|
RunProcessResponseDocument resbadlogin = RunProcessResponseDocument.Factory.newInstance();
|
||||||
RunProcessResponse rbadlogin = resbadlogin.addNewRunProcessResponse();
|
RunProcessResponse rbadlogin = resbadlogin.addNewRunProcessResponse();
|
||||||
ModelRunProcess modelRunProcess = req.getModelRunProcessRequest().getModelRunProcess();
|
ModelRunProcess modelRunProcess = req.getModelRunProcessRequest().getModelRunProcess();
|
||||||
|
@ -376,9 +390,19 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
reqprocess.setADRecordID(modelRunProcess.getADRecordID());
|
reqprocess.setADRecordID(modelRunProcess.getADRecordID());
|
||||||
reqprocess.setDocAction(modelRunProcess.getDocAction());
|
reqprocess.setDocAction(modelRunProcess.getDocAction());
|
||||||
return Process.runProcess(getCompiereService(), docprocess);
|
return Process.runProcess(getCompiereService(), docprocess);
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowTabDataDocument getList(ModelGetListRequestDocument req) {
|
public WindowTabDataDocument getList(ModelGetListRequestDocument req) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
WindowTabDataDocument resdoc = WindowTabDataDocument.Factory.newInstance();
|
WindowTabDataDocument resdoc = WindowTabDataDocument.Factory.newInstance();
|
||||||
WindowTabData res = resdoc.addNewWindowTabData();
|
WindowTabData res = resdoc.addNewWindowTabData();
|
||||||
DataSet ds = res.addNewDataSet();
|
DataSet ds = res.addNewDataSet();
|
||||||
|
@ -410,7 +434,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
|
|
||||||
CompiereService m_cs = getCompiereService();
|
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);
|
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);
|
res.setStartRow(1);
|
||||||
|
|
||||||
return resdoc;
|
return resdoc;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
} // getList
|
} // getList
|
||||||
|
|
||||||
public StandardResponseDocument deleteData(ModelCRUDRequestDocument req) {
|
public StandardResponseDocument deleteData(ModelCRUDRequestDocument req) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||||
StandardResponse resp = ret.addNewStandardResponse();
|
StandardResponse resp = ret.addNewStandardResponse();
|
||||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||||
|
@ -615,7 +649,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
resp.setRecordID(recordID);
|
resp.setRecordID(recordID);
|
||||||
|
|
||||||
CompiereService m_cs = getCompiereService();
|
CompiereService m_cs = getCompiereService();
|
||||||
Properties ctx = m_cs.getM_ctx();
|
Properties ctx = m_cs.getCtx();
|
||||||
|
|
||||||
// start a trx
|
// start a trx
|
||||||
String trxName = localTrxName;
|
String trxName = localTrxName;
|
||||||
|
@ -648,6 +682,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
trx.close();
|
trx.close();
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
private void validateCRUD(ModelCRUD modelCRUD) {
|
private void validateCRUD(ModelCRUD modelCRUD) {
|
||||||
|
@ -659,6 +697,12 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
|
|
||||||
public StandardResponseDocument createData(ModelCRUDRequestDocument req){
|
public StandardResponseDocument createData(ModelCRUDRequestDocument req){
|
||||||
|
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||||
StandardResponse resp = ret.addNewStandardResponse();
|
StandardResponse resp = ret.addNewStandardResponse();
|
||||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||||
|
@ -684,7 +728,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
String tableName = modelCRUD.getTableName();
|
String tableName = modelCRUD.getTableName();
|
||||||
|
|
||||||
CompiereService m_cs= getCompiereService();
|
CompiereService m_cs= getCompiereService();
|
||||||
Properties ctx = m_cs.getM_ctx();
|
Properties ctx = m_cs.getCtx();
|
||||||
|
|
||||||
// start a trx
|
// start a trx
|
||||||
String trxName = localTrxName;
|
String trxName = localTrxName;
|
||||||
|
@ -755,9 +799,20 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
setOuputFields(resp, m_webservicetype,po,poinfo);
|
setOuputFields(resp, m_webservicetype,po,poinfo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
|
||||||
|
}
|
||||||
} // createData
|
} // createData
|
||||||
|
|
||||||
public StandardResponseDocument createUpdateData(ModelCRUDRequestDocument req) {
|
public StandardResponseDocument createUpdateData(ModelCRUDRequestDocument req) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||||
StandardResponse resp = ret.addNewStandardResponse();
|
StandardResponse resp = ret.addNewStandardResponse();
|
||||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||||
|
@ -783,7 +838,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
String tableName = modelCRUD.getTableName();
|
String tableName = modelCRUD.getTableName();
|
||||||
|
|
||||||
CompiereService m_cs = getCompiereService();
|
CompiereService m_cs = getCompiereService();
|
||||||
Properties ctx = m_cs.getM_ctx();
|
Properties ctx = m_cs.getCtx();
|
||||||
|
|
||||||
// start a trx
|
// start a trx
|
||||||
String trxName = localTrxName;
|
String trxName = localTrxName;
|
||||||
|
@ -948,6 +1003,10 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
setOuputFields(resp, m_webservicetype, po, poinfo);
|
setOuputFields(resp, m_webservicetype, po, poinfo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
} // createUpdateData
|
} // createUpdateData
|
||||||
|
|
||||||
private void setValueAccordingToClass(PO po, POInfo poinfo, DataField field, int idxcol) {
|
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(
|
throw new IdempiereServiceFault(field.getColumn() + " is not lookup column. Pass Value in val element ", new QName(
|
||||||
"LookupResolutionFailed"));
|
"LookupResolutionFailed"));
|
||||||
}
|
}
|
||||||
if (lookup.getSize() == 0)
|
|
||||||
lookup.refresh();
|
|
||||||
Object[] list = lookup.getData(true, true, true, false,false).toArray(); // IDEMPIERE 90
|
|
||||||
|
|
||||||
for (Object pair : list) {
|
String sql = getDirectAccessSQL(lookup, lookupValue.toUpperCase());
|
||||||
if (pair instanceof KeyNamePair) {
|
int id = DB.getSQLValue(localTrxName, sql);
|
||||||
KeyNamePair p = (KeyNamePair) pair;
|
if (id > 0)
|
||||||
if (p.getName().equals(lookupValue)) {
|
value = id;
|
||||||
value = p.getID();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
ValueNamePair p = (ValueNamePair) pair;
|
|
||||||
if (p.getName().equals(lookupValue)) {
|
|
||||||
value = p.getValue();
|
|
||||||
break;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
if (value == null) {
|
if (value == null) {
|
||||||
throw new IdempiereServiceFault(" Invalid Lookup value:" + lookupValue, new QName("LookupResolutionFailed"));
|
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);
|
String varName = strValue.substring(1);
|
||||||
if (varName.charAt(0) == '#') {
|
if (varName.charAt(0) == '#') {
|
||||||
varName = varName.substring(1);
|
varName = varName.substring(1);
|
||||||
strValue = m_cs.getM_ctx().getProperty(varName);
|
strValue = m_cs.getCtx().getProperty(varName);
|
||||||
} else {
|
} else {
|
||||||
int indDot = varName.indexOf(".");
|
int indDot = varName.indexOf(".");
|
||||||
if (indDot == -1) {
|
if (indDot == -1) {
|
||||||
|
@ -1085,6 +1130,12 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
}
|
}
|
||||||
|
|
||||||
public StandardResponseDocument updateData(ModelCRUDRequestDocument req){
|
public StandardResponseDocument updateData(ModelCRUDRequestDocument req){
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
StandardResponseDocument ret = StandardResponseDocument.Factory.newInstance();
|
||||||
StandardResponse resp = ret.addNewStandardResponse();
|
StandardResponse resp = ret.addNewStandardResponse();
|
||||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||||
|
@ -1113,7 +1164,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
|
|
||||||
CompiereService m_cs = getCompiereService();
|
CompiereService m_cs = getCompiereService();
|
||||||
MWebServiceType m_webservicetype= getWebServiceType();
|
MWebServiceType m_webservicetype= getWebServiceType();
|
||||||
Properties ctx = m_cs.getM_ctx();
|
Properties ctx = m_cs.getCtx();
|
||||||
|
|
||||||
// start a trx
|
// start a trx
|
||||||
String trxName = localTrxName;
|
String trxName = localTrxName;
|
||||||
|
@ -1162,9 +1213,19 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
setOuputFields(resp, m_webservicetype, po, poinfo);
|
setOuputFields(resp, m_webservicetype, po, poinfo);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
} // updateData
|
} // updateData
|
||||||
|
|
||||||
public WindowTabDataDocument readData(ModelCRUDRequestDocument req) {
|
public WindowTabDataDocument readData(ModelCRUDRequestDocument req) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
|
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
|
||||||
WindowTabData resp = ret.addNewWindowTabData();
|
WindowTabData resp = ret.addNewWindowTabData();
|
||||||
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
ModelCRUD modelCRUD = req.getModelCRUDRequest().getModelCRUD();
|
||||||
|
@ -1193,7 +1254,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
String trxName = localTrxName;
|
String trxName = localTrxName;
|
||||||
|
|
||||||
|
|
||||||
Properties ctx = m_cs.getM_ctx();
|
Properties ctx = m_cs.getCtx();
|
||||||
String tableName = modelCRUD.getTableName();
|
String tableName = modelCRUD.getTableName();
|
||||||
|
|
||||||
String recordIDVar = modelCRUD.getRecordIDVariable();
|
String recordIDVar = modelCRUD.getRecordIDVariable();
|
||||||
|
@ -1249,9 +1310,19 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
resp.setStartRow(1);
|
resp.setStartRow(1);
|
||||||
|
|
||||||
return ret;
|
return ret;
|
||||||
|
} finally {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().disconnect();
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public WindowTabDataDocument queryData(ModelCRUDRequestDocument req) {
|
public WindowTabDataDocument queryData(ModelCRUDRequestDocument req) {
|
||||||
|
boolean connected = getCompiereService().isConnected();
|
||||||
|
|
||||||
|
try {
|
||||||
|
if (!connected)
|
||||||
|
getCompiereService().connect();
|
||||||
|
|
||||||
CompiereService m_cs = getCompiereService();
|
CompiereService m_cs = getCompiereService();
|
||||||
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
|
WindowTabDataDocument ret = WindowTabDataDocument.Factory.newInstance();
|
||||||
WindowTabData resp = ret.addNewWindowTabData();
|
WindowTabData resp = ret.addNewWindowTabData();
|
||||||
|
@ -1268,7 +1339,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
// Validate parameters vs service type
|
// Validate parameters vs service type
|
||||||
validateCRUD(modelCRUD);
|
validateCRUD(modelCRUD);
|
||||||
|
|
||||||
Properties ctx = m_cs.getM_ctx();
|
Properties ctx = m_cs.getCtx();
|
||||||
String tableName = modelCRUD.getTableName();
|
String tableName = modelCRUD.getTableName();
|
||||||
|
|
||||||
MWebServiceType m_webservicetype = getWebServiceType();
|
MWebServiceType m_webservicetype = getWebServiceType();
|
||||||
|
@ -1351,6 +1422,276 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
resp.setStartRow(1);
|
resp.setStartRow(1);
|
||||||
|
|
||||||
return ret;
|
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;
|
MProcess process = null;
|
||||||
|
|
||||||
if (AD_Menu_ID>0 && AD_Process_ID==0 )
|
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
|
else
|
||||||
if (AD_Menu_ID==0 && AD_Process_ID>0 )
|
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)
|
if (process != null)
|
||||||
{
|
{
|
||||||
|
@ -101,7 +101,7 @@ public class Process {
|
||||||
if (para.getDefaultValue().indexOf( "@#Date@")>=0) {
|
if (para.getDefaultValue().indexOf( "@#Date@")>=0) {
|
||||||
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
||||||
//String t = Env.getContext( 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 ));
|
p.setDefaultValue( t ); //cs.dateFormat.format( t ));
|
||||||
}
|
}
|
||||||
|
@ -125,7 +125,7 @@ public class Process {
|
||||||
if (para.getDefaultValue2().indexOf( "@#Date@")>=0) {
|
if (para.getDefaultValue2().indexOf( "@#Date@")>=0) {
|
||||||
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
//Object t = Env.getContextAsDate( cs.getM_ctx(), "#Date" );
|
||||||
//String t = Env.getContext( 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 ) );
|
p.setDefaultValue2( t ); //cs.dateFormat.format( t ) );
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@ -165,7 +165,7 @@ public class Process {
|
||||||
int m_record_id = rp.getADRecordID();
|
int m_record_id = rp.getADRecordID();
|
||||||
//WebSessionCtx wsc = WebSessionCtx.get (request);
|
//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
|
// need to check if Role can access
|
||||||
if (process == null)
|
if (process == null)
|
||||||
{
|
{
|
||||||
|
@ -183,13 +183,13 @@ public class Process {
|
||||||
// Requirements
|
// Requirements
|
||||||
// - the process must be a workflow document
|
// - the process must be a workflow document
|
||||||
if (process.getAD_Workflow_ID() > 0) {
|
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)) {
|
if (wf.getWorkflowType().equals(MWorkflow.WORKFLOWTYPE_DocumentProcess)) {
|
||||||
// - get the table associated with the workflow document
|
// - get the table associated with the workflow document
|
||||||
// - set DocAction in such table
|
// - set DocAction in such table
|
||||||
|
|
||||||
// get the PO for the tablename and record ID
|
// 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) {
|
if (table != null) {
|
||||||
PO po = table.getPO(m_record_id, null);
|
PO po = table.getPO(m_record_id, null);
|
||||||
if (po != null) {
|
if (po != null) {
|
||||||
|
@ -222,8 +222,8 @@ public class Process {
|
||||||
}
|
}
|
||||||
//
|
//
|
||||||
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID());
|
ProcessInfo pi = new ProcessInfo (process.getName(), process.getAD_Process_ID());
|
||||||
pi.setAD_User_ID(Env.getAD_User_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.getM_ctx()));
|
pi.setAD_Client_ID(Env.getAD_Client_ID(m_cs.getCtx()));
|
||||||
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());
|
pi.setAD_PInstance_ID(pInstance.getAD_PInstance_ID());
|
||||||
if (m_record_id >0)
|
if (m_record_id >0)
|
||||||
pi.setRecord_ID( m_record_id );
|
pi.setRecord_ID( m_record_id );
|
||||||
|
@ -332,7 +332,7 @@ public class Process {
|
||||||
if (pf.isTableBased())
|
if (pf.isTableBased())
|
||||||
{
|
{
|
||||||
CharArrayWriter wr = new CharArrayWriter();
|
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";
|
file_type ="xls";
|
||||||
String data = wr.toString();
|
String data = wr.toString();
|
||||||
if (data!=null)
|
if (data!=null)
|
||||||
|
@ -351,7 +351,7 @@ public class Process {
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
JasperPrint jp = getJasperReportPrint( m_cs.getM_ctx(), pi);
|
JasperPrint jp = getJasperReportPrint( m_cs.getCtx(), pi);
|
||||||
//file = File.createTempFile("WProcess", ".pdf");
|
//file = File.createTempFile("WProcess", ".pdf");
|
||||||
ByteArrayOutputStream wr = new ByteArrayOutputStream();
|
ByteArrayOutputStream wr = new ByteArrayOutputStream();
|
||||||
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(jp, wr);
|
net.sf.jasperreports.engine.JasperExportManager.exportReportToPdfStream(jp, wr);
|
||||||
|
@ -368,7 +368,7 @@ public class Process {
|
||||||
//file.getAbsolutePath()
|
//file.getAbsolutePath()
|
||||||
|
|
||||||
// Marker that Process is OK
|
// 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
|
else
|
||||||
{
|
{
|
||||||
|
|
|
@ -25,7 +25,6 @@ import java.util.Properties;
|
||||||
|
|
||||||
import javax.annotation.Resource;
|
import javax.annotation.Resource;
|
||||||
import javax.servlet.http.HttpServletRequest;
|
import javax.servlet.http.HttpServletRequest;
|
||||||
import javax.servlet.http.HttpSession;
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
import javax.xml.ws.WebServiceContext;
|
import javax.xml.ws.WebServiceContext;
|
||||||
import javax.xml.ws.handler.MessageContext;
|
import javax.xml.ws.handler.MessageContext;
|
||||||
|
@ -64,6 +63,7 @@ import org.idempiere.adinterface.CompiereService;
|
||||||
*/
|
*/
|
||||||
public class AbstractService {
|
public class AbstractService {
|
||||||
|
|
||||||
|
private static final String COMPIERE_SERVICE = "CompiereService";
|
||||||
@Resource
|
@Resource
|
||||||
protected WebServiceContext ctx;
|
protected WebServiceContext ctx;
|
||||||
|
|
||||||
|
@ -79,16 +79,16 @@ public class AbstractService {
|
||||||
|
|
||||||
CompiereService m_cs = getCompiereService();
|
CompiereService m_cs = getCompiereService();
|
||||||
|
|
||||||
if (m_cs.isLoggedIn() && m_cs.getM_AD_Client_ID() == loginRequest.getClientID() && loginRequest.getClientID() == Env.getAD_Client_ID(Env.getCtx())
|
if (m_cs.isLoggedIn() && m_cs.getAD_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.getAD_Org_ID() == loginRequest.getOrgID() && m_cs.getAD_Role_ID() == loginRequest.getRoleID()
|
||||||
&& m_cs.getM_AD_Warehouse_ID() == loginRequest.getWarehouseID() && loginRequest.getUser().equals(m_cs.getUser()))
|
&& 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
|
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)
|
if(ret!=null && ret.length()>0)
|
||||||
return ret;
|
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());
|
KeyNamePair[] roles = login.getRoles(loginRequest.getUser(), loginRequest.getPass());
|
||||||
if (roles != null) {
|
if (roles != null) {
|
||||||
boolean okrole = false;
|
boolean okrole = false;
|
||||||
|
@ -112,7 +112,7 @@ public class AbstractService {
|
||||||
if (!okclient)
|
if (!okclient)
|
||||||
return "Error logging in - client not allowed for this role";
|
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(), ""));
|
KeyNamePair[] orgs = login.getOrgs(new KeyNamePair(loginRequest.getRoleID(), ""));
|
||||||
|
|
||||||
|
@ -146,7 +146,7 @@ public class AbstractService {
|
||||||
if (error != null && error.length() > 0)
|
if (error != null && error.length() > 0)
|
||||||
return error;
|
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()))
|
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();
|
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)
|
if(ret!=null && ret.length()>0)
|
||||||
return ret;
|
return ret;
|
||||||
|
|
||||||
|
@ -177,7 +177,7 @@ public class AbstractService {
|
||||||
|
|
||||||
HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
|
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())
|
if (m_webservice == null || !m_webservice.isActive())
|
||||||
return "Web Service " + webServiceValue + " not registered";
|
return "Web Service " + webServiceValue + " not registered";
|
||||||
|
|
||||||
|
@ -192,13 +192,13 @@ public class AbstractService {
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
try {
|
try {
|
||||||
pstmt = DB.prepareStatement(sql, null);
|
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(2, m_webservice.getWS_WebService_ID());
|
||||||
pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID());
|
pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID());
|
||||||
pstmt.setString(4, serviceTypeValue);
|
pstmt.setString(4, serviceTypeValue);
|
||||||
rs = pstmt.executeQuery();
|
rs = pstmt.executeQuery();
|
||||||
if (rs.next())
|
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) {
|
} catch (Exception e) {
|
||||||
throw new IdempiereServiceFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName(
|
throw new IdempiereServiceFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName(
|
||||||
"authenticate"));
|
"authenticate"));
|
||||||
|
@ -213,7 +213,7 @@ public class AbstractService {
|
||||||
|
|
||||||
req.setAttribute("MWebServiceType", m_webservicetype);
|
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)
|
if(ret!=null && ret.length()>0)
|
||||||
return ret;
|
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() {
|
protected CompiereService getCompiereService() {
|
||||||
HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
|
HttpServletRequest req = (HttpServletRequest) ctx.getMessageContext().get(MessageContext.SERVLET_REQUEST);
|
||||||
HttpSession session = req.getSession();
|
CompiereService m_cs = (CompiereService) req.getAttribute(COMPIERE_SERVICE);
|
||||||
CompiereService m_cs = (CompiereService) session.getAttribute("CompiereServiceBean");
|
|
||||||
if (m_cs == null) {
|
if (m_cs == null) {
|
||||||
m_cs = new CompiereService();
|
m_cs = new CompiereService();
|
||||||
m_cs.connect();
|
req.setAttribute(COMPIERE_SERVICE, m_cs);
|
||||||
session.setAttribute("CompiereServiceBean", m_cs);
|
|
||||||
}
|
}
|
||||||
return m_cs;
|
return m_cs;
|
||||||
}
|
}
|
||||||
|
@ -394,10 +392,10 @@ public class AbstractService {
|
||||||
if (indDot == -1) {
|
if (indDot == -1) {
|
||||||
if (varName.charAt(0) == '#') {
|
if (varName.charAt(0) == '#') {
|
||||||
varName = varName.substring(1);
|
varName = varName.substring(1);
|
||||||
val = getCompiereService().getM_ctx().getProperty(varName);
|
val = getCompiereService().getCtx().getProperty(varName);
|
||||||
} else {
|
} else {
|
||||||
// If there is no table name, then it should be
|
// If there is no table name, then it should be
|
||||||
// premitive data type
|
// primitive data type
|
||||||
if (po != null && poInfo.getColumnIndex(varName)!=-1)
|
if (po != null && poInfo.getColumnIndex(varName)!=-1)
|
||||||
val = po.get_Value(varName);
|
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;
|
package org.idempiere.webservices;
|
||||||
|
|
||||||
import org.osgi.framework.BundleActivator;
|
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;
|
package org.idempiere.webservices;
|
||||||
|
|
||||||
import java.util.Map;
|
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.ADLoginRequest;
|
||||||
import org.idempiere.adInterface.x10.DataField;
|
import org.idempiere.adInterface.x10.DataField;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author deepak
|
||||||
|
*
|
||||||
|
*/
|
||||||
public interface IWSValidator {
|
public interface IWSValidator {
|
||||||
public static final int TIMING_BEFORE_PARSE=1;
|
public static final int TIMING_BEFORE_PARSE=1;
|
||||||
public static final int TIMING_AFTER_PARSE=2;
|
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_BEFORE_PROCESS=8;
|
||||||
public static final int TIMING_AFTER_PROCESS=9;
|
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;
|
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;
|
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;
|
package org.idempiere.webservices.fault;
|
||||||
|
|
||||||
import javax.xml.namespace.QName;
|
import javax.xml.namespace.QName;
|
||||||
|
|
Loading…
Reference in New Issue