Exemple #1
0
  /** {@inheritDoc} */
  @Override
  public List<Violation> getViolations(ViolationQuery violationQuery) {
    Resource resource = violationQuery.getResource();
    if (resource == null) {
      throw new IllegalArgumentException(
          "A resource must be set on the ViolationQuery in order to search for violations.");
    }

    if (!Scopes.isHigherThanOrEquals(resource, Scopes.FILE)) {
      return Collections.emptyList();
    }

    Bucket bucket = buckets.get(resource);
    if (bucket == null) {
      return Collections.emptyList();
    }

    List<Violation> violations = deprecatedViolations.get(bucket.getResource().getEffectiveKey());
    if (violationQuery.getSwitchMode() == ViolationQuery.SwitchMode.BOTH) {
      return violations;
    }

    List<Violation> filteredViolations = Lists.newArrayList();
    for (Violation violation : violations) {
      if (isFiltered(violation, violationQuery.getSwitchMode())) {
        filteredViolations.add(violation);
      }
    }
    return filteredViolations;
  }
Exemple #2
0
 public Collection<Dependency> getIncomingEdges(Resource to) {
   Map<Resource, Dependency> deps = incomingDependenciesByResource.get(to);
   if (deps != null) {
     return deps.values();
   }
   return Collections.emptyList();
 }
Exemple #3
0
 public Collection<Dependency> getOutgoingEdges(Resource from) {
   Map<Resource, Dependency> deps = outgoingDependenciesByResource.get(from);
   if (deps != null) {
     return deps.values();
   }
   return Collections.emptyList();
 }