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.common.database.fodb;
00030 
00031 import java.io.Serializable;
00032 
00033 import org.openmobileis.common.context.SessionContext;
00034 import org.openmobileis.common.context.SessionContextManager;
00035 import org.openmobileis.common.intl.IntlResourceManager;
00036 import org.openmobileis.common.util.log.LogManager;
00037 import org.openmobileis.database.fastobjectdb.synchro.client.SynchroFODBReturnListener;
00038 import org.openmobileis.modules.common.data.TerminalUser;
00039 import org.openmobileis.modules.common.data.TerminalUserManager;
00040 import org.openmobileis.synchro.openmsp.OpenMSPException;
00041 
00050 public class TerminalUserSynchroFODBReturnListener implements SynchroFODBReturnListener {
00051 
00055   public TerminalUserSynchroFODBReturnListener() {
00056     super();
00057   }
00058   public Serializable getSendSynchroMetada() throws OpenMSPException    {
00059     return null;
00060   }
00061 
00062 
00063   /*
00064    * (non-Javadoc)
00065    * 
00066    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyBeginDBUpdate(java.lang.Object)
00067    */
00068   public Object notifyBeginDBUpdate(Object object) throws OpenMSPException {
00069     return null;
00070   }
00071 
00072   /*
00073    * (non-Javadoc)
00074    * 
00075    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyDBDelete(java.lang.String)
00076    */
00077   public void notifyDBDelete(String objectId) throws OpenMSPException {
00078   }
00079 
00080   /*
00081    * (non-Javadoc)
00082    * 
00083    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifySynchroBegin()
00084    */
00085   public void notifySynchroBegin() {
00086   }
00087 
00088   /*
00089    * (non-Javadoc)
00090    * 
00091    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifySynchroEnd()
00092    */
00093   public void notifySynchroEnd() {
00094     // update install representant with new one
00095     try {
00096       TerminalUser[] replist = TerminalUserManager.getManager().getAllTerminalUsers();
00097       for (int i = 0; i < replist.length; i++) {
00098         if (replist[i].isInstallTerminalUser()) {
00099           TerminalUserManager.getManager().setInstallTerminalUser(replist[i].getTerminalUserId());
00100           break;
00101         }
00102       }
00103 
00104       SessionContext context = (SessionContext) SessionContextManager.getManager().getSessionContext();
00105       TerminalUser rep = TerminalUserManager.getManager().getInstallTerminalUser();
00106       if (rep != null) {
00107         context.setUserId(rep.getTerminalUserId());
00108         context.setUserLocale(rep.getLangue());
00109         IntlResourceManager.getManager().setManagerLocal(rep.getLangue());
00110         IntlResourceManager.getManager().addLocalizedProperties(System.getProperty("user.dir")+"/WEB-INF/conf/properties/systemmessages.properties", rep.getLangue());
00111      }
00112     } catch (Throwable ex) {
00113       LogManager.traceError(0, ex);
00114     }
00115   }
00116 
00117   /*
00118    * (non-Javadoc)
00119    * 
00120    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyFODBObjectSynchroDone(java.lang.String)
00121    */
00122   public void notifyFODBObjectSynchroDone(String ObjectId) throws OpenMSPException {
00123   }
00124 
00125 }

Generated on Mon Dec 4 11:03:30 2006 for OpenMobileIS by  doxygen 1.5.1-p1