Beispiel #1
0
 protected void init() {
   // System.err.println( "INIT: _sc.getBeanName() = " + _sc.getBeanName() );
   try {
     if (_cache == null) {
       _cache = ObjectCacheFactory.defaultObjectCache();
     }
     _sod = SODUtils.getInstance();
     // Try to retrive from cache.
     _sc.setReturnCount(new Boolean(true));
     _sc.setReturnObjects(new Boolean(true));
     SearchResult sr = _cache.get(_sc);
     if (sr == null) {
       sr = _sc.search();
       _cache.put(_sc, sr);
     }
     _count = sr.getCount().intValue();
     List newItems = Arrays.asList(sr.getResultSet());
     for (Iterator i = newItems.iterator(); i.hasNext(); ) {
       _objects.add(i.next());
     }
   } catch (Exception ex) {
     ex.printStackTrace();
     throw new RuntimeException("Error initializing: " + ex.toString());
   }
 }