All Downloads are FREE. Search and download functionalities are using the official Maven repository.

org.metaeffekt.artifact.resolver.generic.AbstractArtifactResolver Maven / Gradle / Ivy

There is a newer version: 0.134.0
Show newest version
package org.metaeffekt.artifact.resolver.generic;

import org.apache.commons.lang3.StringUtils;
import org.metaeffekt.artifact.resolver.ArtifactResolver;
import org.metaeffekt.artifact.resolver.ResolverResult;
import org.metaeffekt.artifact.resolver.model.ArtifactPartType;
import org.metaeffekt.core.inventory.processor.model.Artifact;

public abstract class AbstractArtifactResolver implements ArtifactResolver {

    protected Artifact initializeEnrichedArtifact(Artifact artifact, ArtifactPartType partType, ResolverResult resolvedResult) {

        // add en enriched artifact
        final Artifact enrichedArtifact = new Artifact(artifact);

        // manage error
        final String error = resolvedResult.getErrorMessage();
        if (StringUtils.isNotBlank(error)) {
            String errorAttribute = partType.modulateAttributeInContext("Errors");
            enrichedArtifact.append(errorAttribute, error, ", ");
        }

        return enrichedArtifact;
    }

}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy