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

org.whitesource.modules.ResolutionResult Maven / Gradle / Ivy

The newest version!
/**
 * The project is licensed under the WhiteSource Software End User License Agreement .
 * Copyright (C) 2015 WhiteSource Ltd.
 * Licensed under the WhiteSource Software End User License Agreement;
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 * https://s3.amazonaws.com/unified-agent/LICENSE.txt
 */
package org.whitesource.modules;

import org.whitesource.agent.api.model.AgentProjectInfo;
import org.whitesource.agent.api.model.DependencyInfo;
import org.whitesource.agent.api.model.DependencyType;

import java.nio.file.Path;
import java.nio.file.Paths;
import java.util.ArrayList;
import java.util.Collection;
import java.util.HashMap;
import java.util.Map;

/**
 * Created by eugen on 6/21/2017.
 */
public class ResolutionResult {

    /* --- Members --- */

    private Map resolvedProjects;
    private Collection excludes;
    private final DependencyType dependencyType;
    private final String topLevelFolder;
    private boolean isMultiProject;

    /* --- Constructors --- */

    public ResolutionResult(Map resolvedProjects, Collection excludes, DependencyType dependencyType,
                            String topLevelFolder) {
        this.resolvedProjects = resolvedProjects;
        this.excludes = excludes;
        this.dependencyType = dependencyType;
        this.topLevelFolder = topLevelFolder;
        this.isMultiProject = false;
    }

    public ResolutionResult(Collection dependencies, Iterable excludes, DependencyType dependencyType, String topLevelFolder) {
        AgentProjectInfo projectInfo = new AgentProjectInfo();
        dependencies.forEach(dependencyInfo -> projectInfo.getDependencies().add(dependencyInfo));

        this.resolvedProjects = new HashMap<>();
        this.resolvedProjects.put(projectInfo, Paths.get(topLevelFolder));
        this.excludes = new ArrayList<>();
        this.dependencyType = dependencyType;
        this.topLevelFolder = topLevelFolder;
        excludes.forEach(exclude -> this.excludes.add(exclude));
        this.isMultiProject = false;
    }

    /* --- Getters --- */

    public Collection getExcludes() {
        return excludes;
    }

    public Map getResolvedProjects() {
        return resolvedProjects;
    }

    public DependencyType getDependencyType() {
        return dependencyType;
    }

    public String getTopLevelFolder() {
        return topLevelFolder;
    }

    public boolean isMultiProject() {
        return isMultiProject;
    }

    public void setMultiProject(boolean multiProject) {
        isMultiProject = multiProject;
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy