camel-users mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From jeffz <jz...@hotmail.com>
Subject Re: Help with JSON to POJO using XML Routes
Date Wed, 28 Sep 2016 01:12:47 GMT
Thanks Ranx,

I was able to address logging by modifying the config file (it was set to
WARN).  Now, my next step is to actually read the JSON.  Since I can't read
it directly into POJO, I'm left using the generic unmarshal and reading the
data as a map.  Is that something you can help with?  My java method and
JSON are below.  If I can learn how to iterate this thing, it definitely
helps.  Also, any tips for processing large JSON are much appreciated.  My
experiments with streaming have not gone well.

public void loadRetailStoreDataFromMap(Exchange input, Registry
paramRegistry) throws Exception {
		final String METHODNAME = "loadRetailStoreDataFromMap()";
		LOGGER.warn(METHODNAME + " loading data from Map: ");
		Map body = (Map)input.getIn().getBody();
		String strData = "";
		strData = (String) body.get("​r​e​c​o​r​d​S​e​t​T​o​t​a​l​");
<-- RETURNS
NULL
		LOGGER.warn(METHODNAME + "Data " + body);
		// First load data into DB table
		List<RetailStorePOJO> storeData = loadStoreDataFromMessage(body);
		if(null != storeData && storeData.size() > 0) {
			//System.out.println("Before calling buildSPRetailStoreDataXML()...");
			List<String> retailStoresXMLStrList =
buildSPRetailStoreDataXML(storeData);
			//System.out.println("After calling buildSPRetailStoreDataXML()...");
			//System.out.println("Before calling loadSegmentDataIntoSP()...");
			for(int i = 0; i < retailStoresXMLStrList.size(); i++) {
				String retailStoresXML = retailStoresXMLStrList.get(i);
				loadRetailDataIntoSP(retailStoresXML, paramRegistry);
			}
			
			//System.out.println("After calling loadRetailDataIntoSP()...");
		}
		LOGGER.debug(METHODNAME + " exit: ");
	}

{recordSetTotal=2, recordSetCount=2, resourceId=host.com,
recordSetComplete=true, recordSetStartNumber=0,
PhysicalStore=[{telephone1=(555)555-5555                   ,
addressLine=[123 Fake, Shopping Center],
Description=[{displayStoreName=GARY, fullImage=store_82.jpg}],
stateOrProvinceName=NC, storeName=CARY, postalCode=12345                                 

, Attribute=[{name=StoreHours, value=10:00AM-7:00PM Monday-Friday,
displayName=Store hours, displayValue=10:00AM-8:00PM Monday-
Friday<br/>10:00AM-8:00PM Saturday<br/>12:00PM-6:00PM Sunday<br/>All stores
closed Thanksgiving Day and Christmas Day.}, {name=StoreIdentifier,
value=082, displayName=StoreIdentifier, displayValue=082}, {name=Type,
value=Regular Store, displayName=Type, displayValue=Regular Store}],
uniqueID=11557, longitude=-78.76756, latitude=99.7796, city=Gary,
country=USA}, {telephone1=(555)555-5555                   , addressLine=[123
Fake, Suite A, 1/2 Mile North of E. Woodlawn],
Description=[{displayStoreName=NEW YORK, fullImage=store_84.jpg}],
stateOrProvinceName=NY, storeName=NEW YORK, postalCode=45676                             
    
, Attribute=[{name=StoreHours, value=10:00AM-6:00PM Monday- Friday,
displayName=Store hours, displayValue=10:00AM-7:00PM Monday-
Friday<br/>10:00AM-8:00PM Saturday<br/>12:00PM-6:00PM Sunday<br/>All stores
closed Thanksgiving Day and Christmas Day.}, {name=StoreIdentifier,
value=084, displayName=StoreIdentifier, displayValue=084}, {name=Type,
value=Regular Store, displayName=Type, displayValue=Regular Store}],
uniqueID=11559, longitude=-89.87635, latitude=89.18321, city=New York,
country=USA}], resourceName=storelocator}





--
View this message in context: http://camel.465427.n5.nabble.com/Help-with-JSON-to-POJO-using-XML-Routes-tp5788130p5788143.html
Sent from the Camel - Users mailing list archive at Nabble.com.

Mime
View raw message