use of com.revolsys.record.io.ListRecordReader in project com.revolsys.open by revolsys.
the class RecordStore method getRecords.
default RecordReader getRecords(final PathName path) {
final RecordStoreSchemaElement element = getRootSchema().getElement(path);
if (element instanceof RecordDefinition) {
final RecordDefinition recordDefinition = (RecordDefinition) element;
final Query query = new Query(recordDefinition);
return getRecords(query);
} else if (element instanceof RecordStoreSchema) {
final RecordStoreSchema schema = (RecordStoreSchema) element;
final List<Query> queries = new ArrayList<>();
for (final RecordDefinition recordDefinition : schema.getRecordDefinitions()) {
final Query query = new Query(recordDefinition);
queries.add(query);
}
return getRecords(queries);
} else {
return new ListRecordReader(null, Collections.emptyList());
}
}
use of com.revolsys.record.io.ListRecordReader in project com.revolsys.open by revolsys.
the class AbstractRecordLayer method copyRecordsToClipboard.
public void copyRecordsToClipboard(final List<LayerRecord> records) {
if (!records.isEmpty()) {
final RecordDefinition recordDefinition = getRecordDefinition();
final List<Record> copies = new ArrayList<>();
for (final LayerRecord record : records) {
final ArrayRecord recordCopy = new ArrayRecord(recordDefinition, record);
copies.add(recordCopy);
}
final RecordReader reader = new ListRecordReader(recordDefinition, copies);
final RecordReaderTransferable transferable = new RecordReaderTransferable(reader);
ClipboardUtil.setContents(transferable);
}
}
use of com.revolsys.record.io.ListRecordReader in project com.revolsys.open by revolsys.
the class RecordHttpMessageConverter method write.
@Override
public void write(final Record record, final MediaType mediaType, final HttpOutputMessage outputMessage) throws IOException, HttpMessageNotWritableException {
if (!HttpServletUtils.getResponse().isCommitted()) {
if (record != null) {
final RecordDefinition recordDefinition = record.getRecordDefinition();
final RequestAttributes requestAttributes = RequestContextHolder.getRequestAttributes();
requestAttributes.setAttribute(IoConstants.SINGLE_OBJECT_PROPERTY, true, RequestAttributes.SCOPE_REQUEST);
final ListRecordReader reader = new ListRecordReader(recordDefinition, record);
this.readerConverter.write(reader, mediaType, outputMessage);
}
}
}
Aggregations