use of com.revolsys.parallel.process.Parallel in project com.revolsys.open by revolsys.
the class MultiCopyRecords method newProcess.
@SuppressWarnings("unchecked")
protected Process newProcess(final Map<String, Object> processDefinition) {
if (processDefinition == null) {
return null;
} else {
final String type = MapObjectFactory.getType(processDefinition);
if ("copyRecords".equals(type)) {
final PathName typePath = PathName.newPathName(processDefinition.get("typePath"));
if (Property.hasValue(typePath)) {
final boolean hasSequence = Maps.getBool(processDefinition, "hasSequence");
final Map<String, Boolean> orderBy = Maps.get(processDefinition, "orderBy", Collections.<String, Boolean>emptyMap());
final CopyRecords copy = new CopyRecords(this.sourceRecordStore, typePath, orderBy, this.targetRecordStore, hasSequence);
return copy;
} else {
Logs.error(this, "Parameter 'typePath' required for type='copyRecords'");
}
} else if ("sequential".equals(type)) {
final List<Map<String, Object>> processList = (List<Map<String, Object>>) processDefinition.get("processes");
if (processList == null) {
Logs.error(this, "Parameter 'processes' required for type='sequential'");
} else {
final Sequential processes = new Sequential();
newProcesses(processes, processList);
return processes;
}
} else if ("parallel".equals(type)) {
final List<Map<String, Object>> processList = (List<Map<String, Object>>) processDefinition.get("processes");
if (processList == null) {
Logs.error(this, "Parameter 'processes' required for type='parallel'");
} else {
final Parallel processes = new Parallel();
newProcesses(processes, processList);
return processes;
}
} else {
Logs.error(this, "Parameter type=" + type + " not in 'copyRecords', 'sequential', 'copyRecords'");
}
return null;
}
}
Aggregations