Title / Description
Code package com.wfinance.portal.business; import java.util.HashMap; import com.wfinance.portal.common.utils.ListUtilities; import com.wfinance.portal.common.utils.SQLUtilities; import com.wfinance.portal.persistence.dao.TableRefDAO; import com.wfinance.portal.persistence.pojo.tref.TableSP1; /** * TableRefHelper.java - Charge les tables de référence en mémoire. * * <p> * ---<br> * Any disclosure, use, dissemination or reproduction of this material is * strictly prohibited without prior consent.<br> * Copyright (c) 2002 WFinance and WFinance Conseil. All rights reserved. * <p> * See <a href="http://www.wfinance.fr" target="_parent">WFINANCE Web Site</a> * <br> * --- * <p> * * @author <a href="mailto:deoliveira@wfinance.fr">Edouard De Oliveira</a> * * @version $Revision: 1.1.2.1 $, $Date: 2009/01/26 11:37:08 $ */ public class TableRefHelper { private HashMap periodiciteMap; private HashMap typeOperationAutoMap; private HashMap typeProduitMap; private HashMap typeSousProduitMap; private HashMap transactionMap; private TableRefDAO tableRefDAO; public void setTableRefDAO(TableRefDAO tableRefDAO) { this.tableRefDAO = tableRefDAO; } public void loadTables() { typeOperationAutoMap = ListUtilities.listToHashMap(tableRefDAO. getTableSP1(ConstantesMetier.TABLESP1_ID_TABLE_TYPE_OPERATION_AUTO), TableSP1.class, "getCle"); typeProduitMap = ListUtilities.listToHashMap(tableRefDAO. getTableSP1(ConstantesMetier.TABLESP1_ID_TABLE_TYPE_PRODUIT), TableSP1.class, "getCle"); typeSousProduitMap = ListUtilities.listToHashMap(tableRefDAO. getTableSP1(ConstantesMetier.TABLESP1_ID_TABLE_TYPE_SOUS_PRODUIT), TableSP1.class, "getCle"); periodiciteMap = ListUtilities.listToHashMap(tableRefDAO. getTableSP1(ConstantesMetier.TABLESP1_ID_TABLE_PERIODICITE), TableSP1.class, "getCle"); transactionMap = ListUtilities.listToHashMap(tableRefDAO. getTableSP1(ConstantesMetier.TABLESP1_ID_TABLE_TRANSACTION), TableSP1.class, "getCle"); } private String getLibelleCourt(HashMap m, String code) { if (code == null) return ""; else { TableSP1 val = (TableSP1) m.get( SQLUtilities.whiteSpacePrefixedString(code.trim(), 15)); if (val != null) return val.getLibelleCourt(); else return ""; } } public String getLibelleCourtTransaction(String code) { return getLibelleCourt(transactionMap, code); } public String getLibelleCourtTypeOperationAuto(String code) { return getLibelleCourt(typeOperationAutoMap, code); } public String getLibelleCourtPeriodicite(String code) { return getLibelleCourt(periodiciteMap, code); } public String getLibelleCourtTypeProduit(String code) { if (code == null) return ""; else { TableSP1 val = (TableSP1) typeProduitMap.get("004"+code); if (val != null) return val.getLibelleCourt(); else return ""; } } public String getLibelleCourtTypeSousProduit(String code) { if (code == null) return ""; else { TableSP1 val = (TableSP1) typeSousProduitMap.get("004"+code); if (val != null) return val.getLibelleCourt(); else return ""; } } }
Author
Highlight as C C++ CSS Clojure Delphi ERb Groovy (beta) HAML HTML JSON Java JavaScript PHP Plain text Python Ruby SQL XML YAML diff code