use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class RecordPseudoNodeRemovalVisitor method mergeEdgePairs.
private void mergeEdgePairs(final Node<Record> node, final List<EdgePair<Record>> edgePairs) {
if (edgePairs != null) {
for (final EdgePair<Record> edgePair : edgePairs) {
final Edge<Record> edge1 = edgePair.getEdge1();
final Edge<Record> edge2 = edgePair.getEdge2();
final Record object = edge1.getObject();
if (mergeEdges(node, edge1, edge2) != null) {
this.mergedStatistics.addCount(object);
}
}
}
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class SimpleRecordConveter method convert.
@Override
public Record convert(final Record sourceObject) {
final Record targetObject = this.factory.newRecord(this.recordDefinition);
final Geometry sourceGeometry = sourceObject.getGeometry();
final GeometryFactory geometryFactory = sourceGeometry.getGeometryFactory();
final Geometry targetGeometry = geometryFactory.geometry(sourceGeometry);
targetObject.setGeometryValue(targetGeometry);
for (final SourceToTargetProcess<Record, Record> processor : this.processors) {
processor.process(sourceObject, targetObject);
}
return targetObject;
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class SetCodeTableId method process.
@Override
public void process(final Record source, final Record target) {
final Map<String, Object> codeTableValues = new HashMap<>();
for (final Entry<String, Converter<Record, Object>> entry : this.codeTableValueConverters.entrySet()) {
String codeTableFieldName = entry.getKey();
final Converter<Record, Object> sourceAttributeConverter = entry.getValue();
Object sourceValue = sourceAttributeConverter.convert(source);
if (sourceValue != null) {
final RecordDefinition targetRecordDefinition = target.getRecordDefinition();
String codeTableValueName = null;
final int dotIndex = codeTableFieldName.indexOf(".");
if (dotIndex != -1) {
codeTableValueName = codeTableFieldName.substring(dotIndex + 1);
codeTableFieldName = codeTableFieldName.substring(0, dotIndex);
}
final CodeTable targetCodeTable = targetRecordDefinition.getCodeTableByFieldName(codeTableFieldName);
if (targetCodeTable != null) {
if (codeTableValueName == null) {
sourceValue = targetCodeTable.getIdentifier(sourceValue);
} else {
sourceValue = targetCodeTable.getIdentifier(Collections.singletonMap(codeTableValueName, sourceValue));
}
}
}
codeTableValues.put(codeTableFieldName, sourceValue);
}
final Object codeId = this.codeTable.getIdentifier(codeTableValues);
target.setValue(this.targetFieldName, codeId);
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class CompareProcessor method processExactLineMatch.
private void processExactLineMatch(final Record sourceObject) {
final LineString sourceLine = sourceObject.getGeometry();
final LineEqualIgnoreDirectionFilter lineEqualFilter = new LineEqualIgnoreDirectionFilter(sourceLine, 3);
final Predicate<Record> geometryFilter = new RecordGeometryFilter<>(lineEqualFilter);
final Predicate<Record> equalFilter = this.equalFilterFactory.apply(sourceObject);
final Predicate<Record> filter = equalFilter.and(geometryFilter);
final Record otherObject = this.otherIndex.queryFirst(sourceObject, filter);
if (otherObject != null) {
this.equalStatistics.addCount(sourceObject);
removeObject(sourceObject);
removeOtherObject(otherObject);
}
}
use of com.revolsys.record.Record in project com.revolsys.open by revolsys.
the class CompareProcessor method processObjects.
@Override
protected void processObjects(final RecordDefinition recordDefinition, final Channel<Record> out) {
if (this.otherIndex.size() + this.otherPointMap.size() == 0) {
if (this.logNotEqualSource) {
for (final Record object : this.sourceObjects) {
logError(object, "Source missing in Other", true);
}
}
} else {
processExactPointMatches();
processExactLineMatches();
processPartialMatches();
}
for (final Record object : this.otherIndex.getAll()) {
logError(object, "Other missing in Source", false);
}
for (final Record record : this.otherPointMap.getAll()) {
logError(record, "Other missing in Source", false);
}
if (this.logNotEqualSource) {
for (final Record object : this.sourceObjects) {
logError(object, "Source missing in Other", true);
}
}
this.sourceObjects.clear();
this.otherIndex = null;
this.otherPointMap.clear();
}
Aggregations