diff --git a/org.adempiere.base-feature/packinfolder.app.launch b/org.adempiere.base-feature/packinfolder.app.launch new file mode 100644 index 0000000000..70d4457fd7 --- /dev/null +++ b/org.adempiere.base-feature/packinfolder.app.launch @@ -0,0 +1,33 @@ + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + diff --git a/org.adempiere.base/plugin.xml b/org.adempiere.base/plugin.xml index 0779342114..6aa93bd88f 100644 --- a/org.adempiere.base/plugin.xml +++ b/org.adempiere.base/plugin.xml @@ -128,4 +128,16 @@ + + + + + + diff --git a/org.adempiere.base/src/org/adempiere/base/PackInFolderApplication.java b/org.adempiere.base/src/org/adempiere/base/PackInFolderApplication.java new file mode 100644 index 0000000000..880b0450ce --- /dev/null +++ b/org.adempiere.base/src/org/adempiere/base/PackInFolderApplication.java @@ -0,0 +1,88 @@ +/*********************************************************************** + * 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: * + * - Carlos Ruiz (sponsored by FH) * + **********************************************************************/ +package org.adempiere.base; + +import java.util.Map; +import java.util.Properties; +import java.util.logging.Level; + +import org.compiere.Adempiere; +import org.compiere.model.MPInstance; +import org.compiere.process.ProcessCall; +import org.compiere.process.ProcessInfo; +import org.compiere.util.CLogMgt; +import org.compiere.util.Env; +import org.eclipse.equinox.app.IApplication; +import org.eclipse.equinox.app.IApplicationContext; + +/** + * @author Carlos Ruiz (globalqss) + * + */ +public class PackInFolderApplication implements IApplication { + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#start(org.eclipse.equinox.app.IApplicationContext) + */ + @Override + public Object start(IApplicationContext context) throws Exception { + Adempiere.startup(false); + CLogMgt.setLevel(Level.FINE); + + Map args = context.getArguments(); + String commandlineArgs[] = (String[]) args.get("application.args"); + if (commandlineArgs.length == 1) { + Properties ctx = Env.getCtx(); + String directory = commandlineArgs[0]; + ProcessInfo pi = new ProcessInfo("PackInFolder", 200099); + pi.setAD_Client_ID(0); + pi.setAD_User_ID(100); + MPInstance instance = new MPInstance(ctx, 200099, 0); + instance.saveEx(); + instance.createParameter(10, "Folder", directory); + pi.setAD_PInstance_ID(instance.getAD_PInstance_ID()); + ProcessCall process = Core.getProcess("org.adempiere.pipo2.PackInFolder"); + process.startProcess(ctx, pi, null); + StringBuilder msgout = new StringBuilder("Process=").append(pi.getTitle()) + .append(" Error=").append(pi.isError()).append(" Summary=") + .append(pi.getSummary()); + System.out.println(msgout.toString()); + } else { + System.out.println("Apply PackIn from Folder usage:"); + System.out.println("RUN_ApplyPackInFromFolder.sh folder"); + } + + + return IApplication.EXIT_OK; + } + + /* (non-Javadoc) + * @see org.eclipse.equinox.app.IApplication#stop() + */ + @Override + public void stop() { + } + +} diff --git a/org.adempiere.server-feature/utils.unix/RUN_ApplyPackInFromFolder.sh b/org.adempiere.server-feature/utils.unix/RUN_ApplyPackInFromFolder.sh new file mode 100644 index 0000000000..a537dd141b --- /dev/null +++ b/org.adempiere.server-feature/utils.unix/RUN_ApplyPackInFromFolder.sh @@ -0,0 +1,35 @@ +#!/bin/sh + +if [ $IDEMPIERE_HOME ]; then + cd $IDEMPIERE_HOME/utils +else + cd "`dirname $0`" +fi +. ./myEnvironment.sh Server + +if [ $JAVA_HOME ]; then + JAVA=$JAVA_HOME/bin/java +else + JAVA=java +fi + +# $Id: RUN_ApplyPackInFromFolder.sh +echo Apply PackIn from Folder - $IDEMPIERE_HOME \($ADEMPIERE_DB_NAME\) + +if [ $# -eq 1 ] +then + export DIRECTORY=$1 +else + echo "Usage: $0 folder" + exit 1 +fi + +cd .. + +echo This Procedure import packin files from directory $DIRECTORY + +$JAVA -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=false -jar plugins/org.eclipse.equinox.launcher_1.*.jar -application org.adempiere.base.PackInFolderApplication $DIRECTORY + +echo Done +echo . +echo For problems, check log file in base directory diff --git a/org.adempiere.server-feature/utils.windows/RUN_ApplyPackInFromFolder.bat b/org.adempiere.server-feature/utils.windows/RUN_ApplyPackInFromFolder.bat new file mode 100644 index 0000000000..43e23c1d7d --- /dev/null +++ b/org.adempiere.server-feature/utils.windows/RUN_ApplyPackInFromFolder.bat @@ -0,0 +1,14 @@ +@Rem $Id: RUN_ApplyPackInFromFolder.bat + +@if (%IDEMPIERE_HOME%) == () (CALL myEnvironment.bat Server) else (CALL %IDEMPIERE_HOME%\utils\myEnvironment.bat Server) +@Title Import Translation - %IDEMPIERE_HOME% (%ADEMPIERE_DB_NAME%) + +@SET DIRECTORY=%1 + +@echo This Procedure import packin files from directory %DIRECTORY% +@pause + +FOR %%c in (plugins\org.eclipse.equinox.launcher_1.*.jar) DO set JARFILE=%%c +@"%JAVA_HOME%\bin\java" -Dosgi.compatibility.bootdelegation=true -Dosgi.noShutdown=false -jar %JARFILE% -application org.adempiere.base.PackInFolderApplication %DIRECTORY% + +@pause