IDEMPIERE-4344 : Add a ProcessFactory class to the org.idempiere.webs… (#133)

* IDEMPIERE-4344 : Add a ProcessFactory class to the org.idempiere.webservices package

* IDEMPIERE-4344 : Add a ProcessFactory class to the org.idempiere.webservices package

Changes recommanded by hengsin

Co-Authored-By: hengsin <hengsin@users.noreply.github.com>

Co-authored-by: hengsin <hengsin@users.noreply.github.com>
This commit is contained in:
Nicolas Micoud 2020-07-15 12:47:24 +02:00 committed by GitHub
parent fd475f0cac
commit 69256ca2a0
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 58 additions and 0 deletions

View File

@ -0,0 +1,9 @@
<?xml version="1.0" encoding="UTF-8"?>
<!DOCTYPE scr:component>
<scr:component xmlns:scr="http://www.osgi.org/xmlns/scr/v1.1.0" name="org.idempiere.webservices.process.WebServicesProcessFactory">
<implementation class="org.idempiere.webservices.process.WebServicesProcessFactory"/>
<property name="service.ranking" type="Integer" value="1"/>
<service>
<provide interface="org.adempiere.base.IProcessFactory"/>
</service>
</scr:component>

View File

@ -0,0 +1,49 @@
/**********************************************************************
* This file is part of iDempiere ERP Open Source *
* http://www.idempiere.org *
* *
* Copyright (C) Contributors *
* *
* This program is free software; you can redistribute it and/or *
* modify it under the terms of the GNU General Public License *
* as published by the Free Software Foundation; either version 2 *
* of the License, or (at your option) any later version. *
* *
* 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., 51 Franklin Street, Fifth Floor, Boston, *
* MA 02110-1301, USA. *
* *
* Contributors: *
* - Nicolas Micoud - TGI *
**********************************************************************/
package org.idempiere.webservices.process;
import org.adempiere.base.IProcessFactory;
import org.compiere.process.ProcessCall;
/**
* @author nmicoud - TGI
*
*/
public class WebServicesProcessFactory implements IProcessFactory {
public ProcessCall newProcessInstance(String className) {
ProcessCall process = null;
if (className.startsWith("org.idempiere.webservices.process")) {
try {
Class<?> clazz = getClass().getClassLoader().loadClass(className);
process = (ProcessCall) clazz.getDeclaredConstructor().newInstance();
} catch (Exception e) {
}
}
return process;
}
}