Package org.dspace.harvest

Examples of org.dspace.harvest.HarvestedCollection


   * @return A process result's object.
   */
  public static FlowResult processSetupCollectionHarvesting(Context context, int collectionID, Request request) throws SQLException, IOException, AuthorizeException
  {
    FlowResult result = new FlowResult();
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);

    String contentSource = request.getParameter("source");

    // First, if this is not a harvested collection (anymore), set the harvest type to 0; possibly also wipe harvest settings 
    if (contentSource.equals("source_normal"))
    {
      if (hc != null)
        hc.delete();
     
      result.setContinue(true);
    }
    else
    {
      FlowResult subResult = testOAISettings(context, request);
     
      // create a new harvest instance if all the settings check out
      if (hc == null) {
        hc = HarvestedCollection.create(context, collectionID);
      }
     
      // if the supplied options all check out, set the harvesting parameters on the collection
      if (subResult.getErrors().isEmpty()) {
        String oaiProvider = request.getParameter("oai_provider");
        boolean oaiAllSets = "all".equals(request.getParameter("oai-set-setting"));
                String oaiSetId;
                if(oaiAllSets)
                    oaiSetId = "all";
                else
                    oaiSetId = request.getParameter("oai_setid");


        String metadataKey = request.getParameter("metadata_format");
        String harvestType = request.getParameter("harvest_level");
       
        hc.setHarvestParams(Integer.parseInt(harvestType), oaiProvider, oaiSetId, metadataKey);
        hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
      }
      else {
        result.setErrors(subResult.getErrors());
        result.setContinue(false);
        return result;
      }
     
      hc.update();
    }
           
        // Save everything
        context.commit();
       
View Full Code Here


  {
    FlowResult result = new FlowResult();
    OAIHarvester harvester;
    List<String> testErrors = new ArrayList<String>();
    Collection collection = Collection.find(context, collectionID);
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);

    //TODO: is there a cleaner way to do this?
    try {
      if (HarvestScheduler.status != HarvestScheduler.HARVESTER_STATUS_STOPPED) {
        synchronized(HarvestScheduler.lock) {
View Full Code Here

   */
  public static FlowResult processReimportCollection(Context context, int collectionID, Request request) throws SQLException, IOException, AuthorizeException, CrosswalkException, ParserConfigurationException, SAXException, TransformerException, BrowseException
  {
    FlowResult result = new FlowResult();
    Collection collection = Collection.find(context, collectionID);
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);
   
    ItemIterator it = collection.getAllItems();
    //IndexBrowse ib = new IndexBrowse(context);
    while (it.hasNext()) {
      Item item = it.next();
      //System.out.println("Deleting: " + item.getHandle());
      //ib.itemRemoved(item);
      collection.removeItem(item);
    }
    hc.setHarvestResult(null,"");
    hc.update();
    collection.update();
    context.commit();
   
    result = processRunCollectionHarvest(context, collectionID, request);   
   
View Full Code Here

            break;

        case START_EDIT_COLLECTION:
         
          HarvestedCollection hc = HarvestedCollection.find(context, UIUtil.
                getIntParameter(request, "collection_id"));
          request.setAttribute("harvestInstance", hc);
         
          storeAuthorizeAttributeCollectionEdit(context, request, collection);
         
View Full Code Here

       
       
       
        // Set the harvesting settings
       
        HarvestedCollection hc = HarvestedCollection.find(context, collection.getID());
    String contentSource = request.getParameter("source");

    // First, if this is not a harvested collection (anymore), set the harvest type to 0; wipe harvest settings 
    if (contentSource.equals("source_normal"))
    {
      if (hc != null)
            {
                hc.delete();
            }
    }
    else
    {
      // create a new harvest instance if all the settings check out
      if (hc == null) {
        hc = HarvestedCollection.create(context, collection.getID());
      }
     
      String oaiProvider = request.getParameter("oai_provider");
      String oaiSetId = request.getParameter("oai_setid");
      String metadataKey = request.getParameter("metadata_format");
      String harvestType = request.getParameter("harvest_level");

      hc.setHarvestParams(Integer.parseInt(harvestType), oaiProvider, oaiSetId, metadataKey);
      hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
     
      hc.update();
    }
       
       

        // Which button was pressed?
View Full Code Here

   * @return A process result's object.
   */
  public static FlowResult processSetupCollectionHarvesting(Context context, int collectionID, Request request) throws SQLException, IOException, AuthorizeException
  {
    FlowResult result = new FlowResult();
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);

    String contentSource = request.getParameter("source");

    // First, if this is not a harvested collection (anymore), set the harvest type to 0; possibly also wipe harvest settings 
    if (contentSource.equals("source_normal"))
    {
      if (hc != null)
            {
                hc.delete();
            }
     
      result.setContinue(true);
    }
    else
    {
      FlowResult subResult = testOAISettings(context, request);
     
      // create a new harvest instance if all the settings check out
      if (hc == null) {
        hc = HarvestedCollection.create(context, collectionID);
      }
     
      // if the supplied options all check out, set the harvesting parameters on the collection
      if (subResult.getErrors().isEmpty()) {
        String oaiProvider = request.getParameter("oai_provider");
        boolean oaiAllSets = "all".equals(request.getParameter("oai-set-setting"));
                String oaiSetId;
                if(oaiAllSets)
                {
                    oaiSetId = "all";
                }
                else
                {
                    oaiSetId = request.getParameter("oai_setid");
                }


        String metadataKey = request.getParameter("metadata_format");
        String harvestType = request.getParameter("harvest_level");
       
        hc.setHarvestParams(Integer.parseInt(harvestType), oaiProvider, oaiSetId, metadataKey);
        hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
      }
      else {
        result.setErrors(subResult.getErrors());
        result.setContinue(false);
        return result;
      }
     
      hc.update();
    }
           
        // Save everything
        context.commit();
       
View Full Code Here

  {
    FlowResult result = new FlowResult();
    OAIHarvester harvester;
    List<String> testErrors = new ArrayList<String>();
    Collection collection = Collection.find(context, collectionID);
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);

    //TODO: is there a cleaner way to do this?
    try {
      if (!HarvestScheduler.hasStatus(HarvestScheduler.HARVESTER_STATUS_STOPPED)) {
        synchronized(HarvestScheduler.lock) {
View Full Code Here

   * @throws BrowseException
   */
  public static FlowResult processReimportCollection(Context context, int collectionID, Request request) throws SQLException, IOException, AuthorizeException, CrosswalkException, ParserConfigurationException, SAXException, TransformerException, BrowseException
  {
    Collection collection = Collection.find(context, collectionID);
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);
   
    ItemIterator it = collection.getAllItems();
    //IndexBrowse ib = new IndexBrowse(context);
    while (it.hasNext()) {
      Item item = it.next();
      //System.out.println("Deleting: " + item.getHandle());
      //ib.itemRemoved(item);
      collection.removeItem(item);
    }
    hc.setHarvestResult(null,"");
    hc.update();
    collection.update();
    context.commit();
   
    return processRunCollectionHarvest(context, collectionID, request);
  }
View Full Code Here

    
      Collection collection = resolveCollection(collectionID);
      System.out.println(collection.getID());
           
      try {
        HarvestedCollection hc = HarvestedCollection.find(context, collection.getID());
          if (hc == null) {
            hc = HarvestedCollection.create(context, collection.getID());
          }
       
        context.turnOffAuthorisationSystem();
        hc.setHarvestParams(type, oaiSource, oaiSetId, mdConfigId);
        hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
        hc.update();
        context.restoreAuthSystemState();
        context.complete();
      }
      catch (Exception e) {
        System.out.println("Changes could not be committed");
View Full Code Here

            context.commit();
            i=0;
          }
        }
       
        HarvestedCollection hc = HarvestedCollection.find(context, collection.getID());
        if (hc != null) {
          hc.setHarvestResult(null,"");
          hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
          hc.setHarvestStartTime(null);
          hc.update();
        }
        context.restoreAuthSystemState();       
        context.commit();
      }
      catch (Exception e) {
View Full Code Here

TOP

Related Classes of org.dspace.harvest.HarvestedCollection

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.