version 1.2, 2006/01/30 16:18:20
|
version 1.3, 2006/05/31 19:59:46
|
|
|
/** Retrieve the list of entries for a from class through direct | /** Retrieve the list of entries for a from class through direct |
* access via the from class name. | * access via the from class name. |
*/ | */ |
Boolean AssocClassCache::getAssocClassEntry(const String& lowerCaseFromClassName, |
Boolean AssocClassCache::getAssocClassEntry(const String& fromClassName, |
Array< Array<String> >& entryList) | Array< Array<String> >& entryList) |
{ | { |
return _assocClassCache->lookup(lowerCaseFromClassName,entryList); |
return _assocClassCache->lookup(fromClassName,entryList); |
} | } |
| |
/** Add a new record to the association cache. | /** Add a new record to the association cache. |
|
|
* the new entry is appended to the old entry. Otherwise a new entry | * the new entry is appended to the old entry. Otherwise a new entry |
* is added to the cache. | * is added to the cache. |
*/ | */ |
Boolean AssocClassCache::addRecord(const String& lowerCaseFromClassName, |
Boolean AssocClassCache::addRecord(const String& fromClassName, |
Array<String> assocClassRecord) | Array<String> assocClassRecord) |
{ | { |
Array< Array<String> > oldAssocClassEntryList; | Array< Array<String> > oldAssocClassEntryList; |
| |
if (_assocClassCache->lookup(lowerCaseFromClassName, oldAssocClassEntryList)) |
if (_assocClassCache->lookup(fromClassName, oldAssocClassEntryList)) |
{ | { |
_assocClassCache->remove(lowerCaseFromClassName); |
_assocClassCache->remove(fromClassName); |
} | } |
| |
oldAssocClassEntryList.append(assocClassRecord); | oldAssocClassEntryList.append(assocClassRecord); |
| |
return _assocClassCache->insert(lowerCaseFromClassName,oldAssocClassEntryList); |
return _assocClassCache->insert(fromClassName,oldAssocClassEntryList); |
} | } |
| |
/** Remove an entry from the association cache specified by the given | /** Remove an entry from the association cache specified by the given |
* from class name. | * from class name. |
*/ | */ |
Boolean AssocClassCache::removeEntry(const String& lowerCaseFromClassName) |
Boolean AssocClassCache::removeEntry(const String& fromClassName) |
{ | { |
return _assocClassCache->remove(lowerCaseFromClassName); |
return _assocClassCache->remove(fromClassName); |
} | } |
| |
/** Remove an association record from the association cache specified by the given | /** Remove an association record from the association cache specified by the given |
* from class name and association name. | * from class name and association name. |
*/ | */ |
Boolean AssocClassCache::removeRecord(const String& lowerCaseFromClassName, |
Boolean AssocClassCache::removeRecord(const String& fromClassName, |
const String& lowerCaseAssocClassName) |
const String& assocClassName) |
{ | { |
Array< Array<String> > oldAssocClassEntryList; | Array< Array<String> > oldAssocClassEntryList; |
if (_assocClassCache->lookup(lowerCaseFromClassName, oldAssocClassEntryList)) |
|
|
if (_assocClassCache->lookup(fromClassName, oldAssocClassEntryList)) |
{ | { |
for (Uint16 idx=0; idx < oldAssocClassEntryList.size(); idx++ ) | for (Uint16 idx=0; idx < oldAssocClassEntryList.size(); idx++ ) |
{ | { |
// The first entry in each record is the association class | // The first entry in each record is the association class |
// name. Find the record for the association class and remove | // name. Find the record for the association class and remove |
// it from the cache entry. | // it from the cache entry. |
if (oldAssocClassEntryList[idx][ASSOC_CLASS_NAME_INDEX] == lowerCaseAssocClassName) |
if (String::equalNoCase(oldAssocClassEntryList[idx][ASSOC_CLASS_NAME_INDEX], |
|
assocClassName)) |
{ | { |
_assocClassCache->remove(lowerCaseFromClassName); |
_assocClassCache->remove(fromClassName); |
if (oldAssocClassEntryList.size() > 1) | if (oldAssocClassEntryList.size() > 1) |
{ | { |
oldAssocClassEntryList.remove(idx); | oldAssocClassEntryList.remove(idx); |
_assocClassCache->insert(lowerCaseFromClassName,oldAssocClassEntryList); |
_assocClassCache->insert(fromClassName,oldAssocClassEntryList); |
} | } |
return true; | return true; |
} | } |