00001 /* 00002 * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM) 00003 * Copyright (C) 2004-2005 Philippe Delrieu 00004 * All rights reserved. 00005 * Contact: openmobileis@e-care.fr 00006 * 00007 * This library is free software; you can redistribute it and/or 00008 * modify it under the terms of the GNU Lesser General Public 00009 * License as published by the Free Software Foundation; either 00010 * version 2.1 of the License, or any later version. 00011 * 00012 * This library is distributed in the hope that it will be useful, 00013 * but WITHOUT ANY WARRANTY; without even the implied warranty of 00014 * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU 00015 * Lesser General Public License for more details. 00016 * 00017 * You should have received a copy of the GNU Lesser General Public 00018 * License along with this library; if not, write to the Free Software 00019 * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 00020 * USA 00021 * 00022 * Author : Philippe Delrieu 00023 * 00024 * Modifications : 00025 * 2004 Creation P.Delrieu 00026 * 00027 */ 00028 00029 package org.openmobileis.modules.crm.data.common; 00030 00031 import org.openmobileis.database.DatabaseException; 00032 import org.openmobileis.common.context.ApplicationContextManager; 00033 import org.openmobileis.common.util.exception.ServiceException; 00034 import org.openmobileis.common.util.collection.Array; 00035 import org.openmobileis.common.util.collection.Sort; 00036 00037 00046 public class LabelManager { 00047 00048 private static LabelManager manager; 00049 private LabelFactory factory; 00053 public LabelManager(LabelFactory factory) { 00054 super(); 00055 this.factory = factory; 00056 } 00057 00058 public static void registerManager(LabelManager m) { 00059 manager = m; 00060 ApplicationContextManager.getManager().addManager(manager); 00061 } 00062 00063 public static LabelManager getManager() { 00064 return manager; 00065 } 00066 00067 public static void removeManager() { 00068 manager = null; 00069 } 00070 00071 public LabelFactory getFactory() { 00072 return this.factory; 00073 } 00074 00075 public Array getLabelListForCategorie(String categorie) { 00076 return this.factory.getLabelListForCategorie(categorie); 00077 } 00078 00079 public String[][] getCategoriesList() { 00080 return this.factory.getCategoriesList(); 00081 } 00082 00083 00084 public Label getLabelWithIds(String id, String category) { 00085 return this.factory.getLabelWithIds(id, category); 00086 } 00087 00088 00089 00093 public void storeLabel(Label label) throws ServiceException, DatabaseException { 00094 this.factory.storeLabel(label); 00095 } 00096 00097 public void deleteLabel(String id, String category) throws ServiceException, DatabaseException { 00098 this.factory.deleteLabel(id, category); 00099 } 00100 00101 public Array sortLabelArray(Array labelList) { 00102 if (labelList.size() > 0) { 00103 Label label = (Label)labelList.get(0); 00104 Sort.shellsort(labelList, label); 00105 } 00106 return labelList; 00107 } 00108 00109 }