IDEMPIERE-4339 Web Services : Automatically fill records on Parameters table (#175)
peer review and tests
This commit is contained in:
parent
b473111bab
commit
087b6e62d0
|
@ -0,0 +1,26 @@
|
||||||
|
SET SQLBLANKLINES ON
|
||||||
|
SET DEFINE OFF
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:03:05 AM CEST
|
||||||
|
UPDATE AD_Process SET Name='Create Default Parameters',Updated=TO_DATE('2020-07-21 11:03:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200119
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:03:20 AM CEST
|
||||||
|
UPDATE AD_Element SET Name='Create Default Parameters', PrintName='Create Default Parameters',Updated=TO_DATE('2020-07-21 11:03:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=203423
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:03:20 AM CEST
|
||||||
|
UPDATE AD_Column SET ColumnName='InsertParameters', Name='Create Default Parameters', Description=NULL, Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203423
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:03:20 AM CEST
|
||||||
|
UPDATE AD_Field SET Name='Create Default Parameters', Description=NULL, Help=NULL, Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=203423) AND IsCentrallyMaintained='Y'
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:22:14 AM CEST
|
||||||
|
UPDATE AD_Field SET DisplayLogic='@WS_WebService_ID.Value@=''ModelADService''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_DATE('2020-07-21 11:22:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206417
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('202007211126_IDEMPIERE-4339_PR.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -0,0 +1,23 @@
|
||||||
|
-- Jul 21, 2020, 11:03:05 AM CEST
|
||||||
|
UPDATE AD_Process SET Name='Create Default Parameters',Updated=TO_TIMESTAMP('2020-07-21 11:03:05','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Process_ID=200119
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:03:20 AM CEST
|
||||||
|
UPDATE AD_Element SET Name='Create Default Parameters', PrintName='Create Default Parameters',Updated=TO_TIMESTAMP('2020-07-21 11:03:20','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Element_ID=203423
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:03:20 AM CEST
|
||||||
|
UPDATE AD_Column SET ColumnName='InsertParameters', Name='Create Default Parameters', Description=NULL, Help=NULL, Placeholder=NULL WHERE AD_Element_ID=203423
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:03:20 AM CEST
|
||||||
|
UPDATE AD_Field SET Name='Create Default Parameters', Description=NULL, Help=NULL, Placeholder=NULL WHERE AD_Column_ID IN (SELECT AD_Column_ID FROM AD_Column WHERE AD_Element_ID=203423) AND IsCentrallyMaintained='Y'
|
||||||
|
;
|
||||||
|
|
||||||
|
-- Jul 21, 2020, 11:22:14 AM CEST
|
||||||
|
UPDATE AD_Field SET DisplayLogic='@WS_WebService_ID.Value@=''ModelADService''', AD_Reference_Value_ID=NULL, AD_Val_Rule_ID=NULL, IsToolbarButton=NULL,Updated=TO_TIMESTAMP('2020-07-21 11:22:14','YYYY-MM-DD HH24:MI:SS'),UpdatedBy=100 WHERE AD_Field_ID=206417
|
||||||
|
;
|
||||||
|
|
||||||
|
SELECT register_migration_script('202007211126_IDEMPIERE-4339_PR.sql') FROM dual
|
||||||
|
;
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class MWebServiceType extends X_WS_WebServiceType
|
||||||
/**
|
/**
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
private static final long serialVersionUID = 7216001796414414950L;
|
private static final long serialVersionUID = -2713868996404459577L;
|
||||||
|
|
||||||
/** Parameters */
|
/** Parameters */
|
||||||
private MWebServicePara[] m_para = null;
|
private MWebServicePara[] m_para = null;
|
||||||
|
@ -287,20 +287,20 @@ public class MWebServiceType extends X_WS_WebServiceType
|
||||||
return m_inputFieldMap.get(colName);
|
return m_inputFieldMap.get(colName);
|
||||||
}
|
}
|
||||||
|
|
||||||
public static void insertParameters (Properties ctx, MWebServiceType ws, String trxName) {
|
public void insertParameters() {
|
||||||
|
|
||||||
if ("ModelADService".equals(ws.getWS_WebService().getValue())) {
|
MWebService ws = MWebService.get(getCtx(), getWS_WebService_ID());
|
||||||
String method = ws.getWS_WebServiceMethod().getValue();
|
if (ws != null && "ModelADService".equals(ws.getValue())) {
|
||||||
|
X_WS_WebServiceMethod wsm = new X_WS_WebServiceMethod(getCtx(), getWS_WebServiceMethod_ID(), get_TrxName());
|
||||||
|
String method = wsm.getValue();
|
||||||
|
|
||||||
if ("getList".equals(method)) {
|
if ("getList".equals(method)) {
|
||||||
ws.addWsParameter("AD_Reference_ID", X_WS_WebService_Para.PARAMETERTYPE_Free, "");
|
addWsParameter("AD_Reference_ID", X_WS_WebService_Para.PARAMETERTYPE_Free, "");
|
||||||
}
|
} else if ("runProcess".equals(method)) {
|
||||||
else if ("runProcess".equals(method)) {
|
addWsParameter("AD_Process_ID", X_WS_WebService_Para.PARAMETERTYPE_Constant, ""); // can't fill it as the process is unknown
|
||||||
ws.addWsParameter("AD_Process_ID", X_WS_WebService_Para.PARAMETERTYPE_Constant, ""); // can't fill it as the process is unknown
|
addWsParameter("AD_Menu_ID", X_WS_WebService_Para.PARAMETERTYPE_Constant, "0");
|
||||||
ws.addWsParameter("AD_Menu_ID", X_WS_WebService_Para.PARAMETERTYPE_Constant, "0");
|
addWsParameter("AD_Record_ID", X_WS_WebService_Para.PARAMETERTYPE_Free, "");
|
||||||
ws.addWsParameter("AD_Record_ID", X_WS_WebService_Para.PARAMETERTYPE_Free, "");
|
} else {
|
||||||
}
|
|
||||||
else {
|
|
||||||
String value = "";
|
String value = "";
|
||||||
if ("createData".equals(method))
|
if ("createData".equals(method))
|
||||||
value = "Create";
|
value = "Create";
|
||||||
|
@ -313,9 +313,9 @@ public class MWebServiceType extends X_WS_WebServiceType
|
||||||
else if ("updateData".equals(method))
|
else if ("updateData".equals(method))
|
||||||
value = "Update";
|
value = "Update";
|
||||||
|
|
||||||
ws.addWsParameter("TableName", X_WS_WebService_Para.PARAMETERTYPE_Constant, MTable.get(ctx, ws.getAD_Table_ID()).getTableName());
|
addWsParameter("TableName", X_WS_WebService_Para.PARAMETERTYPE_Constant, MTable.get(getCtx(), getAD_Table_ID()).getTableName());
|
||||||
ws.addWsParameter("Action", X_WS_WebService_Para.PARAMETERTYPE_Constant, value);
|
addWsParameter("Action", X_WS_WebService_Para.PARAMETERTYPE_Constant, value);
|
||||||
ws.addWsParameter("RecordID", X_WS_WebService_Para.PARAMETERTYPE_Free, "");
|
addWsParameter("RecordID", X_WS_WebService_Para.PARAMETERTYPE_Free, "");
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -33,19 +33,24 @@ import org.compiere.process.SvrProcess;
|
||||||
*/
|
*/
|
||||||
public class WebServiceTypeCreateParameters extends SvrProcess {
|
public class WebServiceTypeCreateParameters extends SvrProcess {
|
||||||
|
|
||||||
|
// The web service type (record on screen)
|
||||||
|
private int p_WS_WebServiceType_ID;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Prepare - e.g., get Parameters.
|
* Prepare - e.g., get Parameters.
|
||||||
*/
|
*/
|
||||||
protected void prepare() {}
|
protected void prepare() {
|
||||||
|
p_WS_WebServiceType_ID = getRecord_ID();
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Perform process.
|
* Perform process.
|
||||||
* @return Message
|
* @return Message
|
||||||
* @throws Exception
|
* @throws Exception
|
||||||
*/
|
*/
|
||||||
protected String doIt() throws Exception
|
protected String doIt() throws Exception {
|
||||||
{
|
MWebServiceType ws = new MWebServiceType(getCtx(), p_WS_WebServiceType_ID, get_TrxName());
|
||||||
MWebServiceType.insertParameters(getCtx(), new MWebServiceType(getCtx(), getRecord_ID(), get_TrxName()), get_TrxName());
|
ws.insertParameters();
|
||||||
return "@ProcessOK@";
|
return "@ProcessOK@";
|
||||||
} // doIt
|
} // doIt
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue