for (Statement target_stmt : target_proc.getStatements()) {
int idx = target_stmt.getName().indexOf("MultiSite");
if (idx == -1)
continue;
String base_name = target_stmt.getName().substring(0, idx);
Statement source_stmt = source_proc.getStatements().get(base_name);
assert (target_stmt != null);
// Copy fields
for (String field : source_stmt.getFields()) {
Object value = source_stmt.getField(field);
if (!(value instanceof CatalogMap)) {
CatalogProxy.set(target_stmt, field, value);
}
} // FOR
// Lines we need to remove
String orig_catalog_id = null;
String new_catalog_id = null;
for (PlanFragment target_frag : target_stmt.getFragments()) {
assert (orig_catalog_id == null);
orig_catalog_id = target_frag.getName();
} // FOR
// Copy PlanFragments
for (PlanFragment source_frag : source_stmt.getFragments()) {
PlanFragment target_frag = target_stmt.getFragments().add(source_frag.getName());
// Copy fields
for (String field : source_frag.getFields()) {
Object value = source_frag.getField(field);