use of com.netsuite.webservices.v2014_2.platform.core.RecordList in project components by Talend.
the class NetSuiteMockTestBase method makeIndexedRecords.
public static <T> List<IndexedRecord> makeIndexedRecords(NetSuiteClientService<?> clientService, Schema schema, ObjectComposer<T> objectComposer, int count) throws Exception {
NsObjectInputTransducer transducer = new NsObjectInputTransducer(clientService, schema, schema.getName());
List<IndexedRecord> recordList = new ArrayList<>();
while (count > 0) {
T nsRecord = objectComposer.composeObject();
IndexedRecord convertedRecord = transducer.read(nsRecord);
Schema recordSchema = convertedRecord.getSchema();
GenericRecord record = new GenericData.Record(recordSchema);
for (Schema.Field field : schema.getFields()) {
Object value = convertedRecord.get(field.pos());
record.put(field.pos(), value);
}
recordList.add(record);
count--;
}
return recordList;
}
Aggregations