|
Project Wonder 2.0 | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Object er.extensions.ERXTolerantSaver
This class is pulled directly out of David Neumann's
ChangeNotification framework. The only changes made are
to use log4j instead of System.out.println.
The tolerant saver provides a way to save an editing context in
a tolerant fashion. By tolerant we mean that you can have the
option to save an editing context and have the exception ignored,
hvae the changes merged from the database or stomp all the changes
the database regardless of locking. The entry point for using this
class is the save
method.
Field Summary | |
static ERXLogger |
log
logging support |
Constructor Summary | |
ERXTolerantSaver()
|
Method Summary | |
static String |
_save(EOEditingContext ec,
boolean writeAnyWay,
boolean merge)
Entry point for saving an editing context in a tolerant manner. |
static void |
applyChangesToEO(NSDictionary changedValues,
EOEnterpriseObject failedEO,
EOEntity ent)
Method used to apply a set of changes to a re-fetched eo. |
static void |
applyEOChangesForValue(Object val,
NSArray rels,
EOEnterpriseObject eo)
Method used to push an object identified by it's primary key into one or many relationships off of a given enterprise object. |
static String |
errorFromException(Exception e)
|
static NSDictionary |
primaryKeyFor(Object val,
EOEntity destEnt)
Constructs a primary key dictionary given a value and an entity. |
static EOQualifier |
qualifierWithSnapshotAndPks(NSArray pkAttribs,
NSDictionary snapshot)
Constructs a qualifier for a given array of primary key attributes and a given snapshot. |
static NSArray |
relationshipsForAttribute(EOAttribute attrib,
NSArray rels)
Filters a list of relationships for only the ones that have a given EOAttribute as a source attribute. |
static String |
save(EOEditingContext ec,
boolean writeAnyWay)
Cover method for calling the method save with the
third parameter (merge) set to true. |
static String |
save(EOEditingContext ec,
boolean writeAnyWay,
boolean merge)
|
static String |
saveMerge(EOEditingContext ec,
boolean writeAnyWay,
boolean merge)
|
Methods inherited from class java.lang.Object |
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Field Detail |
public static final ERXLogger log
Constructor Detail |
public ERXTolerantSaver()
Method Detail |
public static NSArray relationshipsForAttribute(EOAttribute attrib, NSArray rels)
attrib
- EOAttribute to filter source attributes of
relationships.rels
- array of EORelationship objects.
public static NSDictionary primaryKeyFor(Object val, EOEntity destEnt)
val
- primary key to be the value in the dictionary.destEnt
- entity to construct the primary key dictionary
for.
public static void applyEOChangesForValue(Object val, NSArray rels, EOEnterpriseObject eo)
val
- primary key of a given objectrels
- array of relationships that the object should be
added to.eo
- enterprise object to have the object added to.public static void applyChangesToEO(NSDictionary changedValues, EOEnterpriseObject failedEO, EOEntity ent)
changedValues
- dictionary of the changed values to be
applied to the object.failedEO
- enterprise object to have the changes re-applied
to.ent
- EOEntity of the failedEOpublic static EOQualifier qualifierWithSnapshotAndPks(NSArray pkAttribs, NSDictionary snapshot)
pkAttribs
- array of EOAttributes that define
the primary keys of a given entitysnapshot
- to form the qualifier for
public static String save(EOEditingContext ec, boolean writeAnyWay)
save
with the
third parameter (merge) set to true. See the description of
the three parameter version for a detailed explanation.
ec
- editing context to be saved.writeAnyWay
- boolean flag to determine if the editing
context should be resaved after a general adaptor
exception
public static String saveMerge(EOEditingContext ec, boolean writeAnyWay, boolean merge)
public static String _save(EOEditingContext ec, boolean writeAnyWay, boolean merge)
writeAnyWay
and merge
. The writeAnyWay flag controls if a second
save should be performed if the first operation fails due to a general
adaptor operation. Note that even if this option is specified as
false the object will be refetched and optionally have the new changes
merged into. This means that the objects that failed saving to the
database will be ready to be saved if writeAnyWay is false. The second
option is to merge the previous changes if a failure occurs. If this
is set to true then when a locking failure occurs the object is refetched
and then the previous changes are re-applied to the object.
ec
- editing context to be savedwriteAnyWay
- boolean flag to determine if an editing context should
be saved again after a failure.merge
- boolean flag that determines if changes should be re-applied
if a locking failure occurs when the first save happens
public static String save(EOEditingContext ec, boolean writeAnyWay, boolean merge)
public static String errorFromException(Exception e)
|
Last updated: Do, Dez 9, 2004 12:46 PM CET | ||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | ||||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |