public Group getGroup(String name) throws GroupNotFoundException {
DbCacheManager cacheManager = factory.getCacheManager();
//If cache is not enabled, do a new lookup of object
if (!cacheManager.isCacheEnabled()) {
Group group = new DbGroup(name, null, factory);
return getGroup(group.getID());
}
//Cache is enabled.
CacheableInteger groupIDInteger = (CacheableInteger) cacheManager.get(DbCacheManager.GROUP_ID_CACHE, name);
//if id wan't found in cache, load it up and put it there.
if (groupIDInteger == null) {
Group group = new DbGroup(name, null, factory);
groupIDInteger = new CacheableInteger(new Integer(group.getID()));
cacheManager.add(DbCacheManager.GROUP_ID_CACHE, name, groupIDInteger);
}
return getGroup(groupIDInteger.getInteger().intValue());
}