/** * 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(); } }