Update of /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv31498/src/net/sf/magicmap/server/facade
Modified Files:
PositionFacade.java
Log Message:
CE Client fixating Problem solved
Index: PositionFacade.java
===================================================================
RCS file: /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/facade/PositionFacade.java,v
retrieving revision 1.8
retrieving revision 1.9
diff -C2 -d -r1.8 -r1.9
*** PositionFacade.java 23 Aug 2005 14:17:07 -0000 1.8
--- PositionFacade.java 23 Sep 2005 14:31:04 -0000 1.9
***************
*** 2,5 ****
--- 2,6 ----
package net.sf.magicmap.server.facade;
+ import java.rmi.RemoteException;
import java.sql.Timestamp;
import java.util.ArrayList;
***************
*** 686,689 ****
--- 687,742 ----
return (PositionDTO[]) result.toArray(new PositionDTO[0]);
}
+
+
+ /* (non-Javadoc)
+ * @see net.sf.magicmap.server.facade.interfaces.PositionFacadeInterface#getPositionsForClientOnMap(long, java.lang.String, java.lang.String)
+ */
+ public String getPositionForClientOnMap(long sessionId, String mapName, String clientMac)
+ throws MapException, SessionException, RemoteException {
+ this.logger.info("getPositionsForClientOnMap() ");
+ PersistenceManager pm = null;
+ String positionResult = null;
+ Transaction tx = null;
+ try{
+ pm = JDOUtil.pmfactory.getPersistenceManager();
+ tx = pm.currentTransaction();
+ tx.begin();
+ checkSession(sessionId, pm);
+ Map map = checkMap(mapName, pm);
+ checkClient(clientMac, pm);
+ Extent e = pm.getExtent(Position.class, true);
+ String filter = "map == myMap && name == myName";
+ Query query = pm.newQuery(e, filter);
+ query.declareParameters("net.sf.magicmap.db.Map myMap, java.lang.String myName");
+ query.declareImports("import net.sf.magicmap.db.Map; import java.lang.String;");
+ Collection results = null;
+ results = (Collection) query.execute(map, clientMac);
+ if (results != null){
+ Iterator it = results.iterator();
+ if(it.hasNext()){
+ Position pos = (Position) it.next();
+ positionResult = String.valueOf(pos.getPosX())+ "#" + String.valueOf(pos.getPosY()) + "#" + String.valueOf(pos.isFixed());
+ }
+ }
+ tx.commit();
+ } catch (Exception e){
+ e.printStackTrace();
+ if (e instanceof MapException){
+ throw (MapException) e;
+ }
+ if (e instanceof SessionException){
+ throw (SessionException) e;
+ }
+ } finally{
+ if (tx.isActive()){
+ tx.rollback();
+ }
+ JDOUtil.closePM(pm);
+ }
+ this.logger.info("getPositionsForClientOnMap() - done ");
+ return positionResult;
+
+
+ }
}
\ No newline at end of file
|