
Public Member Functions | |
| EOEntity | subEntityForEntity (EOEntity entity, NSDictionary pkDict) |
Static Public Member Functions | |
| static synchronized NSDictionary | primaryKeyDictionary (EOEnterpriseObject eo) |
| static synchronized Object | primaryKeyValue (String entityName) |
Private Member Functions | |
| Long | cachedPkValue (String ename) |
| Stack | cacheStack (String ename) |
| boolean | encodeEntityInPkValue () |
| boolean | encodeHostInPkValue () |
| void | fillPkCache (Stack s, String ename) |
| Long | getNextPkValueForEntity (String ename) |
| Long | getNextPkValueForEntityIncreaseBy (String entityName, int count, int increasePkBy) |
| int | hostCode () |
| int | increaseBy () |
| long | maxIdFromTable (String ename) |
| NSDictionary | primaryKeyDictionary (String entityName) |
Static Private Member Functions | |
| static ERXLongPrimaryKeyFactory | factory () |
Private Attributes | |
| Boolean | encodeEntityInPkValue |
| Boolean | encodeHostInPkValue |
| Integer | hostCode |
| Integer | increaseBy |
| Hashtable | pkCache = new Hashtable() |
Static Private Attributes | |
| static ERXLongPrimaryKeyFactory | _factory |
| static final int | CODE_LENGTH = 6 |
| static final String | HOST_CODE_KEY = "er.extensions.ERXLongPrimaryKeyFactory.hostCode" |
| static final int | HOST_CODE_LENGTH = 10 |
| static final Logger | log = Logger.getLogger(ERXLongPrimaryKeyFactory.class) |
| static long | MAX_PK_VALUE = (long) Math.pow(2, 48) |
ERXLongPrimaryKeyFactory.primaryKeyDictionary(EOEnterpriseObject eo);ERXIntegerPrimaryKeyFactory.encodeEntityInPkValue is set to true then the last 6 bits from the 64 bit primary key is used to encode the Subentity in the pk value. This speeds up inheritance with multiple tables. In order to support this you must add an entry to the userInfo from the Subentities:key=entityCodevalue= lt;lt; an unique integer, no longer than 6 bit - 1| Long cachedPkValue | ( | String | ename | ) | [private] |
Returns a new integer based PkValue for the specified entity. If the cache is empty it is refilled again.
| ename,the | entity name for which this method should return a new primary key |
| Stack cacheStack | ( | String | ename | ) | [private] |
looks in the cache hashtable if there is already an Stack for the specified entity name. If there is no Stack a new Stack object will be created.
| ename,the | name of the entity for which this method should return the Stack |
| boolean encodeEntityInPkValue | ( | ) | [private] |
| boolean encodeHostInPkValue | ( | ) | [private] |
| static ERXLongPrimaryKeyFactory factory | ( | ) | [static, private] |
| void fillPkCache | ( | Stack | s, | |
| String | ename | |||
| ) | [private] |
creates x primary key values for the specified entity and updates the database, where x is the number specified in increaseBy
| s,the | stack into which the pk values should be inserted | |
| ename,the | entity name for which the pk values should be generated |
| Long getNextPkValueForEntity | ( | String | ename | ) | [private] |
| Long getNextPkValueForEntityIncreaseBy | ( | String | entityName, | |
| int | count, | |||
| int | increasePkBy | |||
| ) | [private] |
returns a new primary key for the specified entity.
| ename,the | entity name for which this method should return a new primary key | |
| count,the | number of times the method should try to get a value from the database if something went wrong (a deadlock in the db for example -> high traffic with multiple instances) | |
| increaseBy,if | > 1 then the value in the database is increased by this factor. This is usefull to 'get' 10000 pk values at once for caching. Removes a lot of db roundtrips. |
| int hostCode | ( | ) | [private] |
| int increaseBy | ( | ) | [private] |
The amount of cached keys, set the property er.extensions.ERXLongPrimaryKeyFactory.increaseBy to the interval you want to use.
| long maxIdFromTable | ( | String | ename | ) | [private] |
Retrieves the maxValue from id from the specified entity. If hosts and entities are encoded, then these values are stripped first
| ename | ||
| pk |
| NSDictionary primaryKeyDictionary | ( | String | entityName | ) | [private] |
| static synchronized NSDictionary primaryKeyDictionary | ( | EOEnterpriseObject | eo | ) | [static] |
| static synchronized Object primaryKeyValue | ( | String | entityName | ) | [static] |
| EOEntity subEntityForEntity | ( | EOEntity | entity, | |
| NSDictionary | pkDict | |||
| ) |
ERXLongPrimaryKeyFactory _factory [static, private] |
final int CODE_LENGTH = 6 [static, private] |
Boolean encodeEntityInPkValue [private] |
Boolean encodeHostInPkValue [private] |
final String HOST_CODE_KEY = "er.extensions.ERXLongPrimaryKeyFactory.hostCode" [static, private] |
final int HOST_CODE_LENGTH = 10 [static, private] |
Integer hostCode [private] |
Integer increaseBy [private] |
final Logger log = Logger.getLogger(ERXLongPrimaryKeyFactory.class) [static, private] |
long MAX_PK_VALUE = (long) Math.pow(2, 48) [static, private] |
Hashtable pkCache = new Hashtable() [private] |
1.5.8