@Test public void testFindByEPerson() throws Exception { EPerson ep = context.getCurrentUser(); WorkspaceItem[] found = WorkspaceItem.findByEPerson(context, ep); assertThat("testFindByEPerson 0",found,notNullValue()); assertTrue("testFindByEPerson 1",found.length >= 1); boolean exists = false; for(WorkspaceItem w: found) { if(w.equals(wi)) { exists = true; } } assertTrue("testFindByEPerson 2",exists); }
public static WorkspaceItem[] findByEPerson(Context context, EPerson ep) throws SQLException { List<WorkspaceItem> wsItems = new ArrayList<WorkspaceItem>(); TableRowIterator tri = DatabaseManager.queryTable(context, "workspaceitem", "SELECT workspaceitem.* FROM workspaceitem, item WHERE " + "workspaceitem.item_id=item.item_id AND " + "item.submitter_id= ? " + "ORDER BY workspaceitem.workspace_item_id", ep.getID()); try { while (tri.hasNext()) { TableRow row = tri.next(); WorkspaceItem wi = (WorkspaceItem) context.fromCache( WorkspaceItem.class, row.getIntColumn("workspace_item_id")); if (wi == null) { wi = new WorkspaceItem(context, row); } wsItems.add(wi); } } finally { if (tri != null) { tri.close(); } } return wsItems.toArray(new WorkspaceItem[wsItems.size()]); }
WorkspaceItem implements InProgressSubmission { public static WorkspaceItem[] findByEPerson(Context context, EPerson ep) throws SQLException { List<WorkspaceItem> wsItems = new ArrayList<WorkspaceItem>(); TableRowIterator tri = DatabaseManager.queryTable(context, "workspaceitem", "SELECT workspaceitem.* FROM workspaceitem, item WHERE " + "workspaceitem.item_id=item.item_id AND " + "item.submitter_id= ? " + "ORDER BY workspaceitem.workspace_item_id", ep.getID()); try { while (tri.hasNext()) { TableRow row = tri.next(); WorkspaceItem wi = (WorkspaceItem) context.fromCache( WorkspaceItem.class, row.getIntColumn("workspace_item_id")); if (wi == null) { wi = new WorkspaceItem(context, row); } wsItems.add(wi); } } finally { if (tri != null) { tri.close(); } } return wsItems.toArray(new WorkspaceItem[wsItems.size()]); } }
WorkspaceItem implements InProgressSubmission { public static WorkspaceItem[] findByEPerson(Context context, EPerson ep) throws SQLException { List<WorkspaceItem> wsItems = new ArrayList<WorkspaceItem>(); TableRowIterator tri = DatabaseManager.queryTable(context, "workspaceitem", "SELECT workspaceitem.* FROM workspaceitem, item WHERE " + "workspaceitem.item_id=item.item_id AND " + "item.submitter_id= ? " + "ORDER BY workspaceitem.workspace_item_id", ep.getID()); try { while (tri.hasNext()) { TableRow row = tri.next(); WorkspaceItem wi = (WorkspaceItem) context.fromCache( WorkspaceItem.class, row.getIntColumn("workspace_item_id")); if (wi == null) { wi = new WorkspaceItem(context, row); } wsItems.add(wi); } } finally { if (tri != null) { tri.close(); } } return wsItems.toArray(new WorkspaceItem[wsItems.size()]); } WorkspaceItem(Context context, TableRow row); }
WorkspaceItem implements InProgressSubmission { public static WorkspaceItem[] findByEPerson(Context context, EPerson ep) throws SQLException { List<WorkspaceItem> wsItems = new ArrayList<WorkspaceItem>(); TableRowIterator tri = DatabaseManager.queryTable(context, "workspaceitem", "SELECT workspaceitem.* FROM workspaceitem, item WHERE " + "workspaceitem.item_id=item.item_id AND " + "item.submitter_id= ? " + "ORDER BY workspaceitem.workspace_item_id", ep.getID()); try { while (tri.hasNext()) { TableRow row = tri.next(); WorkspaceItem wi = (WorkspaceItem) context.fromCache( WorkspaceItem.class, row.getIntColumn("workspace_item_id")); if (wi == null) { wi = new WorkspaceItem(context, row); } wsItems.add(wi); } } finally { if (tri != null) { tri.close(); } } return wsItems.toArray(new WorkspaceItem[wsItems.size()]); } WorkspaceItem(Context context, TableRow row); static WorkspaceItem find(Context context, int id); static WorkspaceItem create(Context c, Collection coll,
            boolean template); static WorkspaceItem[] findByEPerson(Context context, EPerson ep); static WorkspaceItem[] findByCollection(Context context, Collection c); static WorkspaceItem findByItem(Context context, Item i); static WorkspaceItem[] findAll(Context context); int getID(); int getStageReached(); void setStageReached(int v); int getPageReached(); void setPageReached(int v); void update(); boolean equals(Object o); int hashCode(); void deleteAll(); void deleteWrapper(); Item getItem(); Collection getCollection(); EPerson getSubmitter(); boolean hasMultipleFiles(); void setMultipleFiles(boolean b); boolean hasMultipleTitles(); void setMultipleTitles(boolean b); boolean isPublishedBefore(); void setPublishedBefore(boolean b); }
WorkspaceItem implements InProgressSubmission { public static WorkspaceItem[] findByEPerson(Context context, EPerson ep) throws SQLException { List<WorkspaceItem> wsItems = new ArrayList<WorkspaceItem>(); TableRowIterator tri = DatabaseManager.queryTable(context, "workspaceitem", "SELECT workspaceitem.* FROM workspaceitem, item WHERE " + "workspaceitem.item_id=item.item_id AND " + "item.submitter_id= ? " + "ORDER BY workspaceitem.workspace_item_id", ep.getID()); try { while (tri.hasNext()) { TableRow row = tri.next(); WorkspaceItem wi = (WorkspaceItem) context.fromCache( WorkspaceItem.class, row.getIntColumn("workspace_item_id")); if (wi == null) { wi = new WorkspaceItem(context, row); } wsItems.add(wi); } } finally { if (tri != null) { tri.close(); } } return wsItems.toArray(new WorkspaceItem[wsItems.size()]); } WorkspaceItem(Context context, TableRow row); static WorkspaceItem find(Context context, int id); static WorkspaceItem create(Context c, Collection coll,
            boolean template); static WorkspaceItem[] findByEPerson(Context context, EPerson ep); static WorkspaceItem[] findByCollection(Context context, Collection c); static WorkspaceItem findByItem(Context context, Item i); static WorkspaceItem[] findAll(Context context); int getID(); int getStageReached(); void setStageReached(int v); int getPageReached(); void setPageReached(int v); void update(); boolean equals(Object o); int hashCode(); void deleteAll(); void deleteWrapper(); Item getItem(); Collection getCollection(); EPerson getSubmitter(); boolean hasMultipleFiles(); void setMultipleFiles(boolean b); boolean hasMultipleTitles(); void setMultipleTitles(boolean b); boolean isPublishedBefore(); void setPublishedBefore(boolean b);  }