From 69256ca2a0a5e6c551ea83c435a5826e8a4352e2 Mon Sep 17 00:00:00 2001 From: Nicolas Micoud <58596990+nmicoud@users.noreply.github.com> Date: Wed, 15 Jul 2020 12:47:24 +0200 Subject: [PATCH] =?UTF-8?q?IDEMPIERE-4344=20:=20Add=20a=20ProcessFactory?= =?UTF-8?q?=20class=20to=20the=20org.idempiere.webs=E2=80=A6=20(#133)?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit * 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 Co-authored-by: hengsin --- .../OSGI-INF/wsprocessfactory.xml | 9 ++++ .../process/WebServicesProcessFactory.java | 49 +++++++++++++++++++ 2 files changed, 58 insertions(+) create mode 100644 org.idempiere.webservices/OSGI-INF/wsprocessfactory.xml create mode 100644 org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/process/WebServicesProcessFactory.java diff --git a/org.idempiere.webservices/OSGI-INF/wsprocessfactory.xml b/org.idempiere.webservices/OSGI-INF/wsprocessfactory.xml new file mode 100644 index 0000000000..fd4bc6faf2 --- /dev/null +++ b/org.idempiere.webservices/OSGI-INF/wsprocessfactory.xml @@ -0,0 +1,9 @@ + + + + + + + + + diff --git a/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/process/WebServicesProcessFactory.java b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/process/WebServicesProcessFactory.java new file mode 100644 index 0000000000..3d6795ac68 --- /dev/null +++ b/org.idempiere.webservices/WEB-INF/src/org/idempiere/webservices/process/WebServicesProcessFactory.java @@ -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; + } +} \ No newline at end of file