<commit_before>/*
 * 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.modules.UserArtifacts;

import com.sun.media.jfxmedia.logging.Logger;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;

/**
 *
 * @author oliver
 */
public class UserArtifactIngestModule implements DataSourceIngestModule {

    private IngestJobContext context = null;
    private BlackboardArtifact.Type type1, type2;
    int type1ID, type2ID;

    @Override
    public ProcessResult process(Content dataSource, DataSourceIngestModuleProgress progressBar) {
        progressBar.switchToDeterminate(2);
        try {
            BlackboardArtifact art1 = dataSource.newArtifact(type1ID);
            art1.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_KEYWORD_PREVIEW, 
            UserArtifactIngestModuleFactory.getModuleName(), 4));
            progressBar.progress(1);
            BlackboardArtifact art2 = dataSource.newArtifact(type2ID);
            art2.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_MIN_COUNT, 
            UserArtifactIngestModuleFactory.getModuleName(), 4));
            progressBar.progress(1);
            return ProcessResult.OK;
        }
        catch (TskCoreException ex) {
            return ProcessResult.ERROR;
        }
    }

    @Override
    public void startUp(IngestJobContext context) throws IngestModuleException {
        this.context = context;
        type1 = new BlackboardArtifact.Type(39, "TSK_TEST1", "Test 1");
        type2 = new BlackboardArtifact.Type(40, "TSK_TEST2", "Test 2");
        try {
            type1ID = Case.getCurrentCase().getSleuthkitCase().addArtifactType(type1.getTypeName(), type1.getDisplayName());
            type2ID = Case.getCurrentCase().getSleuthkitCase().addArtifactType(type2.getTypeName(), type2.getDisplayName());
        }<commit_msg>Changed attribute type on ingest module<commit_after>/*
 * 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.modules.UserArtifacts;

import com.sun.media.jfxmedia.logging.Logger;
import org.sleuthkit.autopsy.casemodule.Case;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModule;
import org.sleuthkit.autopsy.ingest.DataSourceIngestModuleProgress;
import org.sleuthkit.autopsy.ingest.IngestJobContext;
import org.sleuthkit.datamodel.BlackboardArtifact;
import org.sleuthkit.datamodel.BlackboardAttribute;
import org.sleuthkit.datamodel.BlackboardAttribute.ATTRIBUTE_TYPE;
import org.sleuthkit.datamodel.Content;
import org.sleuthkit.datamodel.TskCoreException;

/**
 *
 * @author oliver
 */
public class UserArtifactIngestModule implements DataSourceIngestModule {

    private IngestJobContext context = null;
    private BlackboardArtifact.Type type1, type2;
    int type1ID, type2ID;

    @Override
    public ProcessResult process(Content dataSource, DataSourceIngestModuleProgress progressBar) {
        progressBar.switchToDeterminate(2);
        try {
            BlackboardArtifact art1 = dataSource.newArtifact(type1ID);
            art1.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_COUNT, 
            UserArtifactIngestModuleFactory.getModuleName(), 5));
            progressBar.progress(1);
            BlackboardArtifact art2 = dataSource.newArtifact(type2ID);
            art2.addAttribute(new BlackboardAttribute(ATTRIBUTE_TYPE.TSK_MIN_COUNT, 
            UserArtifactIngestModuleFactory.getModuleName(), 4));
            progressBar.progress(1);
            return ProcessResult.OK;
        }
        catch (TskCoreException ex) {
            return ProcessResult.ERROR;
        }
    }

    @Override
    public void startUp(IngestJobContext context) throws IngestModuleException {
        this.context = context;
        type1 = new BlackboardArtifact.Type(39, "TSK_TEST1", "Test 1");
        type2 = new BlackboardArtifact.Type(40, "TSK_TEST2", "Test 2");
        try {
            type1ID = Case.getCurrentCase().getSleuthkitCase().addArtifactType(type1.getTypeName(), type1.getDisplayName());
            type2ID = Case.getCurrentCase().getSleuthkitCase().addArtifactType(type2.getTypeName(), type2.getDisplayName());
        }
{'fraction_non_alphanumeric': 0.08778467908902692, 'fraction_numerical': 0.012836438923395446, 'mean_word_length': 3.831, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '6544613', 'n_tokens_mistral': 1451, 'n_tokens_neox': 1419, 'n_words': 259}