Groovy web console

subscribe to the feed Subscribe
to this


Published 4 weeks ago by Fred with tags fargo batman brazil snl
Actions  ➤ Edit in console Back to console Show/hide line numbers View recent scripts
import groovy.json.JsonBuilder
import groovy.json.JsonOutput

def getAddressRecord() {
    address = [:]
    address.address1 = '100 Washington Sq East' 
    address.address2 =  '  ' = 'New YORK'
    address.state =  'NY'
    address.zipCode = 10003 = 'US'
def getLessLocations() { [] }
def getCrossRefs() { 
	def aMap = [:]; aMap.put("excludingAgencyName", "OFFICE OF FOREIGN ASSETS"); aMap

// locations --> moreLocations
// crossReferences --> crossReferences
// identifyingInformation --> identityInfo
def printV1Json(String agencyCode, 
  String agencyName, 
  String exclProgram, 
  String exclType, 
  String classificationType,
  String createDate, 
  String updateDate,
  String ctCode, 
  String sam,
  String comments, Map identifiers, List locs, List refs) {

	def excluding = [:]
	excluding.put("excludingAgencyCode", agencyCode);
	excluding.put("excludingAgencyName", agencyName);
	excluding.put("exclusionProgram", exclProgram);
	excluding.put("exclusionType", exclType);
	excluding.put("classificationType", classificationType);
	excluding.put("recordCreatedDate", createDate);
	excluding.put("recordUpdateDate", updateDate);
	excluding.put("ctCode", ctCode);
	excluding.put("samNumber", sam);
	excluding.put("additionalComments", comments);
	excluding.put("identityInfo", identifiers);
	excluding.put("moreLocations", locs);
	excluding.put("crossReferences", refs);

    def json = new JsonBuilder()
    json exclusionDetails: excluding
    println groovy.json.JsonOutput.prettyPrint(json.toString())


printV1Json("OFA","OFFICE OF FOREIGN ASSETS","Reciprocal","Prohibition/Restriction",
"Individual","April 5, 2014","April 1, 2015","03-SDGT-01", "S4M-4EVA", 
"PII data has been masked from view...", 
 [firstName: "Fred", lastName: "French", address: getAddressRecord(),duns: "12345678"],