com.metaeffekt.artifact.analysis.spdxbom.mapper.ArtifactMapper Maven / Gradle / Ivy
/*
* Copyright 2021-2024 the original author or authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package com.metaeffekt.artifact.analysis.spdxbom.mapper;
import com.metaeffekt.artifact.analysis.spdxbom.config.StoredConfig;
import com.metaeffekt.artifact.analysis.spdxbom.context.SpdxDocumentContext;
import com.metaeffekt.artifact.terms.model.TermsMetaData;
import lombok.Getter;
import org.metaeffekt.core.inventory.processor.model.Artifact;
import org.spdx.library.InvalidSPDXAnalysisException;
import org.spdx.library.model.SpdxItem;
import java.util.Collections;
import java.util.Set;
public interface ArtifactMapper {
/**
* Result holder object for mapping feedback.
*
* Helps keep mappers modular.
*/
@Getter
class Result {
Result(SpdxItem spdxItem, Set attributesWritten, Set referencedLicenses) {
this.spdxItem = spdxItem;
this.attributesWritten = Collections.unmodifiableSet(attributesWritten);
this.referencedLicenses = Collections.unmodifiableSet(referencedLicenses);
}
private final SpdxItem spdxItem;
private final Set attributesWritten;
private final Set referencedLicenses;
}
/**
* Map an artifact to an SpdxItem.
*
* Note that the spdx item may not have been added to the document yet (may need relationship to document?).
*
* @param artifact The artifact to be converted.
* @param spdxDocumentContext The SpdxDocument to use.
*
* @return Returns the result of conversion.
*
* @throws InvalidSPDXAnalysisException Throws in case of issues during conversion.
*/
Result getMapped(Artifact artifact, SpdxDocumentContext spdxDocumentContext) throws InvalidSPDXAnalysisException;
/**
* Gets the default configuration for this Mapper.
* May be null if the mapper has no default config.
*
* @return A default configuration for use with this mapper.
*/
StoredConfig getDefaultConfig();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy