Author: batosai
Date: 2008-07-24 16:41:46 +0000 (Thu, 24 Jul 2008)
New Revision: 21375
Modified:
trunk/apps/WoT/src/plugins/WoT/WoT.java
Log:
BUGFIX : I was storing a new Trust object in the database each time a trust was
changed, without removing the old one.
Added some more debugging code.
Modified: trunk/apps/WoT/src/plugins/WoT/WoT.java
===================================================================
--- trunk/apps/WoT/src/plugins/WoT/WoT.java 2008-07-24 16:08:30 UTC (rev
21374)
+++ trunk/apps/WoT/src/plugins/WoT/WoT.java 2008-07-24 16:41:46 UTC (rev
21375)
@@ -69,8 +69,8 @@
}
- oldTrust = newTrust; //TODO Check if we are not creating a new
object in DB4O !!!
- db.store(oldTrust);
+ db.delete(oldTrust);
+ db.store(newTrust);
}
public void updateCapacity(Score identityScore, int newRank) {
@@ -101,7 +101,7 @@
}
else {
// Nothing to do
- System.out.println(identityScore.getTarget() + "
already is at rank " + identityScore.getRank());
+ System.out.println(identityScore.getTarget() + "
already is at rank " + identityScore.getRank() + "\n");
}
}
@@ -146,9 +146,20 @@
wot.setTrust(new Trust(root, a, 80, "Friend of mine"));
wot.setTrust(new Trust(b, c, 50, "Like him"));
wot.setTrust(new Trust(a, b, 100, "He's my brother"));
-
wot.setTrust(new Trust(root, b, 30, "Looks like a nice
guy"));
+ wot.setTrust(new Trust(root, b, 60, "In fact, he is
!"));
+ System.out.println("\n***** Trust objects in the
database :");
+ ObjectSet<Trust> trustList =
db.queryByExample(Trust.class);
+ while(trustList.hasNext()) {
+ System.out.println(trustList.next());
+ }
+
+ System.out.println("\n***** Score objects in the
database :");
+ ObjectSet<Score> scoreList =
db.queryByExample(Score.class);
+ while(scoreList.hasNext()) {
+ System.out.println(scoreList.next());
+ }
/*