System.out.println("getRegisteredAssets - serverID:" + serverID + " nymID:" + nymID);
List registeredAssetsList = null;
String strEncodedObj = null; // output will go here.
StringMap stringMap = null; // we are about to create this object
Storable storable = otapi.CreateObject(StoredObjectType.STORED_OBJ_STRING_MAP);
if (storable != null) {
stringMap = StringMap.ot_dynamic_cast(storable);
if (stringMap != null) {
// ADD ALL THE ASSET IDs HERE (To the string map, so you
// can ask the server about them...)
//
int count = otapiJNI.OTAPI_Basic_GetAssetTypeCount();
System.out.println(" count:" + count);
for (int i = 0; i < count; i++) {
String key = otapiJNI.OTAPI_Basic_GetAssetType_ID(i);
System.out.println("key:" + key);
stringMap.SetValue(key, "exists");
}
System.out.println(" BEFORE ENCODE,stringMap:" + stringMap);
strEncodedObj = otapi.EncodeObject(stringMap);
}
}
System.out.println(" fter ENCODE,strEncodedObj:" + strEncodedObj);
if (!Utility.VerifyStringVal(strEncodedObj)) {
System.out.println("strEncodedObj is null");
return null;
//Error;
}
// Then send the server message
OTAPI_Func theRequest = new OTAPI_Func(OTAPI_Func.FT.QUERY_ASSET_TYPES, serverID, nymID, strEncodedObj);
System.out.println(" theRequest :" + theRequest);
String strResponse = theRequest.SendRequest(theRequest, "QUERY_ASSET_TYPES");
System.out.println(" strResponse:" + strResponse);
String strReplyMap = null;
// When the server reply comes back, get the payload from it:
if (Utility.VerifyStringVal(strResponse)) {
strReplyMap = otapiJNI.OTAPI_Basic_Message_GetPayload(strResponse);
}
System.out.println("strResponse is " + strResponse);
// Pass the payload (the StringMap from the server's reply) to otapi.DecodeObject:
if (Utility.VerifyStringVal(strReplyMap)) {
StringMap stringMapOutput = null;
storable = otapi.DecodeObject(StoredObjectType.STORED_OBJ_STRING_MAP, strReplyMap);
if (storable != null) {
stringMapOutput = StringMap.ot_dynamic_cast(storable);
if (stringMapOutput != null) {
// Loop through string map. For each asset ID key, the value will
// say either "true" or "false".
int count = otapiJNI.OTAPI_Basic_GetAssetTypeCount();
for (int i = 0; i < count; i++) {
String key = otapiJNI.OTAPI_Basic_GetAssetType_ID(i);
System.out.println("key in output:" + key);
String isRegistered = stringMapOutput.GetValue(key);
System.out.println("isRegistered in output:" + isRegistered);
if ("true".equalsIgnoreCase(isRegistered)) {
if (registeredAssetsList == null) {
registeredAssetsList = new ArrayList();
}