Beispiel #1
0
  /**
   * Add MDRecord to database
   *
   * @param request
   * @param ingestedRecords
   */
  protected void addMdRecord2Database(Request request, List<RecordRepox> ingestedRecords) {
    try {
      Repox2Sip repox2Sip = RepoxContextUtil.getRepoxManager().getDataManager().getRepox2sip();
      List<MetadataRecord> allMetadataRecords = new ArrayList<MetadataRecord>();
      for (RecordRepox rp : ingestedRecords) {
        allMetadataRecords.add(rp.createRecordSip());
        // rp.addRecord2DataBase(request.getId(), repox2Sip);
      }
      repox2Sip.addMetadataRecords(request.getId(), allMetadataRecords);

    } catch (Repox2SipException e) {
      log.error("Could not add MetadataRecord to Data Base", e);
      e.printStackTrace();
    }
  }
Beispiel #2
0
  protected void checkRequest(boolean addedNewRecords, Request newRequest) {
    try {
      if (!addedNewRecords) {
        Repox2Sip repox2sip = RepoxContextUtil.getRepoxManager().getDataManager().getRepox2sip();
        List<Request> requestList = repox2sip.getDataSetRequests(this.getIdDb());

        Collections.sort(requestList, new DateSorter());
        for (Request request : requestList) {
          if (request.getStatus().equals(RequestStatus.IMPORT_COMPLETED)) {
            Long myId = request.getId();
            repox2sip.addMetadataRecords(
                newRequest.getId(), repox2sip.getRequestMetadataRecords(myId));
            break;
          }
        }
      }
    } catch (Repox2SipException e) {
      e
          .printStackTrace(); // To change body of catch statement use File | Settings | File
                              // Templates.
    }
  }