1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
267
268
269
270
271
272
273
274
275
276
277
278
279
280
281
282
283
284
285
286
287
288
289
290
291
292
293
294
295
296
297
298
299
300
301
302
303
304
305
306
307
308
309
310
311
312
313
314
315
316
317
318
319
320
321
322
323
324
325
326
327
328
329
330
331
332
333
334
335
336
337
338
339
340
341
342
343
344
345
346
347
348
349
350
351
352
353
354
355
356
357
358
359
360
361
362
363
364
365
366
367
368
369
370
371
372
373
374
375
376
377
378
379
380
381
382
383
384
385
386
387
388
389
390
391
392
393
394
395
396
397
398
399
400
401
402
403
404
405
406
407
408
409
410
411
412
413
414
415
416
417
418
419
420
421
422
423
424
425
426
427
428
429
430
431
432
433
434
435
436
437
438
439
440
441
442
443
444
445
446
447
448
449
450
451
452
453
454
455
456
457
458
459
460
461
462
463
464
465
466
467
468
469
470
471
472
473
474
475
476
477
478
479
480
481
482
483
484
485
486
487
488
489
490
491
492
493
494
495
496
497
498
499
500
501
502
503
504
505
506
507
508
509
510
511
512
513
514
515
516
517
518
519
520
521
522
523
524
525
526
527
528
529
530
531
532
533
534
535
536
537
538
539
540
541
542
543
544
545
546
547
548
549
550
551
552
553
554
555
556
557
558
559
560
561
562
563
564
565
566
567
568
569
570
571
572
573
574
575
576
577
578
579
580
581
582
583
584
585
586
587
588
589
590
591
592
593
594
595
596
597
598
599
600
601
602
603
604
605
606
607
608
609
610
611
612
613
614
615
616
617
618
619
620
621
622
623
624
625
626
627
628
629
630
631
632
633
634
635
636
637
638
639
640
641
642
643
644
645
646
647
648
649
650
651
652
653
654
655
656
657
658
659
660
661
662
663
664
665
666
667
668
669
670
671
672
673
674
675
676
677
678
679
680
681
682
683
684
685
686
687
688
689
|
/*
Wotonomy: OpenStep design patterns for pure Java applications.
Copyright (C) 2001 Michael Powers
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, see http://www.gnu.org
*/
package net.wotonomy.access;
import java.util.Enumeration;
import java.util.List;
import java.util.Map;
import net.wotonomy.control.EOAndQualifier;
import net.wotonomy.control.EOCooperatingObjectStore;
import net.wotonomy.control.EOEditingContext;
import net.wotonomy.control.EOEnterpriseObject;
import net.wotonomy.control.EOFaultHandler;
import net.wotonomy.control.EOFaulting;
import net.wotonomy.control.EOFetchSpecification;
import net.wotonomy.control.EOGlobalID;
import net.wotonomy.control.EOKeyGlobalID;
import net.wotonomy.control.EOKeyValueCoding;
import net.wotonomy.control.EOKeyValueCodingSupport;
import net.wotonomy.control.EOKeyValueQualifier;
import net.wotonomy.control.EOObjectStoreCoordinator;
import net.wotonomy.control.EOQualifier;
import net.wotonomy.foundation.NSArray;
import net.wotonomy.foundation.NSDictionary;
import net.wotonomy.foundation.NSLocking;
import net.wotonomy.foundation.NSMutableArray;
import net.wotonomy.foundation.NSMutableDictionary;
/**
* Represents an EOObjectStore that connects to an EODatabase
* @author ezamudio@nasoft.com
* @author $Author: cgruber $
* @version $Revision: 894 $
*/
public class EODatabaseContext extends EOCooperatingObjectStore implements NSLocking {
private static Class<? extends EODatabaseContext> _contextClass;
protected EODatabase _database;
protected EOAdaptorContext _context;
protected NSMutableArray _channels = new NSMutableArray();
protected NSMutableArray _lockedObjects = new NSMutableArray();
protected NSMutableDictionary<EOGlobalID, NSDictionary> _simpleSnaps;
protected NSMutableDictionary _manySnaps;
protected EOObjectStoreCoordinator _coordinator;
protected EOEditingContext _currEC;
protected int _updateStrategy;
/**
* Create an EODatabaseContext backed by the given EODatabase
*
* @param database The database
*/
public EODatabaseContext(EODatabase database) {
super();
_database = database;
_context = _database.adaptor().createAdaptorContext();
}
/**
* Retrieve the EOAdaptorContext for this context
* @return The EOAdaptorContext
*/
public EOAdaptorContext adaptorContext() {
return _context;
}
/**
* Retrieve the EODatabase for this context
* @return The EODatabase for this context
*/
public EODatabase database() {
return _database;
}
/**
* Retrieve an available EODatabaseChannel for this context
* @return An available EODatabaseChannel
*/
public EODatabaseChannel availableChannel() {
for (int i = 0; i < _channels.count(); i++) {
EODatabaseChannel c = (EODatabaseChannel) _channels.objectAtIndex(i);
if (!c.isFetchInProgress())
return c;
}
EODatabaseChannel c = new EODatabaseChannel(this);
registerChannel(c);
return c;
}
public void batchFetchRelationship(EORelationship rel, NSArray arr, EOEditingContext ec) {
// TODO should this do something?
}
/**
* Set the context class
* @param contextClass The context class
*/
public static void setContextClassToRegister(Class<? extends EODatabaseContext> contextClass) {
_contextClass = contextClass;
}
/**
* Retrieve the context class
* @return
*/
public static Class<? extends EODatabaseContext> contextClassToRegister() {
if (_contextClass == null)
_contextClass = EODatabaseContext.class;
return _contextClass;
}
public EOObjectStoreCoordinator coordinator() {
return _coordinator;
}
@Override
public void editingContextDidForgetObjectWithGlobalID(EOEditingContext ec, EOGlobalID gid) {
database().decrementSnapshotCountForGlobalID(gid);
}
public void handleDroppedConnection() {
// TODO: unregister channels
adaptorContext().handleDroppedConnection();
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOCooperatingObjectStore#ownsGlobalID(net.wotonomy.
* control.EOGlobalID)
*/
@Override
public boolean ownsGlobalID(EOGlobalID gid) {
if (!(gid instanceof EOKeyGlobalID))
return false;
return (database().entityNamed(((EOKeyGlobalID) gid).entityName()) != null);
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOCooperatingObjectStore#ownsObject(net.wotonomy.control
* .EOEnterpriseObject)
*/
@Override
public boolean ownsObject(EOEnterpriseObject eo) {
if (eo.entityName() == null)
return false;
return (database().entityNamed(eo.entityName()) != null);
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOCooperatingObjectStore#handlesFetchSpecification(net.
* wotonomy.control.EOFetchSpecification)
*/
@Override
public boolean handlesFetchSpecification(EOFetchSpecification fspec) {
String ename = fspec.entityName();
return (database().entityNamed(ename) != null);
}
public boolean hasBusyChannels() {
return adaptorContext().hasBusyChannels();
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOCooperatingObjectStore#prepareForSaveWithCoordinator(
* net.wotonomy.control.EOObjectStoreCoordinator,
* net.wotonomy.control.EOEditingContext)
*/
@Override
public void prepareForSaveWithCoordinator(EOObjectStoreCoordinator coord, EOEditingContext ec) {
// TODO Auto-generated method stub
_coordinator = coord;
_currEC = ec;
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOCooperatingObjectStore#recordChangesInEditingContext()
*/
@Override
public void recordChangesInEditingContext() {
// TODO insert, delete, update
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOCooperatingObjectStore#recordUpdateForObject(net.
* wotonomy.control.EOEnterpriseObject, net.wotonomy.foundation.NSDictionary)
*/
@Override
public void recordUpdateForObject(EOEnterpriseObject eo, NSDictionary changes) {
// TODO Auto-generated method stub
}
public void recordSnapshotForGlobalID(NSDictionary snap, EOGlobalID gid) {
if (_simpleSnaps == null)
throw new IllegalArgumentException("Attempt to record a snapshot without a transaction in progress");
_simpleSnaps.setObjectForKey(snap, gid);
}
public void recordSnapshotForSourceGlobalID(NSArray gids, EOGlobalID gid, String relationName) {
if (_manySnaps == null)
throw new IllegalArgumentException("Attempt to record a snapshot without a transaction in progress");
NSMutableDictionary d = (NSMutableDictionary) _manySnaps.objectForKey(gid);
if (d == null) {
d = new NSMutableDictionary();
_manySnaps.setObjectForKey(d, gid);
}
d.setObjectForKey(gids, relationName);
}
public void recordSnapshots(NSDictionary<EOGlobalID, NSDictionary> snaps) {
if (_simpleSnaps == null)
throw new IllegalArgumentException("Attempt to record snapshots without a transaction in progress.");
_simpleSnaps.addEntriesFromDictionary(snaps);
/*
* Make sure we don't need to do this instead Enumeration enumeration =
* snaps.keyEnumerator(); while (enumeration.hasMoreElements()) { EOGlobalID g =
* (EOGlobalID)enumeration.nextElement(); NSDictionary d =
* (NSDictionary)snaps.objectForKey(g); recordSnapshotForGlobalID(d, g); }
*/
}
public void recordToManySnapshots(NSDictionary snaps) {
if (_manySnaps == null)
throw new IllegalArgumentException("Attempt to record snapshots without a transaction in progress.");
Enumeration<Object> enumeration = snaps.keyEnumerator();
while (enumeration.hasMoreElements()) {
Object key = enumeration.nextElement();
NSDictionary d = (NSDictionary) snaps.objectForKey(key);
NSMutableDictionary d2 = (NSMutableDictionary) _manySnaps.objectForKey(key);
if (d2 == null) {
d2 = new NSMutableDictionary();
_manySnaps.setObjectForKey(d2, key);
}
// this could also be done with many calls to recordSnapshotForSourceGID
d2.addEntriesFromDictionary(d);
}
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOCooperatingObjectStore#performChanges()
*/
@Override
public void performChanges() {
// TODO Auto-generated method stub
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOCooperatingObjectStore#commitChanges()
*/
@Override
public void commitChanges() {
adaptorContext().commitTransaction();
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOCooperatingObjectStore#rollbackChanges()
*/
@Override
public void rollbackChanges() {
adaptorContext().rollbackTransaction();
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOCooperatingObjectStore#valuesForKeys(net.wotonomy.
* foundation.NSArray, net.wotonomy.control.EOEnterpriseObject)
*/
@Override
public NSDictionary valuesForKeys(NSArray keys, EOEnterpriseObject eo) {
// TODO check snapshots; eo could be a fault
return eo.valuesForKeys(keys);
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.foundation.NSLocking#lock()
*/
@Override
public void lock() {
EOAccessLock.lock();
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.foundation.NSLocking#unlock()
*/
@Override
public void unlock() {
EOAccessLock.unlock();
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOObjectStore#arrayFaultWithSourceGlobalID(net.wotonomy.
* control.EOGlobalID, java.lang.String, net.wotonomy.control.EOEditingContext)
*/
@Override
public NSArray arrayFaultWithSourceGlobalID(EOGlobalID gid, String relName, EOEditingContext ec) {
if (!(gid instanceof EOKeyGlobalID))
throw new IllegalArgumentException("an EOKeyGlobalID is needed.");
EOAccessArrayFaultHandler handler = new EOAccessArrayFaultHandler((EOKeyGlobalID) gid, relName, this, ec);
return new NSArray(handler);
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOObjectStore#faultForGlobalID(net.wotonomy.control.
* EOGlobalID, net.wotonomy.control.EOEditingContext)
*/
@Override
public /* EOEnterpriseObject */Object faultForGlobalID(EOGlobalID gid, EOEditingContext ec) {
if (!(gid instanceof EOKeyGlobalID))
throw new IllegalArgumentException("Cannot fault an object that doesn't have a key global ID.");
EOAccessFaultHandler handler = new EOAccessFaultHandler((EOKeyGlobalID) gid, this, ec);
EOEntity e = database().entityNamed(((EOKeyGlobalID) gid).entityName());
Object o = e.classDescriptionForInstances().createInstanceWithEditingContext(ec, gid);
EOFaultHandler.makeObjectIntoFault(o, handler);
return o;
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOObjectStore#faultForRawRow(java.util.Map,
* java.lang.String, net.wotonomy.control.EOEditingContext)
*/
@Override
public /* EOEnterpriseObject */ Object faultForRawRow(Map row, String entityName, EOEditingContext ec) {
EOEntity e = database().entityNamed(entityName);
EOGlobalID gid = e.globalIDForRow(row);
return faultForGlobalID(gid, ec);
}
public void forgetSnapshotForGlobalID(EOGlobalID gid) {
if (_simpleSnaps == null)
throw new IllegalArgumentException("Attempt to forget snapshot with no transaction in progress.");
_simpleSnaps.removeObjectForKey(gid);
_manySnaps.removeObjectForKey(gid);
}
public void forgetSnapshotsForGlobalIDs(List<EOGlobalID> gids) {
for (int i = 0; i < gids.size(); i++) {
EOGlobalID g = gids.get(i);
forgetSnapshotForGlobalID(g);
database().forgetSnapshotForGlobalID(g);
}
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOObjectStore#initializeObject(java.lang.Object,
* net.wotonomy.control.EOGlobalID, net.wotonomy.control.EOEditingContext)
*/
@Override
public void initializeObject(/* EOEnterpriseObject */Object eo, EOGlobalID gid, EOEditingContext ec) {
if (gid.isTemporary())
return;
NSDictionary snap = snapshotForGlobalID(gid);
Object obj = ec.objectForGlobalID(gid);
EOEntity e = database().entityNamed(((EOKeyGlobalID) gid).entityName());
NSArray props = e.classProperties();
for (int i = 0; i < props.count(); i++) {
EOProperty p = (EOProperty) props.objectAtIndex(i);
Object val = snap.objectForKey(p.name());
if (p instanceof EOAttribute) {
if (eo instanceof EOKeyValueCoding) {
((EOKeyValueCoding) eo).takeValueForKey(val, p.name());
} else {
EOKeyValueCodingSupport.takeValueForKey(eo, val, p.name());
}
} else if (p instanceof EORelationship) {
if (((EORelationship) p).isToMany()) {
val = arrayFaultWithSourceGlobalID(gid, p.name(), ec);
} else {
EOEntity dest = ((EORelationship) p).destinationEntity();
EOKeyGlobalID kgid = (EOKeyGlobalID) dest.globalIDForRow(snap);
val = ec.objectForGlobalID(kgid);
if (val == null)
val = new EOAccessFaultHandler(kgid, this, ec);
}
if (val == EOKeyValueCoding.NullValue)
val = null;
if (eo instanceof EOKeyValueCoding) {
((EOKeyValueCoding) eo).takeValueForKey(val, p.name());
} else {
EOKeyValueCodingSupport.takeValueForKey(eo, val, p.name());
}
}
}
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOObjectStore#invalidateAllObjects()
*/
@Override
public void invalidateAllObjects() {
invalidateObjectsWithGlobalIDs(database().snapshots().allKeys());
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOObjectStore#invalidateObjectsWithGlobalIDs(java.util.
* List)
*/
@Override
public void invalidateObjectsWithGlobalIDs(List aList) {
forgetSnapshotsForGlobalIDs(aList);
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOObjectStore#isObjectLockedWithGlobalID(net.wotonomy.
* control.EOGlobalID, net.wotonomy.control.EOEditingContext)
*/
@Override
public boolean isObjectLockedWithGlobalID(EOGlobalID gid, EOEditingContext ec) {
return isObjectLockedWithGlobalID(gid);
}
public boolean isObjectLockedWithGlobalID(EOGlobalID gid) {
return _lockedObjects.containsObject(gid);
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOObjectStore#lockObjectWithGlobalID(net.wotonomy.
* control.EOGlobalID, net.wotonomy.control.EOEditingContext)
*/
@Override
public void lockObjectWithGlobalID(EOGlobalID gid, EOEditingContext ec) {
NSDictionary snap = snapshotForGlobalID(gid);
if (snap == null)
return;
if (!(gid instanceof EOKeyGlobalID))
return;
EOEntity e = database().entityNamed(((EOKeyGlobalID) gid).entityName());
EOQualifier q = e.qualifierForPrimaryKey(snap);
EOFetchSpecification fspec = new EOFetchSpecification(e.name(), q, null);
fspec.setLocksObjects(true);
NSArray arr = ec.objectsWithFetchSpecification(fspec);
if (arr.count() != 1)
throw new IllegalStateException("Cannot lock object with Global ID " + gid);
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOObjectStore#objectsForSourceGlobalID(net.wotonomy.
* control.EOGlobalID, java.lang.String, net.wotonomy.control.EOEditingContext)
*/
@Override
public NSArray objectsForSourceGlobalID(EOGlobalID gid, String relationName, EOEditingContext ec) {
EOEnterpriseObject eo = (EOEnterpriseObject) ec.objectForGlobalID(gid);
if (eo == null)
throw new IllegalStateException(
"Cannot find object for global ID " + gid + " in specified editing context.");
// Get the source object
EOEnterpriseObject source = (EOEnterpriseObject) faultForGlobalID(gid, ec);
if (source == null)
throw new IllegalStateException("There is no snapshot for source global ID " + gid);
// Check if there is already a value here
NSArray value = (NSArray) source.valueForKey(relationName);
EOAccessArrayFaultHandler handler = null;
if (value != null) {
if (EOFaultHandler.isFault(value)) {
handler = new EOAccessArrayFaultHandler((EOKeyGlobalID) gid, relationName, this, ec);
// TODO: fire the fault an return the value
} else
return value;
}
// Get the relationship
EOEntity entity = database().entityNamed(eo.entityName());
EORelationship rel = entity.relationshipNamed(relationName);
if (rel == null)
throw new IllegalStateException(
"Cannot find relationship named " + relationName + " in entity " + entity.name());
// create a fetch specification for this
EOQualifier q = null;
NSArray joins = rel.joins();
NSMutableArray subq = new NSMutableArray(joins.count());
for (int i = 0; i < joins.count(); i++) {
EOJoin j = (EOJoin) joins.objectAtIndex(i);
String key = j.destinationAttribute().name();
Object val = eo.valueForKey(j.sourceAttribute().name());
subq.addObject(new EOKeyValueQualifier(key, EOQualifier.QualifierOperatorEqual, val));
}
if (subq.count() == 1) {
q = (EOQualifier) subq.objectAtIndex(0);
} else {
q = new EOAndQualifier(subq);
}
EOFetchSpecification fspec = new EOFetchSpecification(rel.destinationEntity().name(), q, null);
NSArray res = ec.objectsWithFetchSpecification(fspec, ec);
NSMutableArray gids = new NSMutableArray(res.count());
for (int i = 0; i < res.count(); i++)
gids.addObject(ec.globalIDForObject(res.objectAtIndex(i)));
recordSnapshotForSourceGlobalID(gids, gid, relationName);
return res;
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOObjectStore#objectsWithFetchSpecification(net.wotonomy
* .control.EOFetchSpecification, net.wotonomy.control.EOEditingContext)
*/
@Override
public NSArray objectsWithFetchSpecification(EOFetchSpecification fspec, EOEditingContext ec) {
EODatabaseChannel channel = availableChannel();
channel.selectObjectsWithFetchSpecification(fspec, ec);
NSMutableArray arr = new NSMutableArray();
while (channel.isFetchInProgress()) {
Object o = channel.fetchObject();
if (o != null) {
arr.addObject(o);
}
}
return arr;
}
/*
* (non-Javadoc)
*
* @see net.wotonomy.control.EOObjectStore#refaultObject(java.lang.Object,
* net.wotonomy.control.EOGlobalID, net.wotonomy.control.EOEditingContext)
*/
@Override
public void refaultObject(Object obj, EOGlobalID gid, EOEditingContext ec) {
if (!(gid instanceof EOKeyGlobalID))
throw new IllegalArgumentException("GlobalID must be an EOKeyGlobalID");
if (obj instanceof EOFaulting)
// check if it's already a fault
if (!EOFaultHandler.isFault(obj)) {
((EOFaulting) obj).turnIntoFault(EOFaultHandler.handlerForFault(obj));
}
}
/*
* (non-Javadoc)
*
* @see
* net.wotonomy.control.EOObjectStore#saveChangesInEditingContext(net.wotonomy.
* control.EOEditingContext)
*/
@Override
public void saveChangesInEditingContext(EOEditingContext ec) {
prepareForSaveWithCoordinator(null, ec);
recordChangesInEditingContext();
performChanges();
commitChanges();
}
public void registerChannel(EODatabaseChannel channel) {
if (channel.databaseContext() != this)
throw new IllegalArgumentException("Cannot register a channel on a context other than its own.");
if (_channels.containsObject(channel))
throw new IllegalArgumentException("Attempt to register a channel more than once.");
_channels.addObject(channel);
}
public void unregisterChannel(EODatabaseChannel channel) {
if (channel.databaseContext() != this)
throw new IllegalArgumentException("Attempt to unregister a channel from a context other than its own.");
_channels.removeObject(channel);
}
public NSArray registeredChannels() {
return new NSArray(_channels);
}
public NSDictionary snapshotForGlobalID(EOGlobalID gid) {
NSDictionary d = null;
if (_simpleSnaps != null) {
d = (NSDictionary) _simpleSnaps.objectForKey(gid);
}
if (d == null)
d = database().snapshotForGlobalID(gid);
return d;
}
public NSArray snapshotForSourceGlobalID(EOGlobalID gid, String name) {
NSArray a = null;
if (_manySnaps != null) {
NSDictionary d = (NSDictionary) _manySnaps.objectForKey(gid);
a = (NSArray) d.objectForKey(name);
}
if (a == null)
a = database().snapshotForSourceGlobalID(gid, name);
return a;
}
public void setUpdateStrategy(int strategy) {
_updateStrategy = strategy;
}
public int updateStrategy() {
return _updateStrategy;
}
}
/*
* $Log$ Revision 1.2 2006/02/16 16:47:13 cgruber Move some classes in to
* "internal" packages and re-work imports, etc.
*
* Also use UnsupportedOperationExceptions where appropriate, instead of
* WotonomyExceptions.
*
* Revision 1.1 2006/02/16 13:19:57 cgruber Check in all sources in
* eclipse-friendly maven-enabled packages.
*
* Revision 1.5 2005/05/11 15:21:53 cgruber Change enum to enumeration, since
* enum is now a keyword as of Java 5.0
*
* A few other comments in the code.
*
* Revision 1.4 2003/12/18 15:37:38 mpowers Changes to retain ability to work
* with objects that don't necessarily implement EOEnterpriseObject. I would
* still like to preserve this case for general usage, however the access
* package is free to assume that those objects will be EOs and cast
* appropriately.
*
* Revision 1.3 2003/08/29 21:14:44 chochos implement a couple more methods.
*
* Revision 1.2 2003/08/20 01:16:22 chochos more methods have code now, but
* there's no way to test this yet. The core is still pending.
*
* Revision 1.1 2003/08/19 01:54:43 chochos The EODatabase layer still needs a
* lot of work, but it's on its way...
*
*/
|