/** * {@inheritDoc} * * @return {@inheritDoc} */ public List<ServiceNavigationTree> getAllServiceTrees() { List<ServiceNavigationTree> treeList = new ArrayList<ServiceNavigationTree>(); for (final Company company : mCompanies) { treeList.add(company.getServiceNavigationTree()); } return treeList; }
private Company findFromList(final String pCompanyName) { LOG.debug("Looking up company name - " + pCompanyName); for (final Company company : mCompanies) { if (pCompanyName.toLowerCase().equals(company.getName().toLowerCase())) { return company; } } return null; }
/** * {@inheritDoc} * * @param pCompanyName {@inheritDoc} * @return {@inheritDoc} */ public ServiceNavigationTree getServiceTree(final String pCompanyName) { if (pCompanyName == null || pCompanyName.length() == 0) { throw new IllegalArgumentException("Company name is expecting not null."); } // Look up in cache table. Company company = mCacheCompanyMap.get(pCompanyName); if (company == null) { // Find through interating all companies company = findFromList(pCompanyName); // Update cache map mCacheCompanyMap.put(pCompanyName, company); // Still company is null if (company != null) { return company.getServiceNavigationTree(); } } else { return company.getServiceNavigationTree(); } return null; }