Package org.dspace.harvest

Examples of org.dspace.harvest.HarvestedCollection


     
      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);
       
    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);
            options.addItem().addXref(baseURL+"&submit_curate",T_options_curate);
     
     
      // 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(false, "source_normal", T_source_normal);      // was hc == null - always false
      source.addOption(true, "source_harvested", T_source_harvested); // was hc != null - always true
     
      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("oai", 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

    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

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.