Package com.bhle.access.util

Examples of com.bhle.access.util.FedoraURI


    List<URI> guidUris = new ArrayList<URI>();
    Set<String> guidSet = new HashSet<String>();

    List<URI> uris = defaultStorages.list(null);
    for (URI uri : uris) {
      FedoraURI fedoraUri = new FedoraURI(uri);
      if (!guidSet.contains(fedoraUri.getGuid())) {
        guidSet.add(fedoraUri.getGuid());
        guidUris.add(fedoraUri.getItemURI());
      }
    }

    return guidUris;
  }
View Full Code Here


  public List<URI> getDatastream(String guid, String dsid) throws IOException {
    List<URI> result = new ArrayList<URI>();

    List<URI> dsidUris = listDatastreams(guid);
    for (URI dsidUri : dsidUris) {
      FedoraURI fedoraUri = new FedoraURI(dsidUri);
      if (dsid.equalsIgnoreCase(fedoraUri.getDsid())) {
        result.add(dsidUri);
      }
    }
    return result;
  }
View Full Code Here

    }

    if (serialNumber == null && uris.size() > 1) {
      throw new IOException();
    } else {
      FedoraURI fedoraURI = new FedoraURI(uris.get(0));
      return defaultStorages.get(fedoraURI.getPid(), fedoraURI.getDsid());
    }
  }
View Full Code Here

      suffix = PdfGenerator.SUFFIX;
      break;
    default:
      throw new IllegalArgumentException("Cannot define file suffix");
    }
    FedoraURI fedoraUri = new FedoraURI(URI.create(this.pageURIs[0]));
    return fedoraUri.getGuid() + "." + suffix;
  }
View Full Code Here

          : Integer.MAX_VALUE;
      int to = higherSerialNumber.compareTo(biggestSerialNumber) > 0 ? pageUris.length - 1
          : Integer.MIN_VALUE;

      for (int i = 0; i < pageUris.length; i++) {
        FedoraURI fedoraUri = new FedoraURI(URI.create(pageUris[i]));
        logger.debug(fedoraUri.getSerialNumber());
        if (lowerSerialNumber.equals(fedoraUri.getSerialNumber())) {
          from = i;
        }

        if (higherSerialNumber.equals(fedoraUri.getSerialNumber())) {
          to = i;
        }
      }

      logger.debug("from: {} to {}", from, to);

      return Arrays.copyOfRange(pageUris, from, to + 1);
    } else {

      logger.debug("Parge Single Index: " + range);

      int pageIndex = getPageIndex(range);
      String serialNumber = PAGE_INDEX_FORMATTER.format(pageIndex);

      for (String pageUri : pageUris) {
        FedoraURI fedoraUri = new FedoraURI(URI.create(pageUri));
        if (serialNumber.equals(fedoraUri.getSerialNumber())) {
          result.add(pageUri);
          break;
        }
      }
    }
View Full Code Here

      return Integer.valueOf(range) + 1;
    }
  }

  private static String getFirstSerialNumber(String[] pageUris) {
    FedoraURI fedoraUri = new FedoraURI(URI.create(pageUris[0]));
    return fedoraUri.getSerialNumber();
  }
View Full Code Here

    FedoraURI fedoraUri = new FedoraURI(URI.create(pageUris[0]));
    return fedoraUri.getSerialNumber();
  }

  private static String getLastSerialNumber(String[] pageUris) {
    FedoraURI fedoraUri = new FedoraURI(
        URI.create(pageUris[pageUris.length - 1]));
    return fedoraUri.getSerialNumber();
  }
View Full Code Here

  private static void mergeAllPages(String[] pageURIs, Resolution resolution,
      Document document) {
    for (int i = 0; i < pageURIs.length; i++) {
      try {
        FedoraURI fedoraUri = new FedoraURI(URI.create(pageURIs[i]
            + "/" + DSID));
        URI uri = StaticURI.toStaticHttpUri(fedoraUri);
        URL djatokaURL = DjatokaURLBuilder.build(uri.toURL(),
            resolution.getLevel());
        Image image = Image.getInstance(djatokaURL);
View Full Code Here

      AddPageOcr(out, pageURI);
    }
  }

  private static void AddPageOcr(OutputStream out, String pageUri) {
    FedoraURI fedoraUri = new FedoraURI(URI.create(pageUri + "/" + DSID));
    URI uri = StaticURI.toStaticFileUri(fedoraUri);
    try {
      InputStream in = uri.toURL().openStream();
      IOUtils.copy(in, out);
      IOUtils.closeQuietly(in);
View Full Code Here

    zipOut.close();
  }

  private static void AddPageEntry(ZipOutputStream zipOut, String pageUri,
      Resolution resolution) {
    FedoraURI fedoraUri = new FedoraURI(URI.create(pageUri + "/" + DSID));
    URI uri = StaticURI.toStaticHttpUri(fedoraUri);

    ZipEntry entry;

    try {
      entry = new ZipEntry(fedoraUri.getGuid() + "_"
          + fedoraUri.getSerialNumber() + "." + ENTRY_SUFFIX);
      zipOut.putNextEntry(entry);
      URL djatokaURL = DjatokaURLBuilder.build(uri.toURL(), resolution.getLevel());
      InputStream in = djatokaURL.openStream();
      IOUtils.copy(in, zipOut);
      in.close();
View Full Code Here

TOP

Related Classes of com.bhle.access.util.FedoraURI

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.