org.whitesource.agent.api.dispatch.BaseCheckPoliciesResult Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of wss-agent-api Show documentation
Show all versions of wss-agent-api Show documentation
Java bindings for White Source API
/**
* Copyright (C) 2012 White Source Ltd.
*
* 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 org.whitesource.agent.api.dispatch;
import org.whitesource.agent.api.model.PolicyCheckResourceNode;
import org.whitesource.agent.api.model.ResourceInfo;
import java.util.*;
/**
* Base, abstract Result of check policy requests.
*
* @author anna.rozin
*/
public abstract class BaseCheckPoliciesResult extends BaseResult {
/* --- Static members --- */
private static final long serialVersionUID = -4268012175086999291L;
/* --- Members --- */
/**
* Map of project name to the root of its dependency graph with policies application result.
*/
private Map existingProjects;
/**
* Map of project name to the root of its dependency graph with policies application result.
*/
private Map newProjects;
/**
* Map of project name to its set of new resources to insert into inventory.
*/
private Map> projectNewResources;
/* --- Constructors --- */
/**
* Default constructor
*/
public BaseCheckPoliciesResult() {
existingProjects = new HashMap();
newProjects = new HashMap();
projectNewResources = new HashMap>();
}
/**
* Constructor
*
* @param organization Name of the domain.
*/
public BaseCheckPoliciesResult(String organization) {
this();
setOrganization(organization);
}
/* --- Public methods --- */
/**
* @return True if some project in this result have some rejected dependency.
*/
public boolean hasRejections() {
boolean hasRejections = false;
Collection roots = new ArrayList();
roots.addAll(getExistingProjects().values());
roots.addAll(getNewProjects().values());
Iterator iterator = roots.iterator();
while (iterator.hasNext() && !hasRejections ) {
hasRejections = iterator.next().hasRejections();
}
return hasRejections;
}
/* --- Getters / Setters --- */
public Map getNewProjects() {
return newProjects;
}
public void setNewProjects(Map newProjects) {
this.newProjects = newProjects;
}
public Map getExistingProjects() {
return existingProjects;
}
public void setExistingProjects(Map existingProjects) {
this.existingProjects = existingProjects;
}
public Map> getProjectNewResources() {
return projectNewResources;
}
public void setProjectNewResources(Map> projectNewResources) {
this.projectNewResources = projectNewResources;
}
}