protected void setFormatToMIMEType(Context context, Bitstream bs, String mimeType) throws SQLException { List<BitstreamFormat> bf = bitstreamFormatService.findNonInternal(context); for (BitstreamFormat aBf : bf) { if (aBf.getMIMEType().equalsIgnoreCase(mimeType)) { bs.setFormat(context, aBf); break; } } }
/** * Get the list of MIME types that the given DSpace object will * accept as packages. * * @param context The relevant DSpace Context. * @param dso target DSpace object * @return the list of MIME types that the given DSpace object will * accept as packages. * @throws DSpaceSWORDException can be thrown by the internals of the DSpace SWORD implementation */ public List<String> getAccepts(Context context, DSpaceObject dso) throws DSpaceSWORDException { try { List<String> accepts = new ArrayList<String>(); if (dso instanceof Collection) { for (String format : swordaccepts) { accepts.add(format); } } else if (dso instanceof Item) { List<BitstreamFormat> bfs = bitstreamFormatService .findNonInternal(context); for (BitstreamFormat bf : bfs) { accepts.add(bf.getMIMEType()); } } return accepts; } catch (SQLException e) { throw new DSpaceSWORDException(e); } }
.findNonInternal(context); for (BitstreamFormat bf : bfs) { accepts.add(bf.getMIMEType());