@@ -0,0 +1,2536 @@
+package org.slc.sli.ingestion.xml.idref;%0D%0A%0D%0Aimport java.util.concurrent.Callable;%0D%0A%0D%0Aimport org.slc.sli.ingestion.Fault;%0D%0Aimport org.slc.sli.ingestion.landingzone.IngestionFileEntry;%0D%0Aimport org.slc.sli.ingestion.validation.ErrorReport;%0D%0Aimport org.slf4j.Logger;%0D%0Aimport org.slf4j.LoggerFactory;%0D%0A%0D%0A/**%0D%0A * Id Reference Resolution of the future...%0D%0A * %0D%0A * @author shalka%0D%0A */%0D%0Apublic class IdRefResolutionCallable implements Callable%3CBoolean%3E %7B%0D%0A%0D%0A    private static final Logger LOG = LoggerFactory.getLogger(IdRefResolutionCallable.class);%0D%0A    %0D%0A    private IdRefResolutionHandler resolver;    %0D%0A    private IngestionFileEntry entry;%0D%0A    %0D%0A    /**%0D%0A     * Default constructor for the id reference resolution callable.%0D%0A     * %0D%0A     * @param handler IdRefResolutionHandler to resolve references in ingestion file entries.%0D%0A     * @param fileEntry ingestion file entry.%0D%0A     */%0D%0A    public IdRefResolutionCallable(IdRefResolutionHandler handler, IngestionFileEntry fileEntry) %7B%0D%0A        this.resolver = handler;%0D%0A        this.entry = fileEntry;%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Entry point of IdRefResolutionCallable.%0D%0A     */%0D%0A    @Override%0D%0A    public Boolean call() throws Exception %7B%0D%0A        LOG.info(%22Starting IdRefResolutionCallable for: %22 + entry.getFileName());        %0D%0A        IngestionFileEntry fileEntry = processResolution(entry, entry.getErrorReport());   %0D%0A        int errorCount = aggregateAndLogResolutionErrors(fileEntry);%0D%0A        LOG.info(%22Finished IdRefResolutionCallable for: %22 + entry.getFileName());%0D%0A        return (errorCount %3E 0);%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Process id reference resolution using the specified handler.%0D%0A     * %0D%0A     * @param fileEntry ingestion file entry.%0D%0A     * @param errorReport error report.%0D%0A     * @return ingestion file entry (contains faults and errors).%0D%0A     */%0D%0A    private IngestionFileEntry processResolution(IngestionFileEntry fileEntry, ErrorReport errorReport) %7B%0D%0A        return resolver.handle(fileEntry, errorReport);%0D%0A    %7D%0D%0A    %0D%0A    /**%0D%0A     * Logs errors incurred during id reference resolution.%0D%0A     * %0D%0A     * @param fileEntry ingestion file entry.%0D%0A     * @return integer representing number of errors during id reference resolution.%0D%0A     */%0D%0A    private int aggregateAndLogResolutionErrors(IngestionFileEntry fileEntry) %7B%0D%0A        int errorCount = 0;%0D%0A        for (Fault fault : fileEntry.getFaultsReport().getFaults()) %7B%0D%0A            if (fault.isError()) %7B%0D%0A                errorCount++;%0D%0A            %7D%0D%0A        %7D%0D%0A        return errorCount;%0D%0A    %7D%0D%0A%7D%0D%0A

create id reference resolution callable for multi-threaded id reference resolutions