hg merge release-6.1 (merge release6.1 into default)

This commit is contained in:
Carlos Ruiz 2018-12-26 17:19:01 +01:00
parent 18f789b57c
commit 50943b09dd
1 changed files with 10 additions and 24 deletions

View File

@ -14,8 +14,6 @@
package org.idempiere.webservices; package org.idempiere.webservices;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.sql.Timestamp; import java.sql.Timestamp;
import java.util.ArrayList; import java.util.ArrayList;
import java.util.HashMap; import java.util.HashMap;
@ -40,6 +38,7 @@ import org.compiere.model.MWebService;
import org.compiere.model.MWebServiceType; import org.compiere.model.MWebServiceType;
import org.compiere.model.PO; import org.compiere.model.PO;
import org.compiere.model.POInfo; import org.compiere.model.POInfo;
import org.compiere.model.Query;
import org.compiere.model.X_WS_WebServiceMethod; import org.compiere.model.X_WS_WebServiceMethod;
import org.compiere.model.X_WS_WebServiceTypeAccess; import org.compiere.model.X_WS_WebServiceTypeAccess;
import org.compiere.util.CCache; import org.compiere.util.CCache;
@ -234,28 +233,15 @@ public class AbstractService {
synchronized (s_WebServiceTypeCache) { synchronized (s_WebServiceTypeCache) {
m_webservicetype = s_WebServiceTypeCache.get(key); m_webservicetype = s_WebServiceTypeCache.get(key);
if (m_webservicetype == null) { if (m_webservicetype == null) {
final String sql = "SELECT * FROM WS_WebServiceType " + "WHERE AD_Client_ID=? " + "AND WS_WebService_ID=? " m_webservicetype = new Query(m_cs.getCtx(), MWebServiceType.Table_Name,
+ "AND WS_WebServiceMethod_ID=? " + "AND Value=? " + "AND IsActive='Y'"; "AD_Client_ID IN (0,?) AND WS_WebService_ID=? AND WS_WebServiceMethod_ID=? AND Value=?",
PreparedStatement pstmt = null; null)
ResultSet rs = null; .setOnlyActiveRecords(true)
try { .setParameters(m_cs.getAD_Client_ID(), m_webservice.getWS_WebService_ID(), m_webservicemethod.getWS_WebServiceMethod_ID(), serviceTypeValue)
pstmt = DB.prepareStatement(sql, null); .setOrderBy("AD_Client_ID DESC") // IDEMPIERE-3394 give precedence to tenant defined if there are system+tenant
pstmt.setInt(1, m_cs.getAD_Client_ID()); .first();
pstmt.setInt(2, m_webservice.getWS_WebService_ID()); if (m_webservicetype != null) {
pstmt.setInt(3, m_webservicemethod.getWS_WebServiceMethod_ID()); s_WebServiceTypeCache.put(key, m_webservicetype);
pstmt.setString(4, serviceTypeValue);
rs = pstmt.executeQuery();
if (rs.next()) {
m_webservicetype = new MWebServiceType(m_cs.getCtx(), rs, null);
s_WebServiceTypeCache.put(key, m_webservicetype);
}
} catch (Exception e) {
throw new IdempiereServiceFault(e.getClass().toString() + " " + e.getMessage() + " sql=" + sql, e.getCause(), new QName(
"authenticate"));
} finally {
DB.close(rs, pstmt);
rs = null;
pstmt = null;
} }
} }
} }