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;
}
}
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;
}
}
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;
}
}
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;
}
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);
}
}
Aggregations