[ppwcode] r6823 committed - fixed major bug in polymorphAmdRevive...

0 views
Skip to first unread message

ppw...@googlecode.com

unread,
May 21, 2013, 7:26:39 AM5/21/13
to ppwco...@googlegroups.com
Revision: 6823
Author: jand...@gmail.com
Date: Tue May 21 04:26:29 2013
Log: fixed major bug in polymorphAmdRevive
added IDEA to PersistentObject for future contemplation
http://code.google.com/p/ppwcode/source/detail?r=6823

Modified:

/javascript/vernacular/persistence/trunk/src/persistence/PersistentObject.js

/javascript/vernacular/persistence/trunk/src/persistence/polymorphAmdRevive.js

=======================================
---
/javascript/vernacular/persistence/trunk/src/persistence/PersistentObject.js
Thu May 2 10:36:44 2013
+++
/javascript/vernacular/persistence/trunk/src/persistence/PersistentObject.js
Tue May 21 04:26:29 2013
@@ -129,6 +129,18 @@

PersistentObject.keyForId = function(/*String*/ persistenceType,
/*Number*/ id) {
// IDEA can't use current form of precondition here
+
+ /* IDEA
+ after a major bug was found, it is clear that this should be
changed to take a Constructor
+ as argument, and not a String
+ we can get the persistence type as
Constructor.prototype.persistenceId now, and as
+ Constructor.mid later
+ This will propagate further over different classes, but it is a
problem nowhere,
+ except in CrudDao retrieve. But maybe there we use a Constructor
better too?
+ Also for the abstract classes?
+ If we don't want to do that, we cannot change it to a Constructor
here either.
+ */
+
if (! (persistenceType && lang.isString(persistenceType))) {
throw new Error("precondition violation: persistenceType &&
lang.isString(persistenceType)");
}
=======================================
---
/javascript/vernacular/persistence/trunk/src/persistence/polymorphAmdRevive.js
Wed May 8 02:38:31 2013
+++
/javascript/vernacular/persistence/trunk/src/persistence/polymorphAmdRevive.js
Tue May 21 04:26:29 2013
@@ -282,7 +282,7 @@
" that resolved to a Constructor that is a subtype of
PersistentObject, but contained no " +
"meaningful persistenceId - " + jsonPo;
}
- var type = jsonPo["$type"];
+ var type = Constructor.prototype.persistenceType;
var id = jsonPo.persistenceId;
var key = PersistentObject.keyForId(type, id);
debugMsg(debugPrefix + "asked to revive " + key);
Reply all
Reply to author
Forward
0 new messages