Main Page | Packages | Class Hierarchy | Class List | Directories | File List | Class Members | Related Pages

TerminalUserSynchroFODBReturnListener.java

00001 /*
00002  * OpenMobileIS - a free Java(TM) Framework for mobile applications Java(TM)
00003  * Copyright (C) 2004-2006 Philippe Delrieu
00004  * All rights reserved.
00005  * Contact: pdelrieu@openmobileis.org
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  *  2005 Modification F.Salque
00027  * 
00028  */
00029 package org.openmobileis.modules.crm.database.common.fodb;
00030 
00031 import org.openmobileis.common.context.SessionContext;
00032 import org.openmobileis.common.context.SessionContextManager;
00033 import org.openmobileis.common.intl.IntlResourceManager;
00034 import org.openmobileis.common.util.exception.DatabaseException;
00035 import org.openmobileis.common.util.exception.SynchroException;
00036 import org.openmobileis.common.util.log.LogManager;
00037 import org.openmobileis.database.fastobjectdb.synchro.client.SynchroFODBReturnListener;
00038 import org.openmobileis.modules.crm.data.common.TerminalUser;
00039 import org.openmobileis.modules.crm.data.common.TerminalUserManager;
00040 
00049 public class TerminalUserSynchroFODBReturnListener implements SynchroFODBReturnListener {
00050 
00054   public TerminalUserSynchroFODBReturnListener() {
00055     super();
00056   }
00057 
00058   /*
00059    * (non-Javadoc)
00060    * 
00061    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyBeginDBUpdate(java.lang.Object)
00062    */
00063   public Object notifyBeginDBUpdate(Object object) throws DatabaseException {
00064     return null;
00065   }
00066 
00067   /*
00068    * (non-Javadoc)
00069    * 
00070    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyDBDelete(java.lang.String)
00071    */
00072   public void notifyDBDelete(String objectId) throws DatabaseException {
00073   }
00074 
00075   /*
00076    * (non-Javadoc)
00077    * 
00078    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifySynchroBegin()
00079    */
00080   public void notifySynchroBegin() {
00081     LogManager.traceDebug(0,"test");
00082   }
00083 
00084   /*
00085    * (non-Javadoc)
00086    * 
00087    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifySynchroEnd()
00088    */
00089   public void notifySynchroEnd() {
00090     // update install representant with new one
00091     try {
00092       TerminalUser[] replist = TerminalUserManager.getManager().getAllTerminalUsers();
00093       for (int i = 0; i < replist.length; i++) {
00094         if (replist[i].isInstallTerminalUser()) {
00095           TerminalUserManager.getManager().setInstallTerminalUser(replist[i].getTerminalUserId());
00096           break;
00097         }
00098       }
00099 
00100       SessionContext context = (SessionContext) SessionContextManager.getManager().getSessionContext();
00101       TerminalUser rep = TerminalUserManager.getManager().getInstallTerminalUser();
00102       if (rep != null) {
00103         context.setUserId(rep.getTerminalUserId());
00104         context.setUserLocale(rep.getLangue());
00105         IntlResourceManager.getManager().setManagerLocal(rep.getLangue());
00106         IntlResourceManager.getManager().addLocalizedProperties(System.getProperty("user.dir")+"/WEB-INF/conf/properties/systemmessages.properties", rep.getLangue());
00107      }
00108     } catch (Throwable ex) {
00109       LogManager.traceError(0, ex);
00110     }
00111   }
00112 
00113   /*
00114    * (non-Javadoc)
00115    * 
00116    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyFODBObjectSynchroDone(java.lang.String)
00117    */
00118   public void notifyFODBObjectSynchroDone(String ObjectId) throws SynchroException {
00119   }
00120 
00121 }

Generated on Mon Jul 10 10:29:32 2006 for OpenMobileIS by  doxygen 1.4.4