@Override protected Collection<Region> retrieveJDOObjects( Set<RegionID> objectIDs, String[] fetchGroups, int maxFetchDepth, ProgressMonitor monitor) throws Exception { monitor.beginTask("Loading Regions", 100); try { GeographyManagerRemote gm = geographyManager; if (gm == null) gm = getEjbProvider().getRemoteBean(GeographyManagerRemote.class); monitor.worked(50); Collection<Region> regions = gm.getRegions(objectIDs, fetchGroups, maxFetchDepth); monitor.worked(50); return regions; } catch (Exception x) { throw new RuntimeException(x); } finally { monitor.done(); } }
public synchronized Region importRegion( RegionID regionID, boolean get, String[] fetchGroups, int maxFetchDepth, ProgressMonitor monitor) { monitor.beginTask("Importing region", 100); try { GeographyManagerRemote gm = getEjbProvider().getRemoteBean(GeographyManagerRemote.class); monitor.worked(10); Region region = gm.importRegion(regionID, get, fetchGroups, maxFetchDepth); if (region != null) getCache().put(null, region, fetchGroups, maxFetchDepth); monitor.worked(90); return region; } catch (Exception e) { throw new RuntimeException(e); } finally { monitor.done(); } }
/** * Get the {@link Region}s of the specified {@link Country} or all regions, if <code>countryID * </code> is <code>null</code>. * * @param countryID the object-id of the country containing the requested regions or <code>null * </code> to obtain all regions. * @param fetchGroups the fetch-groups or <code>null</code>. * @param maxFetchDepth the maximum fetch-depth (i.e. the maximum depth of the returned object * graph). Use {@link NLJDOHelper#MAX_FETCH_DEPTH_NO_LIMIT} for unlimited graph depth. * @param monitor the monitor for progress feedback. * @return the regions. */ public synchronized List<Region> getRegions( CountryID countryID, String[] fetchGroups, int maxFetchDepth, ProgressMonitor monitor) { monitor.beginTask("Getting regions", 100); try { geographyManager = getEjbProvider().getRemoteBean(GeographyManagerRemote.class); monitor.worked(10); Collection<RegionID> regionIDs = geographyManager.getRegionIDs(countryID); monitor.worked(40); return getJDOObjects( null, regionIDs, fetchGroups, maxFetchDepth, new SubProgressMonitor(monitor, 50)); } catch (Exception x) { throw new RuntimeException(x); } finally { geographyManager = null; monitor.done(); } }