00001
00002
00003
00004
00005
00006
00007
00008
00009
00010
00011
00012
00013
00014
00015
00016
00017
00018
00019
00020
00021
00022
00023
00024
00025
00026
00027
00028
00029 package org.openmobileis.modules.common.data;
00030
00031 import org.openmobileis.common.context.ApplicationContextManager;
00032 import org.openmobileis.common.util.exception.DatabaseException;
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 }