spreadsheet.mapper.w2o.validation.engine.DependencyEngineHelper Maven / Gradle / Ivy
package spreadsheet.mapper.w2o.validation.engine;
import org.apache.commons.collections.CollectionUtils;
import spreadsheet.mapper.w2o.validation.validator.cell.DependencyValidator;
import java.util.*;
/**
* Created by hanwen on 2017/1/6.
*/
public class DependencyEngineHelper {
private DependencyEngineHelper() {
// default constructor
}
/**
* create directed graph of dependency validators
*
* @param validatorMap dependency validators
* @return the directed graph
*/
public static LinkedHashMap> buildVGraph(Map> validatorMap) {
LinkedHashMap> vGraph = new LinkedHashMap<>();
for (Map.Entry> entry : validatorMap.entrySet()) {
String key = entry.getKey();
vGraph.put(key, new LinkedHashSet());
for (DependencyValidator dataValidator : entry.getValue()) {
Set dependsOn = dataValidator.getDependsOn();
if (CollectionUtils.isNotEmpty(dependsOn)) {
vGraph.get(key).addAll(dependsOn);
}
}
}
return vGraph;
}
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy