gov.nasa.pds.citool.ri.RIChecker Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of catalog-legacy Show documentation
Show all versions of catalog-legacy Show documentation
The Legacy Catalog Tool provides functionality for ingesting PDS3 catalog files into the PDS4 infrastructure including the Registry Service.
package gov.nasa.pds.citool.ri;
import gov.nasa.pds.tools.LabelParserException;
import gov.nasa.pds.tools.label.AttributeStatement;
import gov.nasa.pds.tools.label.Label;
import java.net.URL;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
/**
* Base class for Referential Integrity checking.
*
* @author mcayanan
*
*/
public abstract class RIChecker {
protected URL supportFile = null;
private List problems =
new ArrayList();
public Map getUnmatchedValues(
List parents,
List children) {
ValueMatcher matcher = new ValueMatcher(parents);
return matcher.getUnmatched(children);
}
public Map getUnmatchedValues(
Map> parents,
Map> children) {
Map result =
new LinkedHashMap();
for(String identifier : children.keySet()) {
result.putAll(getUnmatchedValues(parents.get(identifier),
children.get(identifier)));
}
return result;
}
public void setSupportFile(URL url) {
supportFile = url;
}
public void addProblem(LabelParserException problem) {
problems.add(problem);
}
public void addProblems(List problems) {
this.problems.addAll(problems);
}
public List getProblems() {
return problems;
}
public boolean hasProblems() {
if (problems.isEmpty()) {
return false;
} else {
return true;
}
}
/**
* Determine if the supplied list of catalog files has
* referential integrity.
*
* @param parents A list of parent labels.
* @param children A list of child labels.
*
*/
abstract public void performCheck(List
© 2015 - 2024 Weber Informatics LLC | Privacy Policy