Package org.purl.sword.base

Examples of org.purl.sword.base.SWORDEntry


      throw new SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The url you provided does not resolve to an appropriate object");
    }

    // now construct the atom entry for the bitstream
    DSpaceATOMEntry dsatom = new BitstreamEntryGenerator(swordService);
    SWORDEntry entry = dsatom.getSWORDEntry(dso);
    response.setEntry(entry);
    return response;
  }
View Full Code Here


  /**
   * Reset all the internal variables of the class to their original values
   */
  public void reset()
  {
    this.entry = new SWORDEntry();
    this.item = null;
    this.bitstream = null;
    this.result = null;
    this.deposit = null;
  }
View Full Code Here

  public SWORDEntry getSWORDEntry(DepositResult result, Deposit deposit)
    throws DSpaceSWORDException
  {
    this.reset();

    this.entry = new SWORDEntry();
    this.item = result.getItem();
    this.bitstream = result.getBitstream();
    this.result = result;
    this.deposit = deposit;
View Full Code Here

    if (dsatom == null)
    {
      log.error("The deposit failed, see exceptions for explanation");
      throw new DSpaceSWORDException("Result of deposit did not yield an Item or a Bitstream");
    }
    SWORDEntry entry = dsatom.getSWORDEntry(result, deposit);

    // if this was a no-op, we need to remove the files we just
    // deposited, and abort the transaction
    if (deposit.isNoOp())
    {
      dep.undoDeposit(result);
      swordService.message("NoOp Requested: Removed all traces of submission");
    }
   
    entry.setNoOp(deposit.isNoOp());

    Date finish = new Date();
    long delta = finish.getTime() - start.getTime();
    swordService.message("Total time for deposit processing: " + delta + " ms");
    entry.setVerboseDescription(swordService.getVerboseDescription().toString());

    response.setEntry(entry);
   
    return response;
  }
View Full Code Here

    // Handle the deposit
    if (!deposit.isNoOp()) {
      counter++;
    }
    DepositResponse dr = new DepositResponse(Deposit.CREATED);
    SWORDEntry se = new SWORDEntry();
   
    Title t = new Title();
    t.setContent("DummyServer Deposit: #" + counter);
    se.setTitle(t);
   
    se.addCategory("Category");
   
    if (deposit.getSlug() != null) {
      se.setId(deposit.getSlug() + " - ID: " + counter);
    } else {
      se.setId("ID: " + counter);
    }
    
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    TimeZone utc = TimeZone.getTimeZone("UTC");
    sdf.setTimeZone (utc);
    String milliFormat = sdf.format(new Date());
    se.setUpdated(milliFormat);
     
      Summary s = new Summary();
    s.setContent(filenames.toString());
    se.setSummary(s);
    Author a = new Author();
    if (username != null) {
      a.setName(username);
    } else {
      a.setName("unknown");
    }
    se.addAuthors(a);
   
    Link em = new Link();
    em.setRel("edit-media");
    em.setHref("http://www.myrepository.ac.uk/sdl/workflow/my deposit");
    se.addLink(em);
   
    Link e = new Link();
    e.setRel("edit");
    e.setHref("http://www.myrepository.ac.uk/sdl/workflow/my deposit.atom");
    se.addLink(e);
   
    if (deposit.getOnBehalfOf() != null) {
      Contributor c = new Contributor();
      c.setName(deposit.getOnBehalfOf());
      c.setEmail(deposit.getOnBehalfOf() + "@myrepository.ac.uk");
      se.addContributor(c);
    }
   
    Generator generator = new Generator();
    generator.setContent("Stuart's Dummy SWORD Server");
    generator.setUri("http://dummy-sword-server.example.com/");
    generator.setVersion("1.3");
    se.setGenerator(generator);
   
    Content content = new Content();
    try {
      content.setType("application/zip");
    } catch (InvalidMediaTypeException ex) {
      ex.printStackTrace();
    }
    content.setSource("http://www.myrepository.ac.uk/sdl/uploads/upload-" + counter + ".zip");
    se.setContent(content);
   
    se.setTreatment("Short back and sides");
   
    if (deposit.isVerbose()) {
      se.setVerboseDescription("I've done a lot of hard work to get this far!");
    }
   
    se.setNoOp(deposit.isNoOp());
   
    dr.setEntry(se);
   
    dr.setLocation("http://www.myrepository.ac.uk/atom/" + counter);
   
View Full Code Here

        DepositResponse resp = client.postFile(message);
        Status status = client.getStatus();

    if ((status.getCode() == 201) || (status.getCode() == 202))
        {
      SWORDEntry se = resp.getEntry();
            return se.getId();
        }
        else
        {
            String error = status.getCode() + " " + status.getMessage() + " - " + resp.getEntry().getSummary().getContent();
      log.info("Error depositing Sword package : " + error);
View Full Code Here

    * @param response The details of the deposit.
    */
   public void processDepositResponse(String url,
                                      DepositResponse response)
   {
      SWORDEntry entry = response.getEntry();
      Object title = entry.getTitle();
      if( title == null )
      {
         title = "Undefined";
      }
      else
      {
         title = entry.getTitle().getContent();
      }

      TreeNodeWrapper wrapper = new TreeNodeWrapper(title.toString(), entry);
      DefaultMutableTreeNode entryNode = new DefaultMutableTreeNode(wrapper);

View Full Code Here

    // Handle the deposit
    if (!deposit.isNoOp()) {
      counter++;
    }
    DepositResponse dr = new DepositResponse(Deposit.CREATED);
    SWORDEntry se = new SWORDEntry();
   
    Title t = new Title();
    t.setContent("DummyServer Deposit: #" + counter);
    se.setTitle(t);
   
    se.addCategory("Category");
   
    if (deposit.getSlug() != null) {
      se.setId(deposit.getSlug() + " - ID: " + counter);
    } else {
      se.setId("ID: " + counter);
    }
    
    SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd'T'HH:mm:ss'Z'");
    TimeZone utc = TimeZone.getTimeZone("UTC");
    sdf.setTimeZone (utc);
    String milliFormat = sdf.format(new Date());
    se.setUpdated(milliFormat);
     
      Summary s = new Summary();
    s.setContent(filenames.toString());
    se.setSummary(s);
    Author a = new Author();
    if (username != null) {
      a.setName(username);
    } else {
      a.setName("unknown");
    }
    se.addAuthors(a);
   
    Link em = new Link();
    em.setRel("edit-media");
    em.setHref("http://www.myrepository.ac.uk/sdl/workflow/my deposit");
    se.addLink(em);
   
    Link e = new Link();
    e.setRel("edit");
    e.setHref("http://www.myrepository.ac.uk/sdl/workflow/my deposit.atom");
    se.addLink(e);
   
    if (deposit.getOnBehalfOf() != null) {
      Contributor c = new Contributor();
      c.setName(deposit.getOnBehalfOf());
      c.setEmail(deposit.getOnBehalfOf() + "@myrepository.ac.uk");
      se.addContributor(c);
    }
   
    Generator generator = new Generator();
    generator.setContent("Stuart's Dummy SWORD Server");
    generator.setUri("http://dummy-sword-server.example.com/");
    generator.setVersion("1.3");
    se.setGenerator(generator);
   
    Content content = new Content();
    try {
      content.setType("application/zip");
    } catch (InvalidMediaTypeException ex) {
      ex.printStackTrace();
    }
    content.setSource("http://www.myrepository.ac.uk/sdl/uploads/upload-" + counter + ".zip");
    se.setContent(content);
   
    se.setTreatment("Short back and sides");
   
    if (deposit.isVerbose()) {
      se.setVerboseDescription("I've done a lot of hard work to get this far!");
    }
   
    se.setNoOp(deposit.isNoOp());
   
    dr.setEntry(se);
   
    dr.setLocation("http://www.myrepository.ac.uk/atom/" + counter);
   
View Full Code Here

    if (dsatom == null)
    {
      log.error("The deposit failed, see exceptions for explanation");
      throw new DSpaceSWORDException("Result of deposit did not yield an Item or a Bitstream");
    }
    SWORDEntry entry = dsatom.getSWORDEntry(result, deposit);

    // if this was a no-op, we need to remove the files we just
    // deposited, and abort the transaction
    if (deposit.isNoOp())
    {
      dep.undoDeposit(result);
      swordService.message("NoOp Requested: Removed all traces of submission");
    }
   
    entry.setNoOp(deposit.isNoOp());

    Date finish = new Date();
    long delta = finish.getTime() - start.getTime();
    swordService.message("Total time for deposit processing: " + delta + " ms");
    entry.setVerboseDescription(swordService.getVerboseDescription().toString());

    response.setEntry(entry);
   
    return response;
  }
View Full Code Here

      throw new SWORDErrorException(DSpaceSWORDErrorCodes.BAD_URL, "The url you provided does not resolve to an appropriate object");
    }

    // now construct the atom entry for the bitstream
    DSpaceATOMEntry dsatom = new BitstreamEntryGenerator(swordService);
    SWORDEntry entry = dsatom.getSWORDEntry(dso);
    response.setEntry(entry);
    return response;
  }
View Full Code Here

TOP

Related Classes of org.purl.sword.base.SWORDEntry

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.