/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package org.sleuthkit.autopsy.centralrepository.contentviewer;

import java.util.Objects;
import org.sleuthkit.autopsy.centralrepository.datamodel.CorrelationAttributeInstance;

/**
 *
 * @author Andrrew
 */
final class ArtifactKey {
    
    private final String dataSource;
    private final String filePath;
    
    ArtifactKey(String theDataSource, String theFilePath) {
        dataSource = theDataSource;
        filePath = theFilePath;
    }
    
    ArtifactKey(CorrelationAttributeInstance instance) {
        dataSource = instance.getCorrelationDataSource().getDeviceID();
        filePath = instance.getFilePath();
    }
    
    String getDataSource() {
        return dataSource;
    }
    
    String getFilePath() {
        return filePath;
    }
    
    @Override
    public boolean equals(Object other) {
        if (other instanceof ArtifactKey) {
            return ((ArtifactKey) other).getDataSource().equals(dataSource) && ((ArtifactKey) other).getFilePath().equals(filePath);
        }
        return false;
        
    }

    @Override
    public int hashCode() {
        int hash = 7;
        hash = 67 * hash + Objects.hashCode(this.dataSource);
        hash = 67 * hash + Objects.hashCode(this.filePath);
        return hash;
    }
}

@@ -3,181 +3,677 @@
 %0A * 
-To change this license header, choose License Headers in Project Properties.%0A * To change this template file, choose Tools %7C Templates%0A * and open the template in the editor
+Central Repository%0A *%0A * Copyright 2015-2017 Basis Technology Corp.%0A * Contact: carrier %3Cat%3E sleuthkit %3Cdot%3E org%0A *%0A * Licensed under the Apache License, Version 2.0 (the %22License%22);%0A * you may not use this file except in compliance with the License.%0A * You may obtain a copy of the License at%0A *%0A *     http://www.apache.org/licenses/LICENSE-2.0%0A *%0A * Unless required by applicable law or agreed to in writing, software%0A * distributed under the License is distributed on an %22AS IS%22 BASIS,%0A * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.%0A * See the License for the specific language governing permissions and%0A * limitations under the License
 .%0A *
@@ -862,27 +862,121 @@
 *%0A *
-%0A * @author Andrrew
+ Used as a key to ensure we eliminate duplicates from the result set by not overwriting CR correlation instances.
 %0A */
@@ -1414,70 +1414,223 @@
     
-String getDataSource() %7B%0A        return dataSource;%0A    %7D%0A    
+/**%0A     * %0A     * @return the dataSource device ID%0A     */%0A    String getDataSource() %7B%0A        return dataSource;%0A    %7D%0A    %0A    /**%0A     * %0A     * @return the filPath including the filename and extension.%0A     */
 %0A   

Add comments