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

RepresentantSynchroFODBReturnListener.java

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  *  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.util.exception.SynchroException;
00034 import org.openmobileis.common.util.log.LogManager;
00035 import org.openmobileis.database.DatabaseException;
00036 import org.openmobileis.database.fastobjectdb.synchro.client.SynchroFODBReturnListener;
00037 import org.openmobileis.modules.crm.data.common.Representant;
00038 import org.openmobileis.modules.crm.data.common.RepresentantManager;
00039 
00048 public class RepresentantSynchroFODBReturnListener implements SynchroFODBReturnListener {
00049 
00053   public RepresentantSynchroFODBReturnListener() {
00054     super();
00055   }
00056 
00057   /* (non-Javadoc)
00058    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyBeginDBUpdate(java.lang.Object)
00059    */
00060   public Object notifyBeginDBUpdate(Object object) throws DatabaseException {
00061     return null;
00062   }
00063 
00064   /* (non-Javadoc)
00065    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyDBDelete(java.lang.String)
00066    */
00067   public void notifyDBDelete(String objectId) throws DatabaseException {
00068   }
00069 
00070   /* (non-Javadoc)
00071    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifySynchroBegin()
00072    */
00073   public void notifySynchroBegin() {
00074   }
00075 
00076   /* (non-Javadoc)
00077    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifySynchroEnd()
00078    */
00079   public void notifySynchroEnd() {
00080         //update install representant with new one
00081         try     {
00082                         Representant[] replist = RepresentantManager.getManager().getAllRepresentants();
00083                         for (int i=0; i<replist.length; i++)    {
00084                                 if (replist[i].isInstallRepresentant()) {
00085                                         RepresentantManager.getManager().setInstallRepresentant(replist[i].getRepresentantId());
00086                                         RepresentantManager.getManager().setSelectedRepresentant(replist[i].getRepresentantId());
00087                                         break;
00088                                 }
00089                         }
00090         } catch (Throwable ex)  {
00091                 LogManager.traceError(0, ex);
00092         }
00093         
00094                 SessionContext context = (SessionContext) SessionContextManager.getManager().getSessionContext();
00095                 Representant rep = RepresentantManager.getManager().getInstallRepresentant();
00096                 if (rep != null)        {
00097                         context.setAttribute("userId",rep.getRepresentantId());
00098                 }
00099   }
00100 
00101   /* (non-Javadoc)
00102    * @see org.openmobileis.database.fastobjectdb.synchro.SynchroFODBReturnListener#notifyFODBObjectSynchroDone(java.lang.String)
00103    */
00104   public void notifyFODBObjectSynchroDone(String ObjectId) throws SynchroException {
00105   }
00106 
00107 }

Generated on Wed Dec 14 21:05:34 2005 for OpenMobileIS by  doxygen 1.4.4