@Test public void testFindAll() throws SQLException { BitstreamFormat[] found = BitstreamFormat.findAll(context); assertThat("testFindAll 0", found, notNullValue()); assertThat("testFindAll 1", found[0].getShortDescription(), equalTo("Unknown")); assertFalse("testFindAll 2", found[0].isInternal()); assertThat("testFindAll 3", found[0].getSupportLevel(), equalTo(0)); boolean added = false; for(BitstreamFormat bsf: found) { if(bsf.equals(bf)) { added = true; } } assertTrue("testFindAll 4",added); }
public static BitstreamFormat[] findAll(Context context) throws SQLException { List<BitstreamFormat> formats = new ArrayList<BitstreamFormat>(); TableRowIterator tri = DatabaseManager.queryTable(context, "bitstreamformatregistry", "SELECT * FROM bitstreamformatregistry ORDER BY bitstream_format_id"); try { while (tri.hasNext()) { TableRow row = tri.next(); BitstreamFormat fromCache = (BitstreamFormat) context.fromCache( BitstreamFormat.class, row .getIntColumn("bitstream_format_id")); if (fromCache != null) { formats.add(fromCache); } else { formats.add(new BitstreamFormat(context, row)); } } } finally { if (tri != null) { tri.close(); } } BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()]; formatArray = (BitstreamFormat[]) formats.toArray(formatArray); return formatArray; }
BitstreamFormat { public static BitstreamFormat[] findAll(Context context) throws SQLException { List<BitstreamFormat> formats = new ArrayList<BitstreamFormat>(); TableRowIterator tri = DatabaseManager.queryTable(context, "bitstreamformatregistry", "SELECT * FROM bitstreamformatregistry ORDER BY bitstream_format_id"); try { while (tri.hasNext()) { TableRow row = tri.next(); BitstreamFormat fromCache = (BitstreamFormat) context.fromCache( BitstreamFormat.class, row .getIntColumn("bitstream_format_id")); if (fromCache != null) { formats.add(fromCache); } else { formats.add(new BitstreamFormat(context, row)); } } } finally { if (tri != null) { tri.close(); } } BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()]; formatArray = (BitstreamFormat[]) formats.toArray(formatArray); return formatArray; } }
BitstreamFormat { public static BitstreamFormat[] findAll(Context context) throws SQLException { List<BitstreamFormat> formats = new ArrayList<BitstreamFormat>(); TableRowIterator tri = DatabaseManager.queryTable(context, "bitstreamformatregistry", "SELECT * FROM bitstreamformatregistry ORDER BY bitstream_format_id"); try { while (tri.hasNext()) { TableRow row = tri.next(); BitstreamFormat fromCache = (BitstreamFormat) context.fromCache( BitstreamFormat.class, row .getIntColumn("bitstream_format_id")); if (fromCache != null) { formats.add(fromCache); } else { formats.add(new BitstreamFormat(context, row)); } } } finally { if (tri != null) { tri.close(); } } BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()]; formatArray = (BitstreamFormat[]) formats.toArray(formatArray); return formatArray; } BitstreamFormat(Context context, TableRow row); }
BitstreamFormat { public static BitstreamFormat[] findAll(Context context) throws SQLException { List<BitstreamFormat> formats = new ArrayList<BitstreamFormat>(); TableRowIterator tri = DatabaseManager.queryTable(context, "bitstreamformatregistry", "SELECT * FROM bitstreamformatregistry ORDER BY bitstream_format_id"); try { while (tri.hasNext()) { TableRow row = tri.next(); BitstreamFormat fromCache = (BitstreamFormat) context.fromCache( BitstreamFormat.class, row .getIntColumn("bitstream_format_id")); if (fromCache != null) { formats.add(fromCache); } else { formats.add(new BitstreamFormat(context, row)); } } } finally { if (tri != null) { tri.close(); } } BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()]; formatArray = (BitstreamFormat[]) formats.toArray(formatArray); return formatArray; } BitstreamFormat(Context context, TableRow row); static BitstreamFormat find(Context context, int id); static BitstreamFormat findByMIMEType(Context context,
            String mimeType); static BitstreamFormat findByShortDescription(Context context,
            String desc); static BitstreamFormat findUnknown(Context context); static BitstreamFormat[] findAll(Context context); static BitstreamFormat[] findNonInternal(Context context); static BitstreamFormat create(Context context); final int getID(); final String getShortDescription(); final void setShortDescription(String s); final String getDescription(); final void setDescription(String s); final String getMIMEType(); final void setMIMEType(String s); final int getSupportLevel(); String getSupportLevelText(); final void setSupportLevel(int sl); final boolean isInternal(); final void setInternal(boolean b); void update(); void delete(); String[] getExtensions(); void setExtensions(String[] exts); static int getSupportLevelID(String slevel); }
BitstreamFormat { public static BitstreamFormat[] findAll(Context context) throws SQLException { List<BitstreamFormat> formats = new ArrayList<BitstreamFormat>(); TableRowIterator tri = DatabaseManager.queryTable(context, "bitstreamformatregistry", "SELECT * FROM bitstreamformatregistry ORDER BY bitstream_format_id"); try { while (tri.hasNext()) { TableRow row = tri.next(); BitstreamFormat fromCache = (BitstreamFormat) context.fromCache( BitstreamFormat.class, row .getIntColumn("bitstream_format_id")); if (fromCache != null) { formats.add(fromCache); } else { formats.add(new BitstreamFormat(context, row)); } } } finally { if (tri != null) { tri.close(); } } BitstreamFormat[] formatArray = new BitstreamFormat[formats.size()]; formatArray = (BitstreamFormat[]) formats.toArray(formatArray); return formatArray; } BitstreamFormat(Context context, TableRow row); static BitstreamFormat find(Context context, int id); static BitstreamFormat findByMIMEType(Context context,
            String mimeType); static BitstreamFormat findByShortDescription(Context context,
            String desc); static BitstreamFormat findUnknown(Context context); static BitstreamFormat[] findAll(Context context); static BitstreamFormat[] findNonInternal(Context context); static BitstreamFormat create(Context context); final int getID(); final String getShortDescription(); final void setShortDescription(String s); final String getDescription(); final void setDescription(String s); final String getMIMEType(); final void setMIMEType(String s); final int getSupportLevel(); String getSupportLevelText(); final void setSupportLevel(int sl); final boolean isInternal(); final void setInternal(boolean b); void update(); void delete(); String[] getExtensions(); void setExtensions(String[] exts); static int getSupportLevelID(String slevel); static final int UNKNOWN; static final int KNOWN; static final int SUPPORTED; }