Search in sources :

Example 1 with DefaultConformanceResult

use of org.apache.sis.metadata.iso.quality.DefaultConformanceResult in project sis by apache.

the class Validator method addViolationReport.

/**
 * Adds a report for a constraint violation. If the given {@code report} is {@code null}, then this method creates
 * a new {@link DefaultDomainConsistency} instance with the measure identification set to the property name.
 *
 * <div class="note"><b>Note:</b>
 * setting {@code measureIdentification} to the property name may look like a departure from ISO intent,
 * since the former should be an identification of the <em>quality measurement</em> rather then the measure itself.
 * (setting {@code measureDescription} to {@code type.getDescription()} would probably be wrong for that reason).
 * However {@code measureIdentification} is only an identifier, not a full description of the quality measurement
 * We are not strictly forbidden to use the same identifier for both the quality measurement than the measurement
 * itself. However strictly speaking, maybe we should use a different scope.</div>
 *
 * @param  report       where to add the result, or {@code null} if not yet created.
 * @param  type         description of the property for which a constraint violation has been found.
 * @param  explanation  explanation of the constraint violation.
 * @return the {@code report}, or a new report if {@code report} was null.
 */
private AbstractElement addViolationReport(AbstractElement report, final AbstractIdentifiedType type, final InternationalString explanation) {
    if (report == null) {
        final GenericName name = type.getName();
        report = new DefaultDomainConsistency();
        // Do not invoke report.setMeasureDescription(type.getDescription()) - see above javadoc.
        report.setMeasureIdentification(name instanceof Identifier ? (Identifier) name : new NamedIdentifier(name));
        report.setEvaluationMethodType(EvaluationMethodType.DIRECT_INTERNAL);
        quality.getReports().add(report);
    }
    report.getResults().add(new DefaultConformanceResult(null, explanation, false));
    return report;
}
Also used : GenericName(org.opengis.util.GenericName) DefaultDomainConsistency(org.apache.sis.metadata.iso.quality.DefaultDomainConsistency) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) Identifier(org.opengis.metadata.Identifier) NamedIdentifier(org.apache.sis.referencing.NamedIdentifier) DefaultConformanceResult(org.apache.sis.metadata.iso.quality.DefaultConformanceResult)

Aggregations

DefaultConformanceResult (org.apache.sis.metadata.iso.quality.DefaultConformanceResult)1 DefaultDomainConsistency (org.apache.sis.metadata.iso.quality.DefaultDomainConsistency)1 NamedIdentifier (org.apache.sis.referencing.NamedIdentifier)1 Identifier (org.opengis.metadata.Identifier)1 GenericName (org.opengis.util.GenericName)1