Uploaded image for project: 'WebDanica'
  1. WebDanica
  2. WEBDAN-256

Query of harvestStatus in harvesting workflow does not work with NAS 5.2.2

    XMLWordPrintable

Details

    • Bug
    • Resolution: Fixed
    • Blocker
    • 2.0
    • None
    • HARVESTING
    • None
    • webdanicasprint - vinter 2017

    Description

      I have used this code to retrieve the harvesStatus of a specific harvestid in the webdanica harvesting workflow. It worked with NetarchiveSuite 5.1. But after upgrading to 5.2.2, it never returns any results, despite the fact, that in the mean time the jobs have succeeded in netarchiveSuite.

      public static JobStatusInfo getHarvestStatus(Long hid) {
              if (hid == null) {
                  logger.warning("Null harvestdefinition is not valid");
                  return null;
              }
              HarvestDefinitionDAO hdao = HarvestDefinitionDAO.getInstance();
              if (hdao.exists(hid)) {
                  HarvestStatusQuery hsq = new HarvestStatusQuery(hid, 0); 
                  HarvestStatus hs = JobDAO.getInstance().getStatusInfo(hsq);
                  List<JobStatusInfo> jobs = hs.getJobStatusInfo();
                  if (jobs.size() == 0) { // No jobs yet created (What can go wrong here??)
                      return null;
                  } else if (jobs.size() == 1) {
                      return jobs.get(0);
                  } else {
                      throw new WebdanicaException("Should be either 0 or 1 jobs generated, but there are  " + jobs.size() + " jobs for harvestId " + hid + " and harvestRun 0");   
                  }
              } else {
                  logger.warning("No harvestdefinition w/id=" + hid + " exists!");
                  return null;
              }
          } 
      

      Attachments

        Activity

          People

            svc Søren Vejrup Carlsen (Inactive)
            svc Søren Vejrup Carlsen (Inactive)
            Watchers:
            1 Start watching this issue

            Dates

              Created:
              Updated:
              Resolved: