Update of /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/cache
In directory sc8-pr-cvs1.sourceforge.net:/tmp/cvs-serv19913/src/net/sf/magicmap/server/cache
Modified Files:
PositionCache.java
Log Message:
remove position bug behobn
Index: PositionCache.java
===================================================================
RCS file: /cvsroot/magicmap/magicmapserver/src/net/sf/magicmap/server/cache/PositionCache.java,v
retrieving revision 1.5
retrieving revision 1.6
diff -C2 -d -r1.5 -r1.6
*** PositionCache.java 15 Nov 2005 12:50:56 -0000 1.5
--- PositionCache.java 18 Nov 2005 14:41:59 -0000 1.6
***************
*** 11,14 ****
--- 11,15 ----
import net.sf.magicmap.db.Map;
import net.sf.magicmap.server.dto.PositionDTO;
+ import net.sf.magicmap.server.facade.PositionFacade;
***************
*** 35,40 ****
this.put(getMapString(map),new PositionCacheEntry());
- System.out.println("current Map added: " + map.toString());
- System.out.println("all Maps in cache: " + this.toString());
}
--- 36,39 ----
***************
*** 51,67 ****
if(!existsMapHashtable(map))
addMapHashtable(map);
- System.out.println("createOrUpdatePosition() has map added");
if(getMapHashtable(map).existsPosition(position.getName())){
getMapHashtable(map).removePosition(position.getName());
}
getMapHashtable(map).addPosition(position);
-
- System.out.println("createOrUpdatePosition() has position added");
}
public PositionDTO[] getPositionsForMapSince(Map map,Long time){
- System.out.println("enter getPositionsForMapSince()");
- System.out.println("all Maps: " + this.toString());
- System.out.println("current Map: " + map.toString());
if(!existsMapHashtable(map))
return new PositionDTO[0];
--- 50,60 ----
***************
*** 82,86 ****
}
! public void deletePosition (Map map, Long id){
if(existsMapHashtable(map)){
getMapHashtable(map).removePosition(id);
--- 75,79 ----
}
! public void removePosition (Map map, Long id){
if(existsMapHashtable(map)){
getMapHashtable(map).removePosition(id);
***************
*** 88,92 ****
}
! public void deletePosition (Map map, String name){
if(existsMapHashtable(map)){
getMapHashtable(map).removePosition(name);
--- 81,85 ----
}
! public void removePosition (Map map, String name){
if(existsMapHashtable(map)){
getMapHashtable(map).removePosition(name);
***************
*** 107,110 ****
--- 100,126 ----
}
+ protected void removePosition(Long id) {
+ PositionDTO pos = getPosition(id);
+ pos.setDeleted(true);
+ Long time = System.currentTimeMillis();
+ while(timeMap.containsKey(time)){
+ ++time;
+ }
+ updateTime(pos.getLastModified(), time);
+ pos.setLastModified(time);
+ }
+
+ protected void removePosition(String name) {
+
+ PositionDTO pos = getPosition(name);
+ pos.setDeleted(true);
+ Long time = System.currentTimeMillis();
+ while(timeMap.containsKey(time)){
+ ++time;
+ }
+ updateTime(pos.getLastModified(), time);
+ pos.setLastModified(time);
+ }
+
protected void addPosition(PositionDTO position){
Long id = new Long(1);
***************
*** 159,163 ****
}
! protected void removePosition(String name){
timeMap.remove(positionHash.get(name).getLastModified());
idHash.remove(positionHash.get(name).getId());
--- 175,179 ----
}
! protected void deletePosition(String name){
timeMap.remove(positionHash.get(name).getLastModified());
idHash.remove(positionHash.get(name).getId());
***************
*** 165,169 ****
}
! protected void removePosition(Long id){
timeMap.remove(idHash.get(id));
positionHash.remove(idHash.get(id));
--- 181,185 ----
}
! protected void deletePosition(Long id){
timeMap.remove(idHash.get(id));
positionHash.remove(idHash.get(id));
|