@Override public ExhibitionSection getExhibitionSection(ExhibitionSection search) { if (searchExhibitionSectionsByID.containsKey(search.getId())) { return searchExhibitionSectionsByID.get(search.getId()); } if (searchExhibitionSectionsByName.containsKey(nameKey(search))) { return searchExhibitionSectionsByName.get(nameKey(search)); } return search; }
@Override public boolean isAddable(ExhibitionSection exhibitionSection) { if (!searchExhibitionSectionsByName.containsKey(nameKey(exhibitionSection))) return true; return (Objects.equals( searchExhibitionSectionsByName.get(nameKey(exhibitionSection)).getId(), exhibitionSection.getId())); }
private void buildIndexes() { // Clear All Indexes searchExhibitionSectionsByName.clear(); searchExhibitionSectionsByID.clear(); // Rebuild them... for (Iterator it = collection.iterator(); it.hasNext(); ) { ExhibitionSection exhibitionSection = (ExhibitionSection) it.next(); searchExhibitionSectionsByID.put(exhibitionSection.getId(), exhibitionSection); searchExhibitionSectionsByName.put(nameKey(exhibitionSection), exhibitionSection); } }