public ApiResource getResource(String namespace, String resourceName) throws ApsSystemException { try { if (null == this.getMasterResources()) { this.loadResources(); } String resourceCode = this.getResourceCode(namespace, resourceName); ApiResource apiResource = this.getMasterResources().get(resourceCode); if (null != apiResource) { return apiResource.clone(); } } catch (Throwable t) { ApsSystemUtils.logThrowable( t, this, "getApiResource", "Error extracting resource by name '" + resourceName + "'"); throw new ApsSystemException("Error extracting resource", t); } return null; }
public Map<String, ApiResource> getResources() throws ApsSystemException { Map<String, ApiResource> clonedApiResources = new HashMap<String, ApiResource>(); try { if (null == this.getMasterResources()) { this.loadResources(); } Iterator<String> iterator = this.getMasterResources().keySet().iterator(); while (iterator.hasNext()) { String resourceFullCode = iterator.next(); ApiResource resource = this.getMasterResources().get(resourceFullCode); clonedApiResources.put(resourceFullCode, resource.clone()); } } catch (Throwable t) { ApsSystemUtils.logThrowable(t, this, "getApiResources", "Error extracting resources"); throw new ApsSystemException("Error extracting resources", t); } return clonedApiResources; }