@Override
 public AccessContext getContext(Collection<AccessContext> contexts, IAccessContextId contextId)
     throws OseeCoreException {
   Conditions.checkNotNull(contexts, "accessContext collection");
   Conditions.checkNotNull(contextId, "accessContextId");
   AccessContext toReturn = null;
   for (AccessContext accessContext : contexts) {
     if (contextId.getGuid().equals(Strings.unquote(accessContext.getGuid()))) {
       toReturn = accessContext;
     }
   }
   return toReturn;
 }
  private void collectApplicable(
      AccessDetailCollector collector, AccessContext context, ArtifactProxy artifactData)
      throws OseeCoreException {
    Scope scope = getScope(context);
    processContext(collector, context, artifactData, scope);

    for (AccessContext superContext : context.getSuperAccessContexts()) {
      collectApplicable(collector, superContext, artifactData);
    }
  }
  private void processContext(
      AccessDetailCollector collector,
      AccessContext context,
      ArtifactProxy artifactData,
      Scope scope)
      throws OseeCoreException {
    collectRestrictions(collector, artifactData, context.getAccessRules(), scope);

    Collection<HierarchyRestriction> restrictions = context.getHierarchyRestrictions();
    Collection<ArtifactProxy> proxyHierarchy = artifactData.getHierarchy();

    for (HierarchyRestriction hierarchy : restrictions) {
      XArtifactMatcher artifactRef = hierarchy.getArtifactMatcherRef();
      if (matcher.matches(artifactRef, proxyHierarchy)) {
        String tag = String.format("childOf-%s", artifactRef.getName());
        Scope child = scope.clone().addSubPath(tag);
        collectRestrictions(collector, artifactData, hierarchy.getAccessRules(), child);
      }
    }
  }
 private void scopeHelper(Scope scope, AccessContext context) {
   for (AccessContext parent : context.getSuperAccessContexts()) {
     scopeHelper(scope, parent);
   }
   scope.add(context.getName());
 }