/** * Find the component with the specified ID * * @param id component ID to search for * @return ProjectComponent with the specified ID * @throws EntityNotFoundException if the component is not found */ public ProjectComponent find(Long id) throws EntityNotFoundException { return convertToProjectComponent(store.find(id)); }
@Override public CacheObject<ProjectComponent> load(@Nonnull final Long id) { try { return new CacheObject<ProjectComponent>(CachingProjectComponentStore.this.delegateStore.find(id)); } catch (EntityNotFoundException e) { return CacheObject.NULL(); } } }
/** * Removes the component from the persistent storage and a cache. * * @param componentId the id of the component to delete * @throws EntityNotFoundException if component does not exist (maybe was removed previously :-) */ public void delete(Long componentId) throws EntityNotFoundException { ProjectComponent component = null; if (componentId != null) { component = delegateStore.find(componentId); } delegateStore.delete(componentId); if (componentId != null) { componentIdToComponentMap.remove(componentId); } if (component != null) { projectIdToComponentsMap.remove(component.getProjectId()); } }