@Test public void getCollectionsOfProduct () { long pid = 1; List<Collection> collections = dao.getCollectionsOfProduct (pid); Assert.assertNotNull (collections); Assert.assertEquals (collections.size (), 3); Assert.assertTrue (collections.contains (dao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa1"))); Assert.assertTrue (collections.contains (dao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa3"))); Assert.assertTrue (collections.contains (dao.read ("aaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa4"))); }
@SuppressWarnings ("unchecked") public List<Collection> getCollectionsOfProduct (final Long product_id) { return (List<Collection>) getHibernateTemplate ().find ( "select c " + "from Collection c left outer join c.products p " + "where p.id = ? ORDER BY c.name", product_id); }
CollectionDao extends HibernateDao<Collection, String> { @SuppressWarnings ("unchecked") public List<Collection> getCollectionsOfProduct (final Long product_id) { return (List<Collection>) getHibernateTemplate ().find ( "select c " + "from Collection c left outer join c.products p " + "where p.id = ? ORDER BY c.name", product_id); } }
CollectionDao extends HibernateDao<Collection, String> { @SuppressWarnings ("unchecked") public List<Collection> getCollectionsOfProduct (final Long product_id) { return (List<Collection>) getHibernateTemplate ().find ( "select c " + "from Collection c left outer join c.products p " + "where p.id = ? ORDER BY c.name", product_id); }  }
CollectionDao extends HibernateDao<Collection, String> { @SuppressWarnings ("unchecked") public List<Collection> getCollectionsOfProduct (final Long product_id) { return (List<Collection>) getHibernateTemplate ().find ( "select c " + "from Collection c left outer join c.products p " + "where p.id = ? ORDER BY c.name", product_id); }  int count(User user); @Override void delete(final Collection collection); @Override void deleteAll(); Collection create(Collection collection, User user); boolean contains(final String cid, final Long pid); void removeProduct(final String cid, final Long pid, User user); void removeProducts(final String cid, final Long[] pids, User user); @SuppressWarnings ("unchecked") List<Collection> getCollectionsOfProduct(final Long product_id); List<Long> getProductIds(final String collection_uuid, User user); @SuppressWarnings ("unchecked") List<String> getAuthorizedCollections(String user_uuid); @SuppressWarnings ("unchecked") List<User> getAuthorizedUsers(final Collection collection); String getCollectionUUIDByName(final String collection_name); boolean hasAccessToCollection(final String cid, final String uid); Iterator<Collection> getAllCollections(); }
CollectionDao extends HibernateDao<Collection, String> { @SuppressWarnings ("unchecked") public List<Collection> getCollectionsOfProduct (final Long product_id) { return (List<Collection>) getHibernateTemplate ().find ( "select c " + "from Collection c left outer join c.products p " + "where p.id = ? ORDER BY c.name", product_id); }  int count(User user); @Override void delete(final Collection collection); @Override void deleteAll(); Collection create(Collection collection, User user); boolean contains(final String cid, final Long pid); void removeProduct(final String cid, final Long pid, User user); void removeProducts(final String cid, final Long[] pids, User user); @SuppressWarnings ("unchecked") List<Collection> getCollectionsOfProduct(final Long product_id); List<Long> getProductIds(final String collection_uuid, User user); @SuppressWarnings ("unchecked") List<String> getAuthorizedCollections(String user_uuid); @SuppressWarnings ("unchecked") List<User> getAuthorizedUsers(final Collection collection); String getCollectionUUIDByName(final String collection_name); boolean hasAccessToCollection(final String cid, final String uid); Iterator<Collection> getAllCollections(); final static String HIDDEN_PREFIX; final static String COLLECTION_ROOT_NAME; }