@Test public void testFindAll() throws Exception { Collection[] all = Collection.findAll(context); assertThat("testFindAll 0", all, notNullValue()); assertTrue("testFindAll 1", all.length >= 1); boolean added = false; for(Collection cl: all) { if(cl.equals(c)) { added = true; } } assertTrue("testFindAll 2",added); }
public static Collection[] findAll(Context context) throws SQLException { TableRowIterator tri = DatabaseManager.queryTable(context, "collection", "SELECT * FROM collection ORDER BY name"); List<Collection> collections = new ArrayList<Collection>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) context.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(context, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; }
Collection extends DSpaceObject { public static Collection[] findAll(Context context) throws SQLException { TableRowIterator tri = DatabaseManager.queryTable(context, "collection", "SELECT * FROM collection ORDER BY name"); List<Collection> collections = new ArrayList<Collection>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) context.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(context, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; } }
Collection extends DSpaceObject { public static Collection[] findAll(Context context) throws SQLException { TableRowIterator tri = DatabaseManager.queryTable(context, "collection", "SELECT * FROM collection ORDER BY name"); List<Collection> collections = new ArrayList<Collection>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) context.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(context, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; } Collection(Context context, TableRow row); }
Collection extends DSpaceObject { public static Collection[] findAll(Context context) throws SQLException { TableRowIterator tri = DatabaseManager.queryTable(context, "collection", "SELECT * FROM collection ORDER BY name"); List<Collection> collections = new ArrayList<Collection>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) context.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(context, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; } Collection(Context context, TableRow row); static Collection find(Context context, int id); static Collection[] findAll(Context context); ItemIterator getItems(); ItemIterator getAllItems(); int getID(); String getHandle(); String getMetadata(String field); void setMetadata(String field, String value); String getName(); Bitstream getLogo(); Bitstream setLogo(InputStream is); Group createWorkflowGroup(int step); void setWorkflowGroup(int step, Group g); Group getWorkflowGroup(int step); Group createSubmitters(); void removeSubmitters(); Group getSubmitters(); Group createAdministrators(); void removeAdministrators(); Group getAdministrators(); String getLicense(); String getLicenseCollection(); boolean hasCustomLicense(); void setLicense(String license); Item getTemplateItem(); void createTemplateItem(); void removeTemplateItem(); void addItem(Item item); void removeItem(Item item); void update(); boolean canEditBoolean(); boolean canEditBoolean(boolean useInheritance); void canEdit(); void canEdit(boolean useInheritance); Community[] getCommunities(); @Override boolean equals(Object other); @Override int hashCode(); int getType(); static Collection[] findAuthorized(Context context, Community comm,
            int actionID); int countItems(); DSpaceObject getAdminObject(int action); @Override DSpaceObject getParentObject(); }
Collection extends DSpaceObject { public static Collection[] findAll(Context context) throws SQLException { TableRowIterator tri = DatabaseManager.queryTable(context, "collection", "SELECT * FROM collection ORDER BY name"); List<Collection> collections = new ArrayList<Collection>(); try { while (tri.hasNext()) { TableRow row = tri.next(); Collection fromCache = (Collection) context.fromCache( Collection.class, row.getIntColumn("collection_id")); if (fromCache != null) { collections.add(fromCache); } else { collections.add(new Collection(context, row)); } } } finally { if (tri != null) { tri.close(); } } Collection[] collectionArray = new Collection[collections.size()]; collectionArray = (Collection[]) collections.toArray(collectionArray); return collectionArray; } Collection(Context context, TableRow row); static Collection find(Context context, int id); static Collection[] findAll(Context context); ItemIterator getItems(); ItemIterator getAllItems(); int getID(); String getHandle(); String getMetadata(String field); void setMetadata(String field, String value); String getName(); Bitstream getLogo(); Bitstream setLogo(InputStream is); Group createWorkflowGroup(int step); void setWorkflowGroup(int step, Group g); Group getWorkflowGroup(int step); Group createSubmitters(); void removeSubmitters(); Group getSubmitters(); Group createAdministrators(); void removeAdministrators(); Group getAdministrators(); String getLicense(); String getLicenseCollection(); boolean hasCustomLicense(); void setLicense(String license); Item getTemplateItem(); void createTemplateItem(); void removeTemplateItem(); void addItem(Item item); void removeItem(Item item); void update(); boolean canEditBoolean(); boolean canEditBoolean(boolean useInheritance); void canEdit(); void canEdit(boolean useInheritance); Community[] getCommunities(); @Override boolean equals(Object other); @Override int hashCode(); int getType(); static Collection[] findAuthorized(Context context, Community comm,
            int actionID); int countItems(); DSpaceObject getAdminObject(int action); @Override DSpaceObject getParentObject();  }