@Override public void setLicenseRDF(Context context, Item item, String licenseRdf) throws SQLException, IOException, AuthorizeException { Bundle bundle = getCcBundle(context, item); // set the format BitstreamFormat bs_rdf_format = bitstreamFormatService.findByShortDescription(context, "RDF XML"); // set the RDF bitstream setBitstreamFromBytes(context, item, bundle, BSN_LICENSE_RDF, bs_rdf_format, licenseRdf.getBytes()); }
private void formatResults() throws IOException { try { StringBuilder sb = new StringBuilder(); for (String fmt : fmtTable.keySet()) { BitstreamFormat bsf = bitstreamFormatService.findByShortDescription(Curator.curationContext(), fmt); sb.append(String.format("%6d", fmtTable.get(fmt))).append(" ("). append(bitstreamFormatService.getSupportLevelText(bsf).charAt(0)).append(") "). append(bsf.getDescription()).append("\n"); } report(sb.toString()); setResult(sb.toString()); } catch (SQLException sqlE) { throw new IOException(sqlE.getMessage(), sqlE); } } }
@Override public void setLicense(Context context, Item item, InputStream licenseStm, String mimeType) throws SQLException, IOException, AuthorizeException { Bundle bundle = getCcBundle(context, item); // set the format BitstreamFormat bs_format; if (mimeType.equalsIgnoreCase("text/xml")) { bs_format = bitstreamFormatService.findByShortDescription(context, "CC License"); } else if (mimeType.equalsIgnoreCase("text/rdf")) { bs_format = bitstreamFormatService.findByShortDescription(context, "RDF XML"); } else { bs_format = bitstreamFormatService.findByShortDescription(context, "License"); } Bitstream bs = bitstreamService.create(context, bundle, licenseStm); bs.setSource(context, CC_BS_SOURCE); bs.setName(context, (mimeType != null && (mimeType.equalsIgnoreCase("text/xml") || mimeType.equalsIgnoreCase("text/rdf"))) ? BSN_LICENSE_RDF : BSN_LICENSE_TEXT); bs.setFormat(context, bs_format); bitstreamService.update(context, bs); }
public GoogleBitstreamComparator(Context context, Map<String, String> googleScholarSettings) { this.context = context; String[] shortDescriptions; if (googleScholarSettings.containsKey("citation.prioritized_types")) { shortDescriptions = splitAndTrim(googleScholarSettings.get("citation.prioritized_types")); } else { log.warn("Please define citation.prioritized_types in google-metadata.properties"); shortDescriptions = new String[0]; } int priority = 1; for (String s : shortDescriptions) { try { BitstreamFormat format = ContentServiceFactory.getInstance().getBitstreamFormatService() .findByShortDescription(context, s); if (format != null) { priorityMap.put(format.getMIMEType(), priority); } else { log.warn(s + " is not a valid short description, please add it to bitstream-formats.xml"); } priority++; } catch (SQLException e) { log.error(e.getMessage()); } } }
BitstreamFormat bf = bitstreamFormatService.findByShortDescription(context, "License"); if (bf != null) {
BitstreamFormat bf = bitstreamFormatService.findByShortDescription(context, "License"); if (bf == null) { bf = bitstreamFormatService.guessFormat(context, lbs);
BitstreamFormat bsf = bitstreamFormatService.findByShortDescription(context, bsfShortName); if (bsf == null && bsfMIMEType != null) { bsf = PackageUtils.findOrCreateBitstreamFormat(context,
BitstreamFormat pdff = bitstreamFormatService.findByShortDescription(context, BITSTREAM_FORMAT_NAME); if (pdff == null) {
BitstreamFormat bf = bitstreamFormat.findByShortDescription(context, "License"); b.setFormat(bf);
exists = bitstreamFormatService.findByShortDescription(context, shortDesc);
@Override public void removeLicenses(Context context, Item item) throws SQLException, AuthorizeException, IOException { // Find the License format BitstreamFormat bf = bitstreamFormatService.findByShortDescription(context, "License"); int licensetype = bf.getID(); // search through bundles, looking for bitstream type license List<Bundle> bunds = item.getBundles(); for (Bundle bund : bunds) { boolean removethisbundle = false; List<Bitstream> bits = bund.getBitstreams(); for (Bitstream bit : bits) { BitstreamFormat bft = bit.getFormat(context); if (bft.getID() == licensetype) { removethisbundle = true; } } // probably serious troubles with Authorizations // fix by telling system not to check authorization? if (removethisbundle) { removeBundle(context, item, bund); } } }
b.setDescription(context, formatFilter.getDescription()); BitstreamFormat bf = bitstreamFormatService.findByShortDescription(context, formatFilter.getFormatString()); bitstreamService.setFormat(context, b, bf);
int supportLevel, boolean internal) throws SQLException, AuthorizeException { BitstreamFormat bsf = bitstreamFormatService.findByShortDescription(context, shortDesc);