public static SolrAccess prepareSolrAccess() throws IOException {
   SolrAccess solrAccess = EasyMock.createMock(SolrAccess.class);
   Set<String> keys = DocumentServiceTest.PATHS_MAPPING.keySet();
   for (String key : keys) {
     EasyMock.expect(solrAccess.getPath(key))
         .andReturn(new ObjectPidsPath[] {DocumentServiceTest.PATHS_MAPPING.get(key)})
         .anyTimes();
   }
   return solrAccess;
 }
Ejemplo n.º 2
0
 @Override
 Document dataFromSolr(String pid, SolrAccess solrAccess) throws IOException {
   try {
     PIDParser parser = new PIDParser(pid);
     parser.objectPid();
     return solrAccess.getSolrDataDocument(parser.getObjectId());
   } catch (LexerException e) {
     LOGGER.log(Level.SEVERE, e.getMessage(), e);
     return solrAccess.getSolrDataDocument(pid);
   }
 }
  public List<DownloadItem> getDownloadItems()
      throws RecognitionException, TokenStreamException, IOException {
    List<DownloadItem> items = new ArrayList<DownloadOriginalViewObject.DownloadItem>();
    List params = getPidsParams();
    for (Object param : params) {
      boolean accessed = false;
      ObjectPidsPath[] path = solrAccess.getPath(param.toString());
      for (ObjectPidsPath objectPidsPath : path) {
        objectPidsPath = objectPidsPath.injectRepository();
        if (isActionAllowed.isActionAllowed(
            SecuredActions.READ.getFormalName(),
            param.toString(),
            FedoraUtils.IMG_FULL_STREAM,
            objectPidsPath)) {
          accessed = true;
          break;
        }
      }
      String dctitle = DCUtils.titleFromDC(fedoraAccess.getDC(param.toString()));

      items.add(
          new DownloadItem(
              dctitle,
              "img?uuid=" + param.toString() + "&stream=IMG_FULL&action=GETRAW&asFile=true",
              fedoraAccess.getKrameriusModelName(param.toString()),
              accessed,
              fedoraAccess.isImageFULLAvailable(param.toString())));
    }
    return items;
  }
Ejemplo n.º 4
0
 @Override
 Document dataFromSolr(String handle, SolrAccess solrAccess) throws IOException {
   return solrAccess.getSolrDataDocumentByHandle(handle);
 }