IDEMPIERE-2767 Web Services not working with UUID / peer review - implement the same for ModelGetList AD_Reference_ID
This commit is contained in:
parent
7e91d03ac0
commit
281912af45
|
@ -743,6 +743,9 @@ public final class MRole extends X_AD_Role
|
||||||
*/
|
*/
|
||||||
private void loadOrgAccessUser(ArrayList<OrgAccess> list)
|
private void loadOrgAccessUser(ArrayList<OrgAccess> list)
|
||||||
{
|
{
|
||||||
|
if (getAD_User_ID() == -1) {
|
||||||
|
log.severe("Trying to load Org Access from User but user has not been set");
|
||||||
|
}
|
||||||
PreparedStatement pstmt = null;
|
PreparedStatement pstmt = null;
|
||||||
ResultSet rs = null;
|
ResultSet rs = null;
|
||||||
String sql = "SELECT * FROM AD_User_OrgAccess "
|
String sql = "SELECT * FROM AD_User_OrgAccess "
|
||||||
|
@ -2784,6 +2787,7 @@ public final class MRole extends X_AD_Role
|
||||||
final int AD_User_ID = getAD_User_ID();
|
final int AD_User_ID = getAD_User_ID();
|
||||||
if (AD_User_ID < 0)
|
if (AD_User_ID < 0)
|
||||||
{
|
{
|
||||||
|
log.severe("Trying to load Child Roles but user has not been set");
|
||||||
//throw new IllegalStateException("AD_User_ID is not set");
|
//throw new IllegalStateException("AD_User_ID is not set");
|
||||||
return ;
|
return ;
|
||||||
}
|
}
|
||||||
|
@ -2819,6 +2823,7 @@ public final class MRole extends X_AD_Role
|
||||||
final int AD_User_ID = getAD_User_ID();
|
final int AD_User_ID = getAD_User_ID();
|
||||||
if (AD_User_ID < 0)
|
if (AD_User_ID < 0)
|
||||||
{
|
{
|
||||||
|
log.severe("Trying to load Substituted Roles but user has not been set");
|
||||||
//throw new IllegalStateException("AD_User_ID is not set");
|
//throw new IllegalStateException("AD_User_ID is not set");
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
|
|
|
@ -358,8 +358,8 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
String tableName = parameterName.substring(0, parameterName.length()-3);
|
String tableName = parameterName.substring(0, parameterName.length()-3);
|
||||||
StringBuilder sql = new StringBuilder("SELECT ");
|
StringBuilder sql = new StringBuilder("SELECT ");
|
||||||
sql.append(parameterName).append(" FROM ").append(tableName)
|
sql.append(parameterName).append(" FROM ").append(tableName)
|
||||||
.append(" WHERE ").append(tableName).append("_UU=").append(DB.TO_STRING(string));
|
.append(" WHERE ").append(tableName).append("_UU=?");
|
||||||
return DB.getSQLValue(null, sql.toString());
|
return DB.getSQLValue(null, sql.toString(), string);
|
||||||
}
|
}
|
||||||
|
|
||||||
Map<String, Object> requestCtx = getRequestCtx();
|
Map<String, Object> requestCtx = getRequestCtx();
|
||||||
|
@ -412,7 +412,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
// Validate parameters
|
// Validate parameters
|
||||||
try {
|
try {
|
||||||
modelRunProcess.setADMenuID(validateParameter("AD_Menu_ID", modelRunProcess.getADMenuID()));
|
modelRunProcess.setADMenuID(validateParameter("AD_Menu_ID", modelRunProcess.getADMenuID()));
|
||||||
} catch(XmlValueOutOfRangeException e) { // Catch the exception when the Process ID is not an Integer
|
} catch(XmlValueOutOfRangeException e) { // Catch the exception when the Menu ID is not an Integer
|
||||||
String menuUU = getUUIDValue(modelRunProcess.xgetADMenuID());
|
String menuUU = getUUIDValue(modelRunProcess.xgetADMenuID());
|
||||||
if (menuUU == null) {
|
if (menuUU == null) {
|
||||||
throw e;
|
throw e;
|
||||||
|
@ -484,7 +484,15 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
int roleid = reqlogin.getRoleID();
|
int roleid = reqlogin.getRoleID();
|
||||||
|
|
||||||
// Validate parameters
|
// Validate parameters
|
||||||
modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", modelGetList.getADReferenceID()));
|
try {
|
||||||
|
modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", modelGetList.getADReferenceID()));
|
||||||
|
} catch(XmlValueOutOfRangeException e) { // Catch the exception when the Reference ID is not an Integer
|
||||||
|
String refUU = getUUIDValue(modelGetList.xgetADReferenceID());
|
||||||
|
if (refUU == null) {
|
||||||
|
throw e;
|
||||||
|
}
|
||||||
|
modelGetList.setADReferenceID(validateParameter("AD_Reference_ID", 0, refUU));
|
||||||
|
}
|
||||||
modelGetList.setFilter(validateParameter("Filter", modelGetList.getFilter()));
|
modelGetList.setFilter(validateParameter("Filter", modelGetList.getFilter()));
|
||||||
|
|
||||||
int ref_id = modelGetList.getADReferenceID();
|
int ref_id = modelGetList.getADReferenceID();
|
||||||
|
@ -543,7 +551,7 @@ public class ModelADServiceImpl extends AbstractService implements ModelADServic
|
||||||
|
|
||||||
} else if (MReference.VALIDATIONTYPE_TableValidation.equals(ref.getValidationType())) {
|
} else if (MReference.VALIDATIONTYPE_TableValidation.equals(ref.getValidationType())) {
|
||||||
// Fill values from a reference table
|
// Fill values from a reference table
|
||||||
MRole role = new MRole(ctx, roleid, null);
|
MRole role = MRole.get(ctx, roleid);
|
||||||
MRefTable rt = MRefTable.get(ctx, ref_id);
|
MRefTable rt = MRefTable.get(ctx, ref_id);
|
||||||
if (rt == null || rt.get_ID() == 0)
|
if (rt == null || rt.get_ID() == 0)
|
||||||
throw new IdempiereServiceFault("Web service type "
|
throw new IdempiereServiceFault("Web service type "
|
||||||
|
|
|
@ -74,6 +74,12 @@ public class Process {
|
||||||
|
|
||||||
private static final CLogger log = CLogger.getCLogger(Process.class);
|
private static final CLogger log = CLogger.getCLogger(Process.class);
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param cs
|
||||||
|
* @param req
|
||||||
|
* @return
|
||||||
|
* @deprecated - method not used - will be deleted in future versions
|
||||||
|
*/
|
||||||
public static ProcessParamsDocument getProcessParams( CompiereService cs, GetProcessParamsDocument req )
|
public static ProcessParamsDocument getProcessParams( CompiereService cs, GetProcessParamsDocument req )
|
||||||
{
|
{
|
||||||
ProcessParamsDocument res = ProcessParamsDocument.Factory.newInstance();
|
ProcessParamsDocument res = ProcessParamsDocument.Factory.newInstance();
|
||||||
|
@ -193,11 +199,15 @@ public class Process {
|
||||||
RunProcessResponse r= res.addNewRunProcessResponse();
|
RunProcessResponse r= res.addNewRunProcessResponse();
|
||||||
|
|
||||||
RunProcess rp = req.getRunProcess();
|
RunProcess rp = req.getRunProcess();
|
||||||
|
int AD_Menu_ID = rp.getADMenuID();
|
||||||
int AD_Process_ID = rp.getADProcessID();
|
int AD_Process_ID = rp.getADProcessID();
|
||||||
int m_record_id = rp.getADRecordID();
|
int m_record_id = rp.getADRecordID();
|
||||||
|
|
||||||
MProcess process = MProcess.get (m_cs.getCtx() , AD_Process_ID);
|
MProcess process = null;
|
||||||
// need to check if Role can access
|
if (AD_Menu_ID <= 0 && AD_Process_ID > 0)
|
||||||
|
process = MProcess.get(m_cs.getCtx(), AD_Process_ID);
|
||||||
|
else if (AD_Menu_ID > 0 && AD_Process_ID <= 0)
|
||||||
|
process = MProcess.getFromMenu(m_cs.getCtx(), AD_Menu_ID);
|
||||||
if (process == null)
|
if (process == null)
|
||||||
{
|
{
|
||||||
r.setError("Process not found");
|
r.setError("Process not found");
|
||||||
|
|
Loading…
Reference in New Issue