Package org.dspace.harvest

Examples of org.dspace.harvest.HarvestedCollection


    int collectionID = parameters.getParameterAsInteger("collectionID", -1);
    Collection thisCollection = Collection.find(context, collectionID);

    // This should always be null; it's an error condition for this tranformer to be called when
    // a harvest instance exists for this collection
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);
    String baseURL = contextPath + "/admin/collection?administrative-continue=" + knot.getId();
   
    // DIVISION: main
      Division main = body.addInteractiveDivision("collection-harvesting-setup",contextPath+"/admin/collection",Division.METHOD_MULTIPART,"primary administrative collection");
      main.setHead(T_main_head.parameterize(thisCollection.getMetadata("name")));  
View Full Code Here


  {
    int collectionID = parameters.getParameterAsInteger("collectionID", -1);
    Collection thisCollection = Collection.find(context, collectionID);
    Request request = ObjectModelHelper.getRequest(objectModel);
   
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);
    String baseURL = contextPath + "/admin/collection?administrative-continue=" + knot.getId();
   
    String errorString = parameters.getParameter("errors",null);
    String[] errors = errorString.split(",");
    HashMap<String,String> errorMap = new HashMap<String,String>();
    for (String error : errors) {
      //System.out.println(errorString);
      String[] errorPieces = error.split(":",2);
     
      if (errorPieces.length > 1)
        errorMap.put(errorPieces[0], errorPieces[1]);
      else
        errorMap.put(errorPieces[0], errorPieces[0]);
    }
   
   
    String oaiProviderValue;
    String oaiSetIdValue;
    String metadataFormatValue;
    int harvestLevelValue;
       
    if (hc != null && request.getParameter("submit_test") == null) {
      oaiProviderValue = hc.getOaiSource();
      oaiSetIdValue = hc.getOaiSetId();
      metadataFormatValue = hc.getHarvestMetadataConfig();
      harvestLevelValue = hc.getHarvestType();     
    }
    else {
      oaiProviderValue = parameters.getParameter("oaiProviderValue", "");
      oaiSetIdValue = parameters.getParameter("oaiSetAll", "");
            if(!"all".equals(oaiSetIdValue))
View Full Code Here

     */
    private Collection checkCollection(String collectionID)
    {
      Collection collection = resolveCollection(collectionID);
      try {
        HarvestedCollection hc = HarvestedCollection.find(context, collection.getID());
          if (!hc.isHarvestable()) {
            System.out.println("Collection '"+ collection.getName() +"' is not set up for harvesting");
              System.exit(1);
          }
      } catch (SQLException se) {
        se.printStackTrace();
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

     
      System.out.print("Initializing the harvester... ");
      OAIHarvester harvester = null;
      try {
        Collection collection = resolveCollection(collectionID);
          HarvestedCollection hc = HarvestedCollection.find(context, collection.getID());
        harvester = new OAIHarvester(context, collection, hc);
        System.out.println("success. ");
      }
      catch (HarvestingException hex) {
        System.out.print("failed. ");
View Full Code Here

      try
      {
        List<Integer> cids = HarvestedCollection.findAll(context);
        for (Integer cid : cids)
        {
          HarvestedCollection hc = HarvestedCollection.find(context, cid);
          //hc.setHarvestResult(null,"");
          hc.setHarvestStartTime(null);
          hc.setHarvestStatus(HarvestedCollection.STATUS_READY);
          hc.update();
        }
        context.commit();
        System.out.println("success. ");
      }
      catch (Exception ex) {
View Full Code Here

 
  public void addBody(Body body) throws WingException, SQLException, AuthorizeException
  {
    int collectionID = parameters.getParameterAsInteger("collectionID", -1);
    Collection thisCollection = Collection.find(context, collectionID);
    HarvestedCollection hc = HarvestedCollection.find(context, collectionID);
    Request request = ObjectModelHelper.getRequest(objectModel);
       
    String baseURL = contextPath + "/admin/collection?administrative-continue=" + knot.getId();
   
    String oaiProviderValue = hc.getOaiSource();
    String oaiSetIdValue = hc.getOaiSetId();
    String metadataFormatValue = hc.getHarvestMetadataConfig();
    int harvestLevelValue = hc.getHarvestType();
    int harvestStatusValue = hc.getHarvestStatus();
             
    // DIVISION: main
      Division main = body.addInteractiveDivision("collection-harvesting-edit",contextPath+"/admin/collection",Division.METHOD_MULTIPART,"primary administrative collection");
      main.setHead(T_main_head.parameterize(thisCollection.getMetadata("name")));  
     
      List options = main.addList("options",List.TYPE_SIMPLE,"horizontal");
      options.addItem().addXref(baseURL+"&submit_metadata",T_options_metadata);
      options.addItem().addXref(baseURL+"&submit_roles",T_options_roles);
      options.addItem().addHighlight("bold").addXref(baseURL+"&submit_harvesting",T_options_harvest);
     
     
      // The top-level, all-setting, countent source radio button
      List harvestSource = main.addList("harvestSource", "form");
     
      harvestSource.addLabel(T_label_source);
      Radio source = harvestSource.addItem().addRadio("source");
      source.addOption(hc == null, "source_normal", T_source_normal);
      source.addOption(hc != null, "source_harvested", T_source_harvested);
     
      List settings = main.addList("harvestSettings", "form");
      settings.setHead(T_main_settings_head);
     
      settings.addLabel(T_label_oai_provider);
      settings.addItem(oaiProviderValue);
     
      settings.addLabel(T_label_setid);
      settings.addItem(oaiSetIdValue);

      // The big complex way of getting to our metadata
      settings.addLabel(T_label_metadata_format);
   
      String key = "harvester.oai.metadataformats." + metadataFormatValue;
      String metadataString = ConfigurationManager.getProperty(key);

      String displayName;
      if (metadataString.indexOf(',') != -1)
        displayName = metadataString.substring(metadataString.indexOf(',') + 1);
      else
        displayName = metadataFormatValue + "(" + metadataString + ")";
           
      settings.addItem(displayName);
     
      settings.addLabel(T_label_harvest_level);
      Item harvestLevel = settings.addItem();
      switch (harvestLevelValue) {
        case 1: harvestLevel.addContent(T_option_md_only); break;
        case 2: harvestLevel.addContent(T_option_md_and_ref); break;
        default: harvestLevel.addContent(T_option_md_and_bs); break;
      }
                 
        /* Results of the last harvesting cycle */
        if (harvestLevelValue > 0) {
          settings.addLabel(T_label_harvest_result);
          Item harvestResult = settings.addItem();
          if (hc.getHarvestMessage() != null) {
            harvestResult.addContent(hc.getHarvestMessage() + " on " + hc.getHarvestStartTime());
          }
          else {
            harvestResult.addContent(T_harvest_result_new);
          }
        }
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

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.