Refactoring of Create Client/U_WebMenu in Posterita

This commit is contained in:
shameem_z 2007-10-29 12:44:42 +00:00
parent 77cf91bb81
commit 2e3cecd8f9
7 changed files with 26 additions and 65 deletions

View File

@ -27,7 +27,7 @@ import org.compiere.util.Env;
import org.posterita.businesslogic.MenuManager;
import org.posterita.exceptions.OperationException;
import org.posterita.model.UDIMRole;
import org.posterita.model.UDIU_RoleMenu;
import org.posterita.model.U_RoleMenu;
public class MenuGenerator
@ -45,7 +45,7 @@ public class MenuGenerator
roleMenu.setAD_Role_ID(roleId);
roleMenu.setU_WebMenu_ID(menuIds[i]);
UDIU_RoleMenu udiRoleMenu = new UDIU_RoleMenu(roleMenu);
U_RoleMenu udiRoleMenu = new U_RoleMenu(roleMenu);
udiRoleMenu.save();
}
}
@ -58,7 +58,7 @@ public class MenuGenerator
int adClientId = Env.getAD_Client_ID(ctx);
int adOrgId = Env.getAD_Org_ID(ctx);
sqlWhereClause += "AD_CLIENT_ID=" + adClientId + " and AD_ORG_ID=" + adOrgId + " and U_MENU_ID=" + menuId + " and AD_ROLE_ID=" + roleId;
sqlWhereClause += "AD_CLIENT_ID=" + adClientId + " and AD_ORG_ID=" + adOrgId + " and U_WEBMENU_ID=" + menuId + " and AD_ROLE_ID=" + roleId;
int ids[] = X_U_RoleMenu.getAllIDs(X_U_RoleMenu.Table_Name, sqlWhereClause, null);
if(ids.length == 0)
@ -86,7 +86,7 @@ public class MenuGenerator
roleMenu.setAD_Role_ID(roleId);
roleMenu.setU_WebMenu_ID(menuIds[i]);
UDIU_RoleMenu udiRoleMenu = new UDIU_RoleMenu(roleMenu);
U_RoleMenu udiRoleMenu = new U_RoleMenu(roleMenu);
udiRoleMenu.save();
}
}

View File

@ -29,14 +29,13 @@ import java.lang.reflect.InvocationTargetException;
import java.util.Properties;
import org.compiere.model.PO;
import org.compiere.model.X_U_Menu;
import org.compiere.model.X_U_WebMenu;
import org.compiere.util.Env;
import org.posterita.Constants;
import org.posterita.businesslogic.MenuManager;
import org.posterita.exceptions.OperationException;
import org.posterita.lib.UdiConstants;
import org.posterita.model.UDIPO;
import org.posterita.model.UDIU_Menu;
import org.posterita.model.U_WebMenu;
import org.posterita.order.UDIOrderTypes;
public class POSMenuFactory extends AbstractFactory
@ -170,7 +169,7 @@ public class POSMenuFactory extends AbstractFactory
private void loadCashSalesMenu(Properties ctx, AbstractFactory factory) throws OperationException
{
UDIU_Menu pmenu_sales = MenuManager.createParentMenu(ctx, "pmenu.cash.sales", MODULE_NAME, 1000);
U_WebMenu pmenu_sales = MenuManager.createParentMenu(ctx, "pmenu.cash.sales", MODULE_NAME, 1000);
pmenu_sales.setPosition(MENU_POSITION_TOP);
pmenu_sales.setImageLink("images/pos/buttons/button_order.gif");
@ -270,7 +269,7 @@ public class POSMenuFactory extends AbstractFactory
private void loadCreditSalesMenu(Properties ctx, AbstractFactory factory) throws OperationException
{
UDIU_Menu pmenu_creditsales = MenuManager.createParentMenu(ctx, "pmenu.credit.sales", MODULE_NAME, 2000);
U_WebMenu pmenu_creditsales = MenuManager.createParentMenu(ctx, "pmenu.credit.sales", MODULE_NAME, 2000);
pmenu_creditsales.setPosition(MENU_POSITION_TOP);
pmenu_creditsales.setImageLink("images/pos/buttons/button_order.gif");
@ -325,7 +324,7 @@ public class POSMenuFactory extends AbstractFactory
private void loadPurchasesMenu(Properties ctx, AbstractFactory factory) throws OperationException
{
UDIU_Menu pmenu_purchases = MenuManager.createParentMenu(ctx, "pmenu.purchases", MODULE_NAME, 3000);
U_WebMenu pmenu_purchases = MenuManager.createParentMenu(ctx, "pmenu.purchases", MODULE_NAME, 3000);
pmenu_purchases.setPosition(MENU_POSITION_TOP);
pmenu_purchases.setImageLink("images/pos/buttons/button_order.gif");
@ -357,7 +356,7 @@ public class POSMenuFactory extends AbstractFactory
private void loadPerformanceAnalysisMenu(Properties ctx, AbstractFactory factory) throws OperationException
{
UDIU_Menu pmenu_reports = MenuManager.createParentMenu(ctx, "pmenu.performance.analysis", MODULE_NAME, 4000);
U_WebMenu pmenu_reports = MenuManager.createParentMenu(ctx, "pmenu.performance.analysis", MODULE_NAME, 4000);
pmenu_reports.setPosition(MENU_POSITION_TOP);
pmenu_reports.setImageLink("images/pos/buttons/button_reports.gif");
@ -396,7 +395,7 @@ public class POSMenuFactory extends AbstractFactory
private void loadStockMenu(Properties ctx, AbstractFactory factory) throws OperationException
{
UDIU_Menu pmenu_stock = MenuManager.createParentMenu(ctx, "pmenu.stock", MODULE_NAME, 5000);
U_WebMenu pmenu_stock = MenuManager.createParentMenu(ctx, "pmenu.stock", MODULE_NAME, 5000);
pmenu_stock.setPosition(MENU_POSITION_TOP);
pmenu_stock.setImageLink("images/pos/buttons/button_order.gif");
@ -445,7 +444,7 @@ public class POSMenuFactory extends AbstractFactory
private void loadAdministrationMenu(Properties ctx, AbstractFactory factory) throws OperationException
{
UDIU_Menu pmenu_administration = MenuManager.createParentMenu(ctx, "pmenu.administration", MODULE_NAME, 6000);
U_WebMenu pmenu_administration = MenuManager.createParentMenu(ctx, "pmenu.administration", MODULE_NAME, 6000);
pmenu_administration.setPosition(MENU_POSITION_TOP);
pmenu_administration.setImageLink("images/pos/buttons/button_administration.gif");
@ -551,8 +550,8 @@ public class POSMenuFactory extends AbstractFactory
protected void setFields(Properties ctx, PO fromPO, PO toPO) throws SecurityException, NoSuchMethodException, IllegalArgumentException, IllegalAccessException, InvocationTargetException
{
X_U_Menu fromUMenu = (X_U_Menu)fromPO;
X_U_Menu toUMenu = (X_U_Menu)toPO;
X_U_WebMenu fromUMenu = (X_U_WebMenu)fromPO;
X_U_WebMenu toUMenu = (X_U_WebMenu)toPO;
toUMenu.setMenuLink(fromUMenu.getMenuLink());
toUMenu.setName(fromUMenu.getName());

View File

@ -26,7 +26,7 @@ import java.sql.SQLException;
import java.util.ArrayList;
import java.util.Properties;
import org.compiere.model.X_U_Menu;
import org.compiere.model.X_U_WebMenu;
import org.compiere.util.Env;
import org.posterita.core.KeyNamePairUtil;
@ -41,7 +41,7 @@ public class MenuKeyNamePair extends KeyNamePairUtil
//+ " and isClosable= 'Y' ";
try
{
return getData(ctx, X_U_Menu.Table_Name,sql);
return getData(ctx, X_U_WebMenu.Table_Name,sql);
}
catch (SQLException e)
{

View File

@ -50,13 +50,16 @@ public class UdiConstants
public static final String CSS = "webParam5";
public static final String FORWARD = "webParam6";
public static final String MODULE_NAME_CTX_PARAM = "#ModuleName";
public static final String WEBPARAM6 = "webParam6";
//public static final String WEBPARAM6 = "webParam6";
public static final String PRICELIST_CTX_PARAM = "#M_PriceList_ID";
public static final String PRICELIST_VERSION_CTX_PARAM = "#M_Pricelist_Version_ID";
public static final String PRODUCT_CATEGORY_CTX_PARAM = "#M_Product_Category_ID";
public static final String USER_ID_CTX_PARAM = "#AD_User_ID";
public static final String USER_ORG_CTX_PARAM = "#User_Org";
public static final String LANGUAGE_CTX_PARAM = "#AD_Language";
public static final String WSTORE_CTX_PARAM = "#W_Store_ID";
public static final String DEFAULT_FORWARD = "pos";
public static final String WEBSTORE_DEFAULT_AD_ORG_ID_CTX_PARAM = "#AD_Org_ID_WebStoreDefault";

View File

@ -27,9 +27,9 @@ package org.posterita.model;
import java.util.Properties;
import org.compiere.model.X_U_Menu;
import org.compiere.model.X_U_WebMenu;
public class MMenu extends X_U_Menu
public class MMenu extends X_U_WebMenu
{
/**

View File

@ -1,41 +0,0 @@
/**
* Product: Posterita Web-Based POS and Adempiere Plugin
* Copyright (C) 2007 Posterita Ltd
* This file is part of POSterita
*
* POSterita 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.
* Created on 27-Jul-2005 by alok
*
*/
package org.posterita.model;
import java.util.Properties;
import org.compiere.model.X_U_RoleMenu;
public class MRoleMenu extends X_U_RoleMenu
{
/**
*
*/
private static final long serialVersionUID = 1L;
public MRoleMenu(Properties ctx, int U_RoleMenu_ID, String trxName)
{
super(ctx, U_RoleMenu_ID, trxName);
}
}

View File

@ -19,13 +19,13 @@
*/
package org.posterita.model;
import org.compiere.model.X_U_Menu;
import org.compiere.model.X_U_WebMenu;
import org.posterita.exceptions.OperationException;
public class UDIU_Menu extends UDIPO
{
public UDIU_Menu(X_U_Menu menu)
public UDIU_Menu(X_U_WebMenu menu)
{
super(menu);
}
@ -35,9 +35,9 @@ public class UDIU_Menu extends UDIPO
return getMenu().getImageLink();
}
public X_U_Menu getMenu()
public X_U_WebMenu getMenu()
{
return (X_U_Menu) getPO();
return (X_U_WebMenu) getPO();
}
public int getMenuId()