IDEMPIERE-4980 Update model factory of org.idempiere.webservices (#899)
This commit is contained in:
parent
557c483fc9
commit
338fecb344
|
@ -27,7 +27,8 @@ Require-Bundle: org.adempiere.base;bundle-version="9.0.0",
|
||||||
org.adempiere.base.callout;bundle-version="9.0.0",
|
org.adempiere.base.callout;bundle-version="9.0.0",
|
||||||
org.adempiere.base.process;bundle-version="9.0.0",
|
org.adempiere.base.process;bundle-version="9.0.0",
|
||||||
org.adempiere.payment.processor;bundle-version="9.0.0",
|
org.adempiere.payment.processor;bundle-version="9.0.0",
|
||||||
org.compiere.db.postgresql.provider;bundle-version="9.0.0"
|
org.compiere.db.postgresql.provider;bundle-version="9.0.0",
|
||||||
|
org.idempiere.webservices;bundle-version="9.0.0"
|
||||||
Bundle-ActivationPolicy: lazy
|
Bundle-ActivationPolicy: lazy
|
||||||
Bundle-Activator: org.idempiere.test.TestActivator
|
Bundle-Activator: org.idempiere.test.TestActivator
|
||||||
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
Bundle-RequiredExecutionEnvironment: JavaSE-11
|
||||||
|
|
|
@ -344,6 +344,7 @@
|
||||||
<setEntry value="org.compiere.db.postgresql.provider@default:default"/>
|
<setEntry value="org.compiere.db.postgresql.provider@default:default"/>
|
||||||
<setEntry value="org.idempiere.hazelcast.service@default:default"/>
|
<setEntry value="org.idempiere.hazelcast.service@default:default"/>
|
||||||
<setEntry value="org.idempiere.test@default:default"/>
|
<setEntry value="org.idempiere.test@default:default"/>
|
||||||
|
<setEntry value="org.idempiere.webservices@default:default"/>
|
||||||
</setAttribute>
|
</setAttribute>
|
||||||
<booleanAttribute key="show_selected_only" value="false"/>
|
<booleanAttribute key="show_selected_only" value="false"/>
|
||||||
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
|
<stringAttribute key="templateConfig" value="${target_home}/configuration/config.ini"/>
|
||||||
|
|
|
@ -67,6 +67,7 @@ Import-Package: javax.activation,
|
||||||
org.apache.xerces.xs.datatypes;version="2.9.0",
|
org.apache.xerces.xs.datatypes;version="2.9.0",
|
||||||
org.apache.xml.serialize;version="2.9.0",
|
org.apache.xml.serialize;version="2.9.0",
|
||||||
org.osgi.framework;version="1.6.0",
|
org.osgi.framework;version="1.6.0",
|
||||||
|
org.osgi.service.component.annotations;version="1.3.0",
|
||||||
org.w3c.dom
|
org.w3c.dom
|
||||||
Require-Bundle: org.adempiere.base;bundle-version="0.0.0",
|
Require-Bundle: org.adempiere.base;bundle-version="0.0.0",
|
||||||
org.adempiere.ui;bundle-version="0.0.0",
|
org.adempiere.ui;bundle-version="0.0.0",
|
||||||
|
|
|
@ -1,8 +1,8 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.compiere.model.WS_ModelFactory">
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.compiere.model.WS_ModelFactory">
|
||||||
<implementation class="org.compiere.model.WS_ModelFactory"/>
|
<property name="service.ranking" type="Integer" value="1"/>
|
||||||
<property name="service.ranking" type="Integer" value="5"/>
|
|
||||||
<service>
|
<service>
|
||||||
<provide interface="org.adempiere.base.IModelFactory"/>
|
<provide interface="org.adempiere.base.IModelFactory"/>
|
||||||
</service>
|
</service>
|
||||||
|
<implementation class="org.compiere.model.WS_ModelFactory"/>
|
||||||
</scr:component>
|
</scr:component>
|
|
@ -1,6 +1,6 @@
|
||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<!DOCTYPE scr:component>
|
<!DOCTYPE scr:component>
|
||||||
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.webservices.process.WebServicesProcessFactory">
|
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" immediate="true" name="org.idempiere.webservices.process.WebServicesProcessFactory">
|
||||||
<implementation class="org.idempiere.webservices.process.WebServicesProcessFactory"/>
|
<implementation class="org.idempiere.webservices.process.WebServicesProcessFactory"/>
|
||||||
<property name="service.ranking" type="Integer" value="1"/>
|
<property name="service.ranking" type="Integer" value="1"/>
|
||||||
<service>
|
<service>
|
||||||
|
|
|
@ -47,6 +47,7 @@ import org.idempiere.cache.ImmutablePOSupport;
|
||||||
*
|
*
|
||||||
* @author Carlos Ruiz
|
* @author Carlos Ruiz
|
||||||
*/
|
*/
|
||||||
|
@org.adempiere.base.Model(table = X_WS_WebService.Table_Name)
|
||||||
public class MWebService extends X_WS_WebService implements ImmutablePOSupport
|
public class MWebService extends X_WS_WebService implements ImmutablePOSupport
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -35,6 +35,7 @@ import org.idempiere.cache.ImmutablePOSupport;
|
||||||
* @author hengsin
|
* @author hengsin
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
@org.adempiere.base.Model(table = X_WS_WebServiceMethod.Table_Name)
|
||||||
public class MWebServiceMethod extends X_WS_WebServiceMethod implements ImmutablePOSupport {
|
public class MWebServiceMethod extends X_WS_WebServiceMethod implements ImmutablePOSupport {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -39,6 +39,7 @@ import org.compiere.util.Env;
|
||||||
*
|
*
|
||||||
* @author Carlos Ruiz
|
* @author Carlos Ruiz
|
||||||
*/
|
*/
|
||||||
|
@org.adempiere.base.Model(table = X_WS_WebService_Para.Table_Name)
|
||||||
public class MWebServicePara extends X_WS_WebService_Para
|
public class MWebServicePara extends X_WS_WebService_Para
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -48,6 +48,7 @@ import org.idempiere.cache.ImmutablePOSupport;
|
||||||
* @author Carlos Ruiz
|
* @author Carlos Ruiz
|
||||||
* @author Deepak Pansheriya - Updated to support CreateUpdate service
|
* @author Deepak Pansheriya - Updated to support CreateUpdate service
|
||||||
*/
|
*/
|
||||||
|
@org.adempiere.base.Model(table = X_WS_WebServiceType.Table_Name)
|
||||||
public class MWebServiceType extends X_WS_WebServiceType implements ImmutablePOSupport
|
public class MWebServiceType extends X_WS_WebServiceType implements ImmutablePOSupport
|
||||||
{
|
{
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -25,50 +25,22 @@
|
||||||
|
|
||||||
package org.compiere.model;
|
package org.compiere.model;
|
||||||
|
|
||||||
import java.sql.ResultSet;
|
import org.adempiere.base.AnnotationBasedModelFactory;
|
||||||
|
|
||||||
import org.adempiere.base.IModelFactory;
|
import org.adempiere.base.IModelFactory;
|
||||||
import org.compiere.util.Env;
|
import org.osgi.service.component.annotations.Component;
|
||||||
|
|
||||||
public class WS_ModelFactory implements IModelFactory {
|
/**
|
||||||
|
*
|
||||||
|
* @author globalqss
|
||||||
|
* @author hengsin
|
||||||
|
*
|
||||||
|
*/
|
||||||
|
@Component(immediate = true, service = IModelFactory.class, property = "service.ranking:Integer=1")
|
||||||
|
public class WS_ModelFactory extends AnnotationBasedModelFactory {
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Class<?> getClass(String tableName) {
|
protected String[] getPackages() {
|
||||||
if (X_WS_WebService_Para.Table_Name.equals(tableName))
|
return new String[] {MWebService.class.getPackageName()};
|
||||||
return MWebServicePara.class;
|
|
||||||
if (X_WS_WebServiceType.Table_Name.equals(tableName))
|
|
||||||
return MWebServiceType.class;
|
|
||||||
if (X_WS_WebService.Table_Name.equals(tableName))
|
|
||||||
return MWebService.class;
|
|
||||||
if (MWebServiceMethod.Table_Name.equals(tableName))
|
|
||||||
return MWebServiceMethod.class;
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PO getPO(String tableName, int Record_ID, String trxName) {
|
|
||||||
if (X_WS_WebService_Para.Table_Name.equals(tableName))
|
|
||||||
return new MWebServicePara(Env.getCtx(), Record_ID, trxName);
|
|
||||||
if (X_WS_WebServiceType.Table_Name.equals(tableName))
|
|
||||||
return new MWebServiceType(Env.getCtx(), Record_ID, trxName);
|
|
||||||
if (X_WS_WebService.Table_Name.equals(tableName))
|
|
||||||
return new MWebService(Env.getCtx(), Record_ID, trxName);
|
|
||||||
if (MWebServiceMethod.Table_Name.equals(tableName))
|
|
||||||
return new MWebServiceMethod(Env.getCtx(), Record_ID, trxName);
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public PO getPO(String tableName, ResultSet rs, String trxName) {
|
|
||||||
if (X_WS_WebService_Para.Table_Name.equals(tableName))
|
|
||||||
return new MWebServicePara(Env.getCtx(), rs, trxName);
|
|
||||||
if (X_WS_WebServiceType.Table_Name.equals(tableName))
|
|
||||||
return new MWebServiceType(Env.getCtx(), rs, trxName);
|
|
||||||
if (X_WS_WebService.Table_Name.equals(tableName))
|
|
||||||
return new MWebService(Env.getCtx(), rs, trxName);
|
|
||||||
if (MWebServiceMethod.Table_Name.equals(tableName))
|
|
||||||
return new MWebServiceMethod(Env.getCtx(), rs, trxName);
|
|
||||||
return null;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,59 @@
|
||||||
|
{
|
||||||
|
"id": "b633c534-ed2b-449e-88b9-69d8cbf74498",
|
||||||
|
"name": "https://localhost:8443 WebService",
|
||||||
|
"values": [
|
||||||
|
{
|
||||||
|
"key": "protocol",
|
||||||
|
"value": "https",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "host",
|
||||||
|
"value": "localhost",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "port",
|
||||||
|
"value": "8443",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "userName",
|
||||||
|
"value": "WebService",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "password",
|
||||||
|
"value": "WebService",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "clientId",
|
||||||
|
"value": "11",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "roleId",
|
||||||
|
"value": "50004",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "organizationId",
|
||||||
|
"value": "11",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "warehouseId",
|
||||||
|
"value": "103",
|
||||||
|
"enabled": true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "language",
|
||||||
|
"value": "en_US",
|
||||||
|
"enabled": true
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"_postman_variable_scope": "environment",
|
||||||
|
"_postman_exported_at": "2021-09-14T11:48:44.727Z",
|
||||||
|
"_postman_exported_using": "Postman/8.12.1"
|
||||||
|
}
|
|
@ -0,0 +1,52 @@
|
||||||
|
{
|
||||||
|
"info": {
|
||||||
|
"_postman_id": "1223b193-dce3-405c-8cf5-be7ba996bbe2",
|
||||||
|
"name": "idempiere-soap-as-rest",
|
||||||
|
"schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
|
||||||
|
},
|
||||||
|
"item": [
|
||||||
|
{
|
||||||
|
"name": "query_data",
|
||||||
|
"request": {
|
||||||
|
"method": "POST",
|
||||||
|
"header": [
|
||||||
|
{
|
||||||
|
"key": "Accept",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "text"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
"key": "Content-Type",
|
||||||
|
"value": "application/json",
|
||||||
|
"type": "text"
|
||||||
|
}
|
||||||
|
],
|
||||||
|
"body": {
|
||||||
|
"mode": "raw",
|
||||||
|
"raw": "{\n \"ModelCRUDRequest\": {\n \"ModelCRUD\": {\n \"serviceType\": \"QueryBPartner\",\n \"TableName\": \"C_BPartner\",\n \"Filter\": \"name < 'S'\",\n \"Action\": \"Read\",\n \"DataRow\": { //optional filter by column values\n \"field\": [\n {\n \"@column\": \"C_BP_Group_ID\",\n \"val\": \"103\"\n }\n ]\n }\n },\n \"ADLoginRequest\": {\n \"user\": \"{{userName}}\",\n \"pass\": \"{{password}}\",\n \"lang\": \"{{language}}\",\n \"ClientID\": \"{{clientId}}\",\n \"RoleID\": \"{{roleId}}\",\n \"OrgID\": \"{{organizationId}}\",\n \"WarehouseID\": \"{{warehouseId}}\",\n \"stage\": \"9\"\n }\n }\n}",
|
||||||
|
"options": {
|
||||||
|
"raw": {
|
||||||
|
"language": "json"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"url": {
|
||||||
|
"raw": "{{protocol}}://{{host}}:{{port}}/ADInterface/services/rest/model_adservice/query_data",
|
||||||
|
"protocol": "{{protocol}}",
|
||||||
|
"host": [
|
||||||
|
"{{host}}"
|
||||||
|
],
|
||||||
|
"port": "{{port}}",
|
||||||
|
"path": [
|
||||||
|
"ADInterface",
|
||||||
|
"services",
|
||||||
|
"rest",
|
||||||
|
"model_adservice",
|
||||||
|
"query_data"
|
||||||
|
]
|
||||||
|
}
|
||||||
|
},
|
||||||
|
"response": []
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
Loading…
Reference in New Issue