public void testCreateCollection() { BaseCitationService api = createCitationService(); BookConverter bookConverter = new BookConverter(); bookConverter.setCitationService(api); CitationCollection collection = api.addCollection(); Citation book = api.addCitation("book"); book.setCitationProperty(Schema.CREATOR, "An Author"); book.setCitationProperty(Schema.TITLE, "Book Title & More"); book.setCitationProperty(Schema.ISN, "123456789X"); ContextObjectEntity bookEntity = bookConverter.convert(book); ContextObject contextObject = new ContextObject(); contextObject.getEntities().put(Entity.REFERENT, bookEntity); KEVFormat formatter = new KEVFormat(); String output = formatter.encode(contextObject); assertNotNull(output); System.out.println(output); ContextObject parsed = formatter.parse( "&ctx_id=Z39.88-2004&rft_val_fmt=info:ofi/fmt:kev:mtx:ctx&rft.genre=book&rft.btitle=Book%20Title&rft.au=An%20Author"); System.out.println(parsed.getEntities().get(Entity.REFERENT).getValues().get("btitle")); api.save(collection); }
/* (non-Javadoc) * @see org.sakaiproject.citation.impl.BaseCitationService.Storage#addCitation(java.lang.String) */ public Citation addCitation(String mediatype) { Citation citation = new BasicCitation(mediatype); this.m_citations.put(citation.getId(), citation); return citation; }
/* (non-Javadoc) * @see org.sakaiproject.citation.impl.BaseCitationService.Storage#saveCitation(org.sakaiproject.citation.api.Citation) */ public void saveCitation(Citation edit) { this.m_citations.put(edit.getId(), edit); }
/* (non-Javadoc) * @see org.sakaiproject.citation.impl.BaseCitationService.Storage#removeCitation(org.sakaiproject.citation.api.CitationEdit) */ public void removeCitation(Citation edit) { this.m_citations.remove(edit.getId()); }