Search in sources :

Example 1 with Sequential

use of com.revolsys.parallel.process.Sequential 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;
    }
}
Also used : Sequential(com.revolsys.parallel.process.Sequential) List(java.util.List) PathName(com.revolsys.io.PathName) Parallel(com.revolsys.parallel.process.Parallel) CopyRecords(com.revolsys.process.CopyRecords) Map(java.util.Map)

Aggregations

PathName (com.revolsys.io.PathName)1 Parallel (com.revolsys.parallel.process.Parallel)1 Sequential (com.revolsys.parallel.process.Sequential)1 CopyRecords (com.revolsys.process.CopyRecords)1 List (java.util.List)1 Map (java.util.Map)1