/** * Constructor. * @param organization the organization * @param id the id */ public OrganizationBasedCompositeId(OrganizationBean organization, String id) { this.setOrganization(organization); this.setId(id); }
/** * Get object of type T * * @param organizationId org id * @param id identity * @param type class of type T * @return Instance of type T * @throws StorageException if a storage problem occurs while storing a bean */ public <T> T get(String organizationId, String id, Class<T> type) throws StorageException { T rval; EntityManager entityManager = getActiveEntityManager(); try { OrganizationBean orgBean = entityManager.find(OrganizationBean.class, organizationId); Object key = new OrganizationBasedCompositeId(orgBean, id); rval = entityManager.find(type, key); } catch (Throwable t) { logger.error(t.getMessage(), t); throw new StorageException(t); } return rval; }
/** * Get object of type T * * @param organizationId org id * @param id identity * @param type class of type T * @return Instance of type T * @throws StorageException if a storage problem occurs while storing a bean */ public <T> T get(String organizationId, String id, Class<T> type) throws StorageException { T rval; EntityManager entityManager = getActiveEntityManager(); try { OrganizationBean orgBean = entityManager.find(OrganizationBean.class, organizationId); Object key = new OrganizationBasedCompositeId(orgBean, id); rval = entityManager.find(type, key); } catch (Throwable t) { logger.error(t.getMessage(), t); throw new StorageException(t); } return rval; }
/** * Constructor. * @param organization the organization * @param id the id */ public OrganizationBasedCompositeId(OrganizationBean organization, String id) { this.setOrganization(organization); this.setId(id); }