Search in sources :

Example 21 with Record

use of com.revolsys.record.Record in project com.revolsys.open by revolsys.

the class RecordStore method newRecord.

default Record newRecord(RecordDefinition recordDefinition, final Map<String, ? extends Object> values) {
    final PathName typePath = recordDefinition.getPathName();
    recordDefinition = getRecordDefinition(recordDefinition);
    if (recordDefinition == null) {
        throw new IllegalArgumentException("Cannot find table " + typePath + " for " + this);
    } else {
        final Record record = newRecord(recordDefinition);
        if (record != null) {
            record.setValues(values);
            final String idFieldName = recordDefinition.getIdFieldName();
            if (Property.hasValue(idFieldName)) {
                if (values.get(idFieldName) == null) {
                    final Identifier id = newPrimaryIdentifier(typePath);
                    record.setIdentifier(id);
                }
            }
        }
        return record;
    }
}
Also used : Identifier(com.revolsys.identifier.Identifier) Record(com.revolsys.record.Record) ArrayRecord(com.revolsys.record.ArrayRecord) PathName(com.revolsys.io.PathName)

Example 22 with Record

use of com.revolsys.record.Record in project com.revolsys.open by revolsys.

the class RecordStore method newRecord.

default Record newRecord(final Record record) {
    final RecordDefinition recordDefinition = record.getRecordDefinition();
    final RecordDefinition recordStoreRecordDefinition = getRecordDefinition(recordDefinition);
    final RecordFactory<Record> recordFactory = getRecordFactory();
    if (recordStoreRecordDefinition == null || recordFactory == null) {
        return null;
    } else {
        final Record copy = recordFactory.newRecord(recordStoreRecordDefinition);
        copy.setValuesClone(record);
        copy.setIdentifier(null);
        return copy;
    }
}
Also used : Record(com.revolsys.record.Record) ArrayRecord(com.revolsys.record.ArrayRecord)

Example 23 with Record

use of com.revolsys.record.Record in project com.revolsys.open by revolsys.

the class RecordStore method newRecord.

default Record newRecord(final RecordDefinition objectRecordDefinition) {
    final RecordDefinition recordDefinition = getRecordDefinition(objectRecordDefinition);
    final RecordFactory<Record> recordFactory = getRecordFactory();
    if (recordDefinition == null || recordFactory == null) {
        return null;
    } else {
        final Record record = recordFactory.newRecord(recordDefinition);
        return record;
    }
}
Also used : Record(com.revolsys.record.Record) ArrayRecord(com.revolsys.record.ArrayRecord)

Example 24 with Record

use of com.revolsys.record.Record in project com.revolsys.open by revolsys.

the class RecordStore method insertRecord.

default Record insertRecord(final PathName pathName, final Object... values) {
    final RecordDefinition recordDefinition = getRecordDefinition(pathName);
    final Record record = new ArrayRecord(recordDefinition, values);
    insertRecord(record);
    return record;
}
Also used : ArrayRecord(com.revolsys.record.ArrayRecord) Record(com.revolsys.record.Record) ArrayRecord(com.revolsys.record.ArrayRecord)

Example 25 with Record

use of com.revolsys.record.Record in project com.revolsys.open by revolsys.

the class RecordStore method newIterator.

default AbstractIterator<Record> newIterator(final Query query, Map<String, Object> properties) {
    if (properties == null) {
        properties = Collections.emptyMap();
    }
    if (query == null) {
        return null;
    } else {
        final RecordDefinition recordDefinition = query.getRecordDefinition();
        if (recordDefinition != null) {
            final RecordStoreIteratorFactory recordStoreIteratorFactory = recordDefinition.getProperty("recordStoreIteratorFactory");
            if (recordStoreIteratorFactory != null) {
                final AbstractIterator<Record> iterator = recordStoreIteratorFactory.newIterator(this, query, properties);
                if (iterator != null) {
                    return iterator;
                }
            }
        }
        final RecordStoreIteratorFactory iteratorFactory = getIteratorFactory();
        return iteratorFactory.newIterator(this, query, properties);
    }
}
Also used : RecordStoreIteratorFactory(com.revolsys.jdbc.io.RecordStoreIteratorFactory) Record(com.revolsys.record.Record) ArrayRecord(com.revolsys.record.ArrayRecord)

Aggregations

Record (com.revolsys.record.Record)198 ArrayRecord (com.revolsys.record.ArrayRecord)43 RecordReader (com.revolsys.record.io.RecordReader)34 RecordDefinition (com.revolsys.record.schema.RecordDefinition)34 Geometry (com.revolsys.geometry.model.Geometry)29 LineString (com.revolsys.geometry.model.LineString)21 Point (com.revolsys.geometry.model.Point)20 ChannelWriter (com.revolsys.io.channels.ChannelWriter)19 Identifier (com.revolsys.identifier.Identifier)17 ArrayList (java.util.ArrayList)16 FieldDefinition (com.revolsys.record.schema.FieldDefinition)15 GeometryFactory (com.revolsys.geometry.model.GeometryFactory)14 LayerRecord (com.revolsys.swing.map.layer.record.LayerRecord)13 NoSuchElementException (java.util.NoSuchElementException)13 DataType (com.revolsys.datatype.DataType)10 Query (com.revolsys.record.query.Query)9 HashMap (java.util.HashMap)9 List (java.util.List)8 LinkedHashMap (java.util.LinkedHashMap)7 Edge (com.revolsys.geometry.graph.Edge)6