Project Wonder 5.0

er.extensions.eof
Class ERXTemporaryGlobalID

java.lang.Object
  extended by com.webobjects.eocontrol.EOGlobalID
      extended by er.extensions.eof.ERXTemporaryGlobalID
All Implemented Interfaces:
java.io.Serializable, java.lang.Cloneable

public class ERXTemporaryGlobalID
extends com.webobjects.eocontrol.EOGlobalID

Experimental class to have quasi-GUIDs that fit into a long. Used as an alternative to the ERXLongPrimaryKeyFactory or the 24 byte built-in keys. To have it installed, set your pk prototype to "longId".
Note: by default, the key is partitioned by the lower 2 bytes host address, the lower byte of the port number and the current time in seconds. Then you have a byte left for inserts in one second.
This means, if you you are inserting - say - one thousand objects and your app crashes and restarts in 4 seconds and directly inserts new objects, then you might end up with duplicate keys. So this might only be for apps that stay at a low volume.
Also you need to be sure that your app is in one class B subnet and your instances port numbers are partitionable over the lower byte - which means less than 256 instances on one host.
Given these restrictions, you might want to stay with sequences...

See Also:
Serialized Form
Author:
ak

Field Summary
 
Fields inherited from class com.webobjects.eocontrol.EOGlobalID
_CLASS, GlobalIDChangedNotification
 
Constructor Summary
ERXTemporaryGlobalID()
           
 
Method Summary
 com.webobjects.foundation.NSDictionary dictionary(java.lang.String key)
          Returns a pk-ready dictionary with the supplied key.
 boolean equals(java.lang.Object obj)
           
 int hashCode()
           
 boolean isTemporary()
           
static void setIdentifier(int value)
           
 java.lang.String toString()
           
 long value()
           
 
Methods inherited from class com.webobjects.eocontrol.EOGlobalID
clone
 
Methods inherited from class java.lang.Object
finalize, getClass, notify, notifyAll, wait, wait, wait
 

Constructor Detail

ERXTemporaryGlobalID

public ERXTemporaryGlobalID()
Method Detail

setIdentifier

public static void setIdentifier(int value)

equals

public boolean equals(java.lang.Object obj)
Specified by:
equals in class com.webobjects.eocontrol.EOGlobalID

isTemporary

public boolean isTemporary()
Overrides:
isTemporary in class com.webobjects.eocontrol.EOGlobalID

hashCode

public int hashCode()
Specified by:
hashCode in class com.webobjects.eocontrol.EOGlobalID

value

public long value()

dictionary

public com.webobjects.foundation.NSDictionary dictionary(java.lang.String key)
Returns a pk-ready dictionary with the supplied key.

Parameters:
key -

toString

public java.lang.String toString()
Overrides:
toString in class java.lang.Object

Last updated: Tue, Feb 21, 2017 • 05:45 PM CET

Copyright © 2002 – 2007 Project Wonder.