Skip to content

carlost/grails-edis-data-client

 
 

Repository files navigation

The EDIS Data Webservice is a service provided by the United States International Trade Commission. For more information on either the USITC or EDIS please visit their respective websites (www.usitc.gov or edis.usitc.gov)

Documentation on the EDIS data webserivce can be found here

The EDIS Data Webservice Grails Plugin is a Grails plugin designed to make using the EDIS Data Webservice easier. The EDIS Data Webservice Grails Plugin interacts with the EDIS Data Webservice's REST interface and XML output, returning Maps of data in key-value format. When more than one result is returned by the EDIS Data Webservice, a List of Maps is returned.

The EDIS Data Webservice Grails Plugin also supports authenticating to the EDIS Data Webservice.

Table of Contents

General Notes

Installation

Download the plugin zip file to your grails project directory then run the following command:

grails install-plugin grails-edis-data-client-0.1.zip

Common Conventions

Parameters

Each method on the EdisDataService accepts some parameters. In all cases, these parameters are passed as a Map. In some cases, the use of any parameters may be entirely optional.

Authentication

For service methods that support authentication, the parameters are username and secretKey. The Secret Key must be generated from the EDIS user password. The EDIS Data Webservice Grails Plugin has a method to help generate the Secret Key. Please see below for details.

Property Names

Each of the find methods returns a List of Maps representing the data returned by the EDIS Data Webservice. The names of the XML elements from the EDIS Data Webservice are transcribed directly to the Map returned. Please see the EDIS Data Webservice documentation for details on the exact fields returned by each finder.

Date Parameters

The EDIS Data Webservice supports a few date comparison types, EXACT, BEFORE, AFTER and BETWEEN. The date comparison data must be represented in a Stringy format. This plugin hopes to make that easier to use by adapting it to a map format.

For BEFORE, AFTER and EXACT, create a map like this:

  def dateComparo = [comparisonType:"EXACT",date:"2001-01-01"]
  def params = [officialReceivedDate:dateComparo]

For BETWEEN, use a map like this:

  def dateComparo = [comparisonType:"BETWEEN",toDate:"2001-01-01",fromDate:"2002-01-01"]
  def params = [modifiedDate:dateComparo]

Service Methods

secretKey

The secretKey service method is used to generate the secret key used as a password for the EDIS Data Webservice. Please see the EDIS Data Webservice documentation for details.

This method does not accept or respect the normal authentication information

Parameters

  1. username -- Required. The name of the EDIS user; String
  2. password -- Required. The password for the EDIS user; String
Return Value
  • A String representing the secretKey

findInvestigations

The findInvestigations method searches for investigation metadata from the EDIS Data Webservice.

The findInvestigations method supports the authentication of users to the EDIS Data Webservice

Parameters

  1. investigationNumber -- Optional. The investigation number (or part of one) to find; String.
  2. investigationPhase -- Optional. The name of the investigation phase. Only used in conjunction with investigationNumber. String
  3. investigationType -- Optional. The name of the investigation type. String.
  4. investigationStatus -- Optional. The name of the investigation status. String
Return Value
  • A List of Maps representing the results of the investigation search.

findDocuments

The findDocuments method searches for document metadata within the EDIS System.

The findDocuments method supports the authentication of users to the EDIS Data Webservice

Parameters

  1. id -- Optional. The document identification number. String/Numeric
  2. securityLevel -- Optional. The name of the security level. String
  3. investigationNumber -- Optional. The investigation number to find documents within. String
  4. investigationPhase -- Optional. The investigation phase name. String
  5. documentType -- Optional. The document type name. String
  6. firmOrg -- Optional. The firm/organization name.
  7. officialReceivedDate -- Optional. The official received date comparison param
  8. modifiedDate -- Optional. The modified date date comparison param
Return Value
  • A List of Maps representing the results of the document search

findAttachments

The findAttachments method searches for metadata related to attachments for a document.

The findAttachments method supports the authentication of users to the EDIS system.

Parameters

  • documentId -- Required. The documentId to return attachment metadata for. String/Numeric
Return Value
  • A List of Maps containing attachment metadata.

downloadAttachment

The downloadAttachment method accesses the EDIS Data Webservice and returns the underlying PDF binary for an attachment.

The downloadAttachment method requires the authentication of users to the EDIS system

Parameters

  1. documentId -- Required. The document identification number. String/Numeric
  2. attachmentId -- Required. The attachment identification number. String/Numeric
Return Value
  • An InputStream used to Stream the contents of the binary PDF.

Examples

Generating a secretKey

	EdisDataService service
	def generateSecretKey {
		def key = service.secretKey([username:"fooUser",password:"fooPassword!23"]
		println "My secret key " + key
	}


==== Getting a list of Investigations ====


<pre>
	EdisDataService service
	
	def showAll337Investigations {
		def	invs = service.findInvestigations([investigationNumber:"337"])
		invs.each {
			println "Found investigation: " + it.investigationNumber
		}
	}

Finding Documents By Criteria

	EdisDataService service
	def showAllMotionDocTitles {
		def docs = service.findDocuments([documentType:"Motion",username:"fooUser",secretKey:"fbd45fca08df0d04dd3959769089ebbdd8957aff"])
		docs.each {
			println "Document " + it.id + " -- " + it.documentTitle
		}
	}

Getting the attachment metadata for a document

	EdisDataService service
	def showAttachmentIdsForDoc {
		def atts = service.findAttachments([documentId:123456])
		atts.each {
			println it.id
		}
	}

Downloading an attachment binary

	EdisDataService service
	def downloadAttachment {
		def data = service.downloadAttachment([documentId:123456, attachmentId:456789,username:"fooUser",secretKey:"fbd45fca08df0d04dd3959769089ebbdd8957aff"])
		def file = File.createTempFile("123456-456789",".pdf")
		def out = file.newOutputStream()
		while (data.available()) {
			out.write(data.read())
		}
		out.close()
	}

About

Grails Plugin for the EDIS data webservice

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages

  • Groovy 98.7%
  • JavaScript 1.3%