From: <yo...@us...> - 2009-11-13 21:11:30
|
Revision: 268 http://treebase.svn.sourceforge.net/treebase/?rev=268&view=rev Author: youjun Date: 2009-11-13 21:11:22 +0000 (Fri, 13 Nov 2009) Log Message: ----------- Modified Paths: -------------- trunk/oai-pmh_data_provider/data_provider_web/src/main/java/org/treebase/oai/web/controller/OAIPMHController.java trunk/oai-pmh_data_provider/data_provider_web/src/test/java/org/treebase/oai/web/controller/OAIPMHControllerTest.java trunk/oai-pmh_data_provider/data_provider_web/src/test/resources/GetRecord.vm Modified: trunk/oai-pmh_data_provider/data_provider_web/src/main/java/org/treebase/oai/web/controller/OAIPMHController.java =================================================================== --- trunk/oai-pmh_data_provider/data_provider_web/src/main/java/org/treebase/oai/web/controller/OAIPMHController.java 2009-11-12 21:06:19 UTC (rev 267) +++ trunk/oai-pmh_data_provider/data_provider_web/src/main/java/org/treebase/oai/web/controller/OAIPMHController.java 2009-11-13 21:11:22 UTC (rev 268) @@ -2,6 +2,7 @@ import java.lang.reflect.Method; import java.text.ParseException; +import java.util.HashMap; import java.util.List; import java.util.Map; @@ -14,6 +15,9 @@ import org.treebase.oai.web.command.Identify; import org.treebase.oai.web.command.OAIPMHCommand; import org.treebase.oai.web.util.IdentifyUtil; +import org.cipres.treebase.domain.admin.Person; +import org.cipres.treebase.domain.study.Citation; +import org.cipres.treebase.domain.study.Study; import org.cipres.treebase.domain.study.Submission; import org.cipres.treebase.domain.study.SubmissionService; import org.cipres.treebase.domain.study.StudyService; @@ -104,7 +108,7 @@ // TODO Auto-generated catch block return (new ModelAndView("badArgument.vm",model)); } - model.put("recodeList", list); + model.put("recordList", getRecordList(list)); return (new ModelAndView(params.getMetadataPrefix()+"_ListRecoed.vm",model)); } @@ -120,7 +124,7 @@ // TODO Auto-generated catch block return (new ModelAndView("badArgument.vm",model)); } - model.put("recodeList", list); + model.put("recordList", getRecordList(list)); return (new ModelAndView(params.getMetadataPrefix()+"_ListIdentifiers.vm",model)); } @@ -139,8 +143,7 @@ return (new ModelAndView("idDoesNotExist.vm",model)); } - - model.put("record", submission); + model.put("record", getRecordMap(submission)); return (new ModelAndView(params.getMetadataPrefix()+"_GetRecord.vm",model)); } @@ -160,7 +163,6 @@ ModelAndView ListMetadataFormats(OAIPMHCommand params, Map model){ - Submission submission = null; try{ @@ -173,9 +175,37 @@ return (new ModelAndView("idDoesNotExist.vm",model)); } - + + return (new ModelAndView("ListMetadataFormats.vm",model)); } + + private Map getRecordMap(Submission submission){ + + Map<String, String> map= new HashMap<String, String>(); + + Person submitter=submission.getSubmitter().getPerson(); + Citation citation=submission.getStudy().getCitation(); + Study study=submission.getStudy(); + + map.put("title", citation.getTitle()); + map.put("creator", submitter.getFirstName()+" " + + submitter.getMiddleName()+" " + + submitter.getLastName()); + map.put("subject", citation.getKeywords()); + map.put("description", study.getName()+" "+study.getNotes()); + map.put("abstract", citation.getAbstract()); + map.put("publisher", citation.()); + + + + return map; + } + + private List getRecordList(List<Submission> slist) + { + return null; + } } Modified: trunk/oai-pmh_data_provider/data_provider_web/src/test/java/org/treebase/oai/web/controller/OAIPMHControllerTest.java =================================================================== --- trunk/oai-pmh_data_provider/data_provider_web/src/test/java/org/treebase/oai/web/controller/OAIPMHControllerTest.java 2009-11-12 21:06:19 UTC (rev 267) +++ trunk/oai-pmh_data_provider/data_provider_web/src/test/java/org/treebase/oai/web/controller/OAIPMHControllerTest.java 2009-11-13 21:11:22 UTC (rev 268) @@ -133,4 +133,21 @@ System.out.print(result); } + + public void testGetRecord() { + + OAIPMHCommand params=new OAIPMHCommand(); + params.setVerb("ListMetadataFormats"); + params.setIdentifier("treebase.org/study/TB2:s169"); + params.setMetadataPrefix("oai_dc"); + Map model=new HashMap(); + model.put("identify",identify ); + model.put("params", params); + ModelAndView mav=controller.ListMetadataFormats(params, model); + String result=vu.runTemplate(mav); + this.assertNotNull(result); + System.out.println("---------test ListMetadataFormats---------"); + System.out.print(result); + + } } Modified: trunk/oai-pmh_data_provider/data_provider_web/src/test/resources/GetRecord.vm =================================================================== --- trunk/oai-pmh_data_provider/data_provider_web/src/test/resources/GetRecord.vm 2009-11-12 21:06:19 UTC (rev 267) +++ trunk/oai-pmh_data_provider/data_provider_web/src/test/resources/GetRecord.vm 2009-11-13 21:11:22 UTC (rev 268) @@ -0,0 +1,41 @@ +<?xml version="1.0" encoding="UTF-8"?> +<OAI-PMH xmlns="http://www.openarchives.org/OAI/2.0/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/ + http://www.openarchives.org/OAI/2.0/OAI-PMH.xsd"> + <responseDate>${model.identify.getResponseDate()}</responseDate> + <request verb="GetRecord" identifier="${model.params.identifier}" + metadataPrefix="oai_dc">${model.identify.BaseURL}</request> + <GetRecord> + <record> + <header> + <identifier>${model.params.identifier}</identifier> + <datestamp>${model.record.getCreateDate()}</datestamp> + </header> + <metadata> + <oai_dc:dc + xmlns:oai_dc="http://www.openarchives.org/OAI/2.0/oai_dc/" + xmlns:dc="http://purl.org/dc/elements/1.1/" + xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" + xsi:schemaLocation="http://www.openarchives.org/OAI/2.0/oai_dc/ + http://www.openarchives.org/OAI/2.0/oai_dc.xsd"> + <dc:title>${.getStudy().getCitation().getTitle()}</dc:title> + <dc:creator></dc:creator> + <dc:subject>Digital Libraries</dc:subject> + <dc:description>With the increasing technical sophistication of + both information consumers and providers, there is + increasing demand for more meaningful experiences of digital + information. We present a framework that separates digital + object experience, or rendering, from digital object storage + and manipulation, so the rendering can be tailored to + particular communities of users. + </dc:description> + <dc:description>Comment: 23 pages including 2 appendices, + 8 figures</dc:description> + <dc:date>2001-12-14</dc:date> + </oai_dc:dc> +<!\x97 some missing field here like keyword etc see NESCent schema --> + </metadata> + </record> + </GetRecord> +</OAI-PMH> This was sent by the SourceForge.net collaborative development platform, the world's largest Open Source development site. |