public Object start(IApplicationContext ctx) throws Exception {
    log.info("Starting client");
    // A HOSTNAME VERIFIER THAT ACCEPTS EVERY HOSTS
    HostnameVerifier myhostnameverifier =
        new HostnameVerifier() {
          @Override
          public boolean verify(String urlHostName, SSLSession session) {
            return true;
          }
        };

    //
    // start restlet context
    context = new Context();
    context.getAttributes().put("sslContextFactory", new ClientSSLContextFactory());
    context.getAttributes().put("hostnameVerifier", myhostnameverifier);
    List<Protocol> list = new ArrayList<Protocol>();
    list.add(Protocol.HTTPS);
    Client client = new Client(context, list, HttpClientHelper.class.getName());
    context.setClientDispatcher(client);
    client.start();

    Adempiere.startup(true);
    org.compiere.AdempiereClient.main(new String[] {});
    return IApplication.EXIT_OK;
  }
 /**
  * *********************************************************************** Test
  *
  * @param args ignored
  */
 public static void main(String[] args) {
   Adempiere.startup(true);
   Env.setContext(Env.getCtx(), "#AD_Client_ID", 11);
   FormFrame ff = new FormFrame();
   ff.openForm(1111, "org.compiere.apps.form.VAttributeGrid", "Attribute Table");
   ff.pack();
   AEnv.showCenterScreen(ff);
 } //	main
Exemple #3
0
  public static void main(final String[] args) {

    Adempiere.startupEnvironment(false);
    Ini.setAdempiereHome(".");
    Ini.setProperty(Ini.P_LOGMIGRATIONSCRIPT, true);

    doIt();
  }
Exemple #4
0
  @BeforeClass
  public static void init() {
    final String username = System.getProperty("user.name");
    System.setProperty(
        "PropertyFile",
        new File(new File("../de.metas.endcustomer./"), "Adempiere.properties_" + username)
            .getAbsolutePath());
    org.compiere.Adempiere.startup(true);

    // Cleanup T_Query_Selection table
    DB.executeUpdateEx("delete from t_query_selection", new Object[0], ITrx.TRXNAME_None);
  }
 public static void main(String[] args) {
   Adempiere.startup(true);
   Ini.setProperty(Ini.P_UID, "SuperUser");
   Ini.setProperty(Ini.P_PWD, "System");
   Ini.setProperty(Ini.P_ROLE, "GardenWorld Admin");
   Ini.setProperty(Ini.P_CLIENT, "GardenWorld");
   Ini.setProperty(Ini.P_ORG, "HQ");
   Ini.setProperty(Ini.P_WAREHOUSE, "HQ Warehouse");
   Ini.setProperty(Ini.P_LANGUAGE, "English");
   // Ini.setProperty(Ini.P_PRINTER,"MyPrinter");
   Login login = new Login(Env.getCtx());
   login.batchLogin();
   ForecastEngine engine = ForecastEngine.get();
 }
  /**
   * Test
   *
   * @param args ignored
   */
  public static void main(String[] args) {

    Adempiere.startupEnvironment(false);
    CLogMgt.setLevel(Level.CONFIG);

    ColumnEncryption columnEncryption = new ColumnEncryption();

    int processId = 328; // AD_ColumnEncryption
    int columnId = 417; // AD_User - Password
    Env.setContext(Env.getCtx(), I_AD_Column.COLUMNNAME_AD_Column_ID, columnId);

    MPInstance instance;
    MPInstancePara instanceParameters;

    instance = new MPInstance(Env.getCtx(), processId, columnId);
    instance.saveEx();

    instanceParameters = new MPInstancePara(instance, 10);
    instanceParameters.setParameter(I_AD_Column.COLUMNNAME_IsEncrypted, true);
    instanceParameters.saveEx();

    instanceParameters = new MPInstancePara(instance, 20);
    instanceParameters.setParameter("ChangeSetting", true);
    instanceParameters.saveEx();

    ProcessInfo pi = new ProcessInfo("AD_ColumnEncryption", processId);
    pi.setRecord_ID(instance.getRecord_ID());
    pi.setAD_PInstance_ID(instance.getAD_PInstance_ID());
    pi.setAD_Client_ID(0);
    pi.setAD_User_ID(100);

    columnEncryption.startProcess(Env.getCtx(), pi, null);

    /*List<MUser> users = new Query(Env.getCtx(), I_AD_User.Table_Name , "Password IS NOT NULL", null).list();
    for (MUser user : users)
    {
        user.setPassword(user.getPassword());
        user.saveEx();
    }*/

    processId = 53259; // Convert password to hashed

    pi = new ProcessInfo("AD_User_HashPassword", processId);
    pi.setAD_Client_ID(0);
    pi.setAD_User_ID(100);

    HashPasswords process = new HashPasswords();
    process.startProcess(Env.getCtx(), pi, null);
  }
  // add main method, preparing for nightly build
  public static void main(String[] args) {
    Adempiere.startupEnvironment(false);
    CLogMgt.setLevel(Level.FINE);
    s_log.info("Synchronize Terminology");
    s_log.info("-----------------------");
    ProcessInfo pi = new ProcessInfo("Synchronize Terminology", 172);
    pi.setAD_Client_ID(0);
    pi.setAD_User_ID(100);

    SynchronizeTerminology sc = new SynchronizeTerminology();
    sc.startProcess(Env.getCtx(), pi, null);

    System.out.println(
        "Process=" + pi.getTitle() + " Error=" + pi.isError() + " Summary=" + pi.getSummary());
  }
  /**
   * Main test
   *
   * @param args
   * @throws Exception
   */
  public static void main(String[] args) {
    Adempiere.startupEnvironment(true);
    CLogMgt.setLevel(Level.INFO);

    Properties ctx = Env.getCtx();
    int AD_Process_ID = 53156; // HARDCODED

    MPInstance pinstance = new MPInstance(ctx, AD_Process_ID, -1);
    pinstance.saveEx();

    ProcessInfo pi = new ProcessInfo("", AD_Process_ID, 0, 0);
    pi.setAD_Client_ID(Env.getAD_Client_ID(ctx));
    pi.setAD_User_ID(Env.getAD_User_ID(ctx));
    pi.setAD_PInstance_ID(pinstance.getAD_PInstance_ID());
    //
    EnableNativeSequence proc = new EnableNativeSequence();
    proc.startProcess(ctx, pi, null);
    if (pi.isError()) {
      throw new AdempiereException(pi.getSummary());
    }
  }
  public static boolean initWeb() {
    if (s_initOK) {
      // log.info(context.getServletContextName());
      return true;
    }

    // TODO:
    //  Load Environment Variables (serverApps/src/web/WEB-INF/web.xml)

    try {
      // CLogMgt.setLevel(Level.OFF);

      /* ADEMPIERE/COMPIERE */
      // s_initOK = Compiere.startup(false);
      s_initOK = Adempiere.startup(false);
    } catch (Exception ex) {
      log.log(Level.SEVERE, "startup", ex);
    }
    if (!s_initOK) return false;

    //	Logging now initiated
    // log.info(info.toString());

    //
    Properties ctx = new Properties();
    MClient client = MClient.get(ctx, 0);
    MSystem system = MSystem.get(ctx);

    // Env.setContext( ctx, "#AD_Language", "pl_PL" );
    // client.sendEMail(client.getRequestEMail(),
    //	"Server started: " + system.getName()
    //	,"ServerInfo: " + context.getServerInfo()
    // );

    return s_initOK;
  }
 /**
  * ************************************************************************* Test
  *
  * @param args ignored
  */
 public static void main(String[] args) {
   Adempiere.startup(true);
   MAlertProcessor model = new MAlertProcessor(Env.getCtx(), 100, null);
   AlertProcessor ap = new AlertProcessor(model);
   ap.start();
 }
  /**
   * ************************************************************************ Generate PO Model
   * Class.
   *
   * <pre>
   * 	Example: java GenerateModel.class mydirectory myPackage 'U','A'
   * 	would generate entity type User and Application classes into mydirectory.
   * 	Without parameters, the default is used:
   * 	C:\Adempiere\adempiere-all\extend\src\adempiere\model\ adempiere.model 'U','A'
   * 	</pre>
   *
   * @param args directory package entityType - directory where to save the generated file - package
   *     of the classes to be generated - entityType to be generated
   */
  public static void main(String[] args) {
    org.compiere.Adempiere.startupEnvironment(true);
    CLogMgt.setLevel(Level.FINE);
    //	CLogMgt.setLevel(Level.ALL);
    log.info("Generate Model   $Revision: 1.5 $");
    log.info("----------------------------------");
    //	first parameter
    String directory = "/app/adempiere/adempiere_branch_3.1.1/dbPort/src/org/adempiere/model/";
    if (args.length > 0) directory = args[0];
    if (directory == null || directory.length() == 0) {
      System.err.println("No Directory");
      System.exit(1);
    }
    log.info("Directory: " + directory);

    //	second parameter
    String packageName = "adempiere.model";
    if (args.length > 1) packageName = args[1];
    if (packageName == null || packageName.length() == 0) {
      System.err.println("No package");
      System.exit(1);
    }
    log.info("Package:   " + packageName);

    //	third parameter
    String entityType = "'U','A','D'"; // 	User, Application
    if (args.length > 2) entityType = args[2];
    if (entityType == null || entityType.length() == 0) {
      System.err.println("No EntityType");
      System.exit(1);
    }
    StringBuffer sql = new StringBuffer("EntityType IN (").append(entityType).append(")");
    log.info(sql.toString());
    log.info("----------------------------------");

    //	complete sql
    sql.insert(
        0,
        "SELECT AD_Table_ID "
            + "FROM AD_Table "
            + "WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')" //	special views
            + " OR IsView='N')"
            + " AND TableName NOT LIKE '%_Trl' AND ");
    sql.append(" ORDER BY TableName");

    //
    int count = 0;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql.toString(), null);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        new GenerateModelJPA(rs.getInt(1), directory, packageName);
        count++;
      }
    } catch (Exception e) {
      log.severe("main - " + e);
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }

    log.info("Generated = " + count);
  } //	main
  /**
   * Doit
   *
   * @return ""
   */
  @Override
  protected String doIt() throws Exception {

    X_AD_Package_Imp_Proc adPackageImp = new X_AD_Package_Imp_Proc(getCtx(), p_PackIn_ID, null);

    // clear cache of previous runs
    IDFinder.clearIDCache();

    // Create Target directory if required
    String packageDirectory = adPackageImp.getAD_Package_Dir();
    if (packageDirectory == null || packageDirectory.trim().length() == 0) {
      packageDirectory = Adempiere.getAdempiereHome();
    }
    File targetDir = new File(packageDirectory + File.separator + "packages");

    if (!targetDir.exists()) {
      boolean success = (new File(packageDirectory + File.separator + "packages")).mkdirs();
      if (!success) {
        log.info("Target directory creation failed");
      }
    }

    // Unzip package
    File zipFilepath = new File(adPackageImp.getAD_Package_Source());
    log.info("zipFilepath->" + zipFilepath);
    String PackageName = CreateZipFile.getParentDir(zipFilepath);
    CreateZipFile.unpackFile(zipFilepath, targetDir);

    String dict_file =
        packageDirectory
            + File.separator
            + "packages"
            + File.separator
            + PackageName
            + File.separator
            + "dict"
            + File.separator
            + "PackOut.xml";
    log.info("dict file->" + dict_file);
    PackIn packIn = new PackIn();

    if (adPackageImp.isAD_Override_Dict() == true) PackIn.m_UpdateMode = "true";
    else PackIn.m_UpdateMode = "false";

    PackIn.m_Package_Dir =
        packageDirectory
            + File.separator
            + "packages"
            + File.separator
            + PackageName
            + File.separator;
    if (DB.isOracle()) PackIn.m_Database = "Oracle";
    else if (DB.isPostgreSQL()) PackIn.m_Database = "PostgreSQL";

    // call XML Handler
    String msg = packIn.importXML(dict_file, getCtx(), get_TrxName());

    // Generate Model Classes
    // globalqss - don't call Generate Model must be done manual
    // String args[] =
    // {IntPackIn.getAD_Package_Dir()+"/dbPort/src/org/compiere/model/",
    // "org.compiere.model","'U'"};
    // org.compiere.util.GenerateModel.main(args) ;

    return msg;
  } // doIt
  /**
   * ************************************************************************* Generate Interface.
   *
   * <pre>
   *  	Example: java GenerateInterafce.class mydirectory myPackage 'U','A'
   *  	would generate entity type User and Application classes into mydirectory.
   *  	Without parameters, the default is used:
   *  	C:\extend\src\compiere\model\ compiere.model 'U','A'
   *
   * </pre>
   *
   * @param args directory package entityType - directory where to save the generated file - package
   *     of the classes to be generated - entityType to be generated
   */
  public static void main(String[] args) {
    Adempiere.startupEnvironment(true);
    CLogMgt.setLevel(Level.FINE);
    log.info("Generate Interface   $Revision: 1.0 $");
    log.info("----------------------------------");
    // first parameter
    String directory = "C:\\Adempiere\\adempiere-all\\extend\\src\\compiere\\model\\";
    if (args.length > 0) directory = args[0];
    if (directory == null || directory.length() == 0) {
      System.err.println("No Directory");
      System.exit(1);
    }
    log.info("Directory: " + directory);

    // second parameter
    String packageName = "compiere.model";
    if (args.length > 1) packageName = args[1];
    if (packageName == null || packageName.length() == 0) {
      System.err.println("No package");
      System.exit(1);
    }
    log.info("Package:   " + packageName);

    // third parameter
    String entityType = "'U','A'"; // User, Application
    if (args.length > 2) entityType = args[2];
    if (entityType == null || entityType.length() == 0) {
      System.err.println("No EntityType");
      System.exit(1);
    }
    StringBuffer sql = new StringBuffer("EntityType IN (").append(entityType).append(")");
    log.info(sql.toString());
    log.info("----------------------------------");

    // Table name like
    String tableLike = "'%'"; // 	All tables
    // tableLike = "'AD_OrgInfo', 'AD_Role', 'C_CashLine', 'C_Currency', 'C_Invoice', 'C_Order',
    // 'C_Payment', 'M_InventoryLine', 'M_PriceList', 'M_Product', 'U_POSTerminal'"; // only
    // specific tables
    if (args.length > 3) tableLike = args[3];
    log.info("Table Like: " + tableLike);

    // complete sql
    sql.insert(
        0,
        "SELECT AD_Table_ID "
            + "FROM AD_Table "
            + "WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')" // special views
            + " OR IsView='N') AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' AND ");
    sql.append(" AND TableName LIKE ").append(tableLike);
    // sql.append(" AND TableName IN (").append( tableLike ).append(")");
    sql.append(" ORDER BY TableName");

    //
    int count = 0;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql.toString(), null);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        new ModelInterfaceGenerator(rs.getInt(1), directory, packageName);
        count++;
      }
    } catch (SQLException e) {
      throw new DBException(e, sql.toString());
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }
    log.info("Generated = " + count);
  }
  @SuppressWarnings("serial")
  protected Component doCreatePart(Component parent) {
    PageDefinition pagedef =
        Executions.getCurrent()
            .getPageDefinition(ThemeManager.getThemeResource("zul/desktop/desktop.zul"));
    Component page = Executions.createComponents(pagedef, parent, null);
    layout = (Borderlayout) page.getFellow("layout");
    headerContainer = page.getFellow("northBody");
    pnlHead = (HeaderPanel) headerContainer.getFellow("header");

    layout.addEventListener("onZoom", this);
    layout.addEventListener(DrillEvent.ON_DRILL_DOWN, this);

    West w = layout.getWest();
    w.addEventListener(
        Events.ON_OPEN,
        new EventListener<Event>() {
          @Override
          public void onEvent(Event event) throws Exception {
            OpenEvent oe = (OpenEvent) event;
            updateMenuCollapsedPreference(!oe.isOpen());
          }
        });
    w.addEventListener(
        Events.ON_SWIPE,
        new EventListener<SwipeEvent>() {

          @Override
          public void onEvent(SwipeEvent event) throws Exception {
            if ("left".equals(event.getSwipeDirection())) {
              West w = (West) event.getTarget();
              if (w.isOpen()) {
                w.setOpen(false);
                updateMenuCollapsedPreference(true);
              }
            }
          }
        });

    w.addEventListener(
        Events.ON_SIZE,
        new EventListener<Event>() {

          @Override
          public void onEvent(Event event) throws Exception {
            West west = (West) event.getTarget();
            updateSideControllerWidthPreference(west.getWidth());
          }
        });

    UserPreference pref = SessionManager.getSessionApplication().getUserPreference();
    boolean menuCollapsed = pref.isPropertyBool(UserPreference.P_MENU_COLLAPSED);
    w.setOpen(!menuCollapsed);

    East e = layout.getEast();
    e.addEventListener(
        Events.ON_OPEN,
        new EventListener<Event>() {
          @Override
          public void onEvent(Event event) throws Exception {
            OpenEvent oe = (OpenEvent) event;
            updateHelpCollapsedPreference(!oe.isOpen());
            HtmlBasedComponent comp = windowContainer.getComponent();
            if (comp != null) {
              contextHelp.setVisible(!oe.isOpen());
              if (!oe.isOpen()) layout.getEast().setVisible(false);
            }
          }
        });

    e.addEventListener(
        Events.ON_SWIPE,
        new EventListener<SwipeEvent>() {

          @Override
          public void onEvent(SwipeEvent event) throws Exception {
            if ("right".equals(event.getSwipeDirection())) {
              East e = (East) event.getTarget();
              if (e.isOpen()) {
                e.setOpen(false);
                updateHelpCollapsedPreference(true);
              }
            }
          }
        });

    e.addEventListener(
        Events.ON_SIZE,
        new EventListener<Event>() {

          @Override
          public void onEvent(Event event) throws Exception {
            East east = (East) event.getTarget();
            updateHelpWidthPreference(east.getWidth());
          }
        });

    String westWidth = getWestWidthPreference();
    String eastWidth = getEastWidthPreference();

    // Set preference width
    if (westWidth != null || eastWidth != null) {

      // If both panels have prefered size check that the sum is not bigger than the browser
      if (westWidth != null && eastWidth != null) {
        ClientInfo browserInfo = getClientInfo();
        int browserWidth = browserInfo.desktopWidth;
        int wWidth = Integer.valueOf(westWidth.replace("px", ""));
        int eWidth = Integer.valueOf(eastWidth.replace("px", ""));

        if (eWidth + wWidth <= browserWidth) {
          w.setWidth(westWidth);
          e.setWidth(eastWidth);
        }

      } else if (westWidth != null) w.setWidth(westWidth);
      else if (eastWidth != null) e.setWidth(eastWidth);
    }

    boolean helpCollapsed = pref.isPropertyBool(UserPreference.P_HELP_COLLAPSED);
    e.setVisible(!helpCollapsed);

    helpController.render(e, this);

    Center windowArea = layout.getCenter();

    windowContainer.createPart(windowArea);

    homeTab = new Tabpanel();
    windowContainer.addWindow(
        homeTab, Util.cleanAmp(Msg.getMsg(Env.getCtx(), "Home")), false, null);
    homeTab.getLinkedTab().setSclass("desktop-hometab");
    homeTab.setSclass("desktop-home-tabpanel");
    BusyDialog busyDialog = new BusyDialog();
    busyDialog.setShadow(false);
    homeTab.appendChild(busyDialog);

    // register as 0
    registerWindow(homeTab);

    BroadcastMessageWindow messageWindow = new BroadcastMessageWindow(pnlHead);
    BroadcastMsgUtil.showPendingMessage(Env.getAD_User_ID(Env.getCtx()), messageWindow);

    if (!layout.getDesktop().isServerPushEnabled()) {
      layout.getDesktop().enableServerPush(true);
    }

    Runnable runnable =
        new Runnable() {
          public void run() {
            try {
              Thread.sleep(100);
            } catch (InterruptedException e) {
            }

            IServerPushCallback callback =
                new IServerPushCallback() {
                  public void updateUI() {
                    Properties ctx =
                        (Properties)
                            layout
                                .getDesktop()
                                .getSession()
                                .getAttribute(SessionContextListener.SESSION_CTX);
                    try {
                      ServerContext.setCurrentInstance(ctx);
                      renderHomeTab();
                    } finally {
                      ServerContext.dispose();
                    }
                  }
                };
            ServerPushTemplate template = new ServerPushTemplate(layout.getDesktop());
            template.executeAsync(callback);
          }
        };

    Adempiere.getThreadPoolExecutor().submit(new DesktopRunnable(runnable, layout.getDesktop()));

    ToolBar toolbar = new ToolBar();
    windowContainer.getComponent().appendChild(toolbar);

    showHeader =
        new ToolBarButton() {
          @Override
          public void onPageDetached(Page page) {
            super.onPageDetached(page);
            if (DefaultDesktop.this.headerPopup != null) {
              DefaultDesktop.this.headerPopup.setPage(null);
            }
          }
        };
    toolbar.appendChild(showHeader);
    showHeader.setImage(ThemeManager.getThemeResource(IMAGES_THREELINE_MENU_PNG));
    showHeader.addEventListener(Events.ON_CLICK, this);
    showHeader.setSclass("window-container-toolbar-btn");
    showHeader.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;");
    showHeader.setVisible(false);

    max = new ToolBarButton();
    toolbar.appendChild(max);
    max.setImage(ThemeManager.getThemeResource(IMAGES_UPARROW_PNG));
    max.addEventListener(Events.ON_CLICK, this);
    max.setSclass("window-container-toolbar-btn");
    max.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;");

    contextHelp = new ToolBarButton();
    toolbar.appendChild(contextHelp);
    contextHelp.setImage(ThemeManager.getThemeResource(IMAGES_CONTEXT_HELP_PNG));
    contextHelp.addEventListener(Events.ON_CLICK, this);
    contextHelp.setSclass("window-container-toolbar-btn context-help-btn");
    contextHelp.setStyle("cursor: pointer; border: 1px solid transparent; padding: 2px;");
    contextHelp.setTooltiptext(Util.cleanAmp(Msg.getElement(Env.getCtx(), "AD_CtxHelp_ID")));
    contextHelp.setVisible(!e.isVisible());

    boolean headerCollapsed = pref.isPropertyBool(UserPreference.P_HEADER_COLLAPSED);
    if (headerCollapsed) {
      collapseHeader();
    }

    return layout;
  }
  /**
   * ************************************************************************ Generate PO Model
   * Class.
   *
   * <pre>
   * 	Example: java GenerateModel.class mydirectory myPackage 'U','A'
   * 	would generate entity type User and Application classes into mydirectory.
   * 	Without parameters, the default is used:
   * 	C:\Compiere\compiere-all\extend\src\compiere\model\ compiere.model 'U','A'
   * 	</pre>
   *
   * @param args directory package entityType - directory where to save the generated file - package
   *     of the classes to be generated - entityType to be generated
   */
  public static void main(String[] args) {
    Adempiere.startupEnvironment((args.length > 4 && args[4].equals("Client")));
    CLogMgt.setLevel(Level.FINE);
    log.info("Generate Model   $Revision: 1.42 $");
    log.info("----------------------------------");
    //	first parameter
    // mgrigioni 13/07/2010
    String directory = "dbPort/src/";
    // String directory = "C:\\Compiere\\compiere-all\\extend\\src\\compiere\\model\\";
    if (args.length > 0) directory = args[0];
    if (directory == null || directory.length() == 0) {
      System.err.println("No Directory");
      System.exit(1);
    }
    log.info("Directory: " + directory);

    //	second parameter
    String packageName = "org.adempierelbr.wrapper"; // ORIGINAL WAS compiere.model
    if (args.length > 1) packageName = args[1];
    if (packageName == null || packageName.length() == 0) {
      System.err.println("No package");
      System.exit(1);
    }
    log.info("Package:   " + packageName);

    //	third parameter
    // String entityType = "'U','A'";	//	User, Application
    String entityType = "'A', 'D'";
    String entityTypeColumn = "'LBRA'";
    String preffix = "W_";

    if (args.length > 2) entityType = args[2];
    if (entityType == null || entityType.length() == 0) {
      System.err.println("No EntityType");
      System.exit(1);
    }
    StringBuffer sql = new StringBuffer("EntityType IN (").append(entityType).append(")");
    log.info(sql.toString());
    log.info("----------------------------------");

    String tableLike = null;
    tableLike = "'%'"; // 	All tables
    // tableLike = "'AD_OrgInfo', 'AD_Role', 'C_CashLine', 'C_Currency', 'C_Invoice', 'C_Order',
    // 'C_Payment', 'M_InventoryLine', 'M_PriceList', 'M_Product', 'U_POSTerminal'";	//	Only
    // specific tables
    if (args.length > 3) tableLike = args[3];
    log.info("Table Like: " + tableLike);

    //	complete sql
    sql.insert(
        0,
        "SELECT AD_Table_ID, EntityType "
            + "FROM AD_Table "
            + "WHERE (TableName IN ('RV_WarehousePrice','RV_BPartner')" //	special views
            + " OR IsView='N')"
            + " AND IsActive = 'Y' AND TableName NOT LIKE '%_Trl' AND TableName NOT LIKE '%AAAA%'"
            + " AND EXISTS (SELECT '1' FROM AD_Column c WHERE c.AD_Table_ID=AD_Table.AD_Table_ID AND c.EntityType IN ("
            + entityTypeColumn
            + ")) AND ");
    sql.append(" AND TableName LIKE ").append(tableLike);
    // sql.append(" AND TableName IN (").append(tableLike).append(")"); // only specific tables

    sql.append(" ORDER BY TableName");

    //
    int count = 0;
    PreparedStatement pstmt = null;
    ResultSet rs = null;
    try {
      pstmt = DB.prepareStatement(sql.toString(), null);
      rs = pstmt.executeQuery();
      while (rs.next()) {
        String etmodelpackage = packageName;
        String classDirectory = directory;
        if (etmodelpackage != null) {
          packageName = etmodelpackage;
          String packages[] = packageName.split("\\.");
          for (String pack : packages) {
            classDirectory += pack + "/";
          }
        } else {
          classDirectory += "org/compiere/model/";
        }

        new ModelWrapperGenerator(
            rs.getInt(1), classDirectory, packageName, entityTypeColumn, preffix);
        count++;
      }
    } catch (Exception e) {
      log.log(Level.SEVERE, sql.toString(), e);
    } finally {
      DB.close(rs, pstmt);
      rs = null;
      pstmt = null;
    }
    log.info("Generated = " + count);
  }
Exemple #16
0
 /**
  * Static Init
  *
  * @throws Exception
  */
 private void jbInit() throws Exception {
   this.setBackground(Color.white);
   this.setName("splash");
   this.setUndecorated(true);
   //
   productLabel.setAlignment(Label.CENTER);
   message.setFont(new java.awt.Font("Serif", 3, 20)); //  italic bold 20 pt
   message.setForeground(SystemColor.activeCaption);
   message.setAlignment(Label.CENTER);
   contentPanel.setLayout(contentLayout);
   contentPanel.setName("splashContent");
   contentPanel.setBackground(Color.white);
   //
   productLabel.setFont(new java.awt.Font("Serif", 2, 10));
   productLabel.setForeground(Color.blue);
   productLabel.setText(Adempiere.getSubtitle());
   //	productLabel.setToolTipText(Adempiere.getURL());
   //
   contentPanel.add(
       cImage,
       new GridBagConstraints(
           1,
           0,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(10, 5, 0, 10),
           0,
           0));
   contentPanel.add(
       productLabel,
       new GridBagConstraints(
           1,
           1,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(0, 5, 0, 10),
           0,
           0));
   contentPanel.add(
       message,
       new GridBagConstraints(
           1,
           2,
           1,
           1,
           0.0,
           0.0,
           GridBagConstraints.CENTER,
           GridBagConstraints.NONE,
           new Insets(5, 5, 10, 10),
           0,
           0));
   //
   this.add(aImage, BorderLayout.WEST);
   this.add(contentPanel, BorderLayout.EAST);
 } //	jbInit
Exemple #17
0
 /** Adempiere Image */
 public CImage() {
   m_image = Adempiere.getImageLogo();
   tracker.addImage(m_image, 0);
 }