Esempio n. 1
0
  /**
   * Update DataSet in the database
   *
   * @param repox2sip
   * @throws IOException
   * @throws Repox2SipException
   */
  public synchronized void updateDataSet2Database(Repox2Sip repox2sip)
      throws IOException, Repox2SipException {
    DataSet dataSet = repox2sip.getDataSet(this.getIdDb());
    dataSet.setNameCode(this.getNameCode());
    dataSet.setLanguage(this.getLanguage());
    dataSet.setType(DataSetType.ESE);
    dataSet.setIdQName(this.getId());
    dataSet.setName(this.getName());
    dataSet.setDescription(this.getDescription());

    dataSet.setProvider(repox2sip.getProvider(getDataProvider().getIdDb()));

    if (this.getRecordIdPolicy() instanceof IdExtracted) {
      dataSet.setIdQName(((IdExtracted) this.getRecordIdPolicy()).getIdentifierXpath());
    } else {
      dataSet.setIdQName("Calculated by Repox");
    }

    addSpecificInformation(dataSet);

    repox2sip.updateDataSet(dataSet);
  }
Esempio n. 2
0
  /**
   * Create an DataSet object, and add it to the database
   *
   * @param repox2sip
   * @return
   * @throws eu.europeana.repox2sip.Repox2SipException
   */
  public DataSet addDataSource2Database(Repox2Sip repox2sip) throws Repox2SipException {
    DataSet dataSetSip = new DataSet();

    dataSetSip.setProvider(repox2sip.getProvider(getDataProvider().getIdDb()));
    dataSetSip.setNameCode(this.getNameCode());
    dataSetSip.setLanguage(this.getLanguage());
    dataSetSip.setType(DataSetType.ESE);
    dataSetSip.setName(this.getName());
    dataSetSip.setDescription(this.getDescription());
    dataSetSip.setOaiSetOutput(this.getId());

    if (this.getRecordIdPolicy() instanceof IdExtracted) {
      dataSetSip.setIdQName(((IdExtracted) this.getRecordIdPolicy()).getIdentifierXpath());
    } else {
      dataSetSip.setIdQName("Calculated by Repox");
    }

    addSpecificInformation(dataSetSip);

    dataSetSip = repox2sip.addDataSet(dataSetSip);
    this.setIdDb(dataSetSip.getId());

    return dataSetSip;
  }