IDEMPIERE-1686 GenerateModel does not take commandline arguments
This commit is contained in:
parent
d75a1cb722
commit
036f065d70
|
@ -13,13 +13,18 @@
|
|||
*****************************************************************************/
|
||||
package org.adempiere.base;
|
||||
|
||||
import java.util.Map;
|
||||
|
||||
import org.adempiere.util.ModelClassGenerator;
|
||||
import org.adempiere.util.ModelGeneratorDialog;
|
||||
import org.adempiere.util.ModelInterfaceGenerator;
|
||||
import org.compiere.Adempiere;
|
||||
import org.eclipse.equinox.app.IApplication;
|
||||
import org.eclipse.equinox.app.IApplicationContext;
|
||||
|
||||
/**
|
||||
* @author hengsin
|
||||
* @author tbayen - command line start
|
||||
*
|
||||
*/
|
||||
public class ModelGeneratorApplication implements IApplication {
|
||||
|
@ -30,11 +35,25 @@ public class ModelGeneratorApplication implements IApplication {
|
|||
@Override
|
||||
public Object start(IApplicationContext context) throws Exception {
|
||||
Adempiere.startup(false);
|
||||
Map<?, ?> args = context.getArguments();
|
||||
// IDEMPIERE-1686 - GenerateModel does not take commandline arguments
|
||||
String commandlineArgs[] = (String[]) args.get("application.args");
|
||||
if (commandlineArgs.length == 4) {
|
||||
String folder = commandlineArgs[0];
|
||||
String packageName = commandlineArgs[1];
|
||||
String entityType = commandlineArgs[2];
|
||||
String tableName = commandlineArgs[3];
|
||||
ModelInterfaceGenerator.generateSource(folder, packageName, entityType, tableName);
|
||||
ModelClassGenerator.generateSource(folder, packageName, entityType, tableName);
|
||||
} else if (commandlineArgs.length != 0) {
|
||||
System.out.println("usage: ModelGenerator folder packageName entityType tableName");
|
||||
} else {
|
||||
ModelGeneratorDialog dialog = new ModelGeneratorDialog();
|
||||
dialog.setModal(true);
|
||||
dialog.pack();
|
||||
dialog.setLocationRelativeTo(null);
|
||||
dialog.setVisible(true);
|
||||
}
|
||||
return IApplication.EXIT_OK;
|
||||
}
|
||||
|
||||
|
|
|
@ -901,7 +901,11 @@ public class ModelClassGenerator
|
|||
.append("WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')") // special views
|
||||
.append(" OR IsView='N')")
|
||||
.append(" AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
|
||||
// Autodetect if we need to use IN or LIKE clause - teo_sarca [ 3020640 ]
|
||||
if (tableLike.indexOf(",") == -1)
|
||||
sql.append(" AND TableName LIKE ").append(tableLike);
|
||||
else
|
||||
sql.append(" AND TableName IN (").append(tableLike).append(")"); // only specific tables
|
||||
sql.append(" AND ").append(entityTypeFilter.toString());
|
||||
sql.append(" ORDER BY TableName");
|
||||
|
||||
|
|
|
@ -823,7 +823,11 @@ public class ModelInterfaceGenerator
|
|||
.append("WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')") // special views
|
||||
.append(" OR IsView='N')")
|
||||
.append(" AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' ");
|
||||
// Autodetect if we need to use IN or LIKE clause - teo_sarca [ 3020640 ]
|
||||
if (tableLike.indexOf(",") == -1)
|
||||
sql.append(" AND TableName LIKE ").append(tableLike);
|
||||
else
|
||||
sql.append(" AND TableName IN (").append(tableLike).append(")"); // only specific tables
|
||||
sql.append(" AND ").append(entityTypeFilter.toString());
|
||||
sql.append(" ORDER BY TableName");
|
||||
|
||||
|
|
Loading…
Reference in New Issue