package org.jboss.windup.config.graphsearch;

import org.jboss.windup.graph.model.WindupVertexFrame;

import com.thinkaurelius.titan.core.attribute.Text;
import com.tinkerpop.frames.FramedGraphQuery;
import com.tinkerpop.frames.modules.typedgraph.TypeValue;

class GraphSearchCriterionType implements GraphSearchCriterion
{
    private String typeValue;

    public GraphSearchCriterionType(Class<? extends WindupVertexFrame> clazz)
    {
        TypeValue typeValueAnnotation = clazz.getAnnotation(TypeValue.class);
        if (typeValueAnnotation == null)
        {
            throw new IllegalArgumentException("Class " + clazz.getCanonicalName() + " lacks a @TypeValue annotation");
        }
        else
        {
            this.typeValue = typeValueAnnotation.value();
        }
    }

    @Override
    public void query(FramedGraphQuery q)
    {
        q.has("type", Text.CONTAINS, typeValue);
    }
}
@@ -147,16 +147,56 @@
 e.Text;%0A
+import com.tinkerpop.blueprints.Vertex;%0A
 import c
@@ -290,16 +290,109 @@
 peValue;
+%0Aimport com.tinkerpop.gremlin.java.GremlinPipeline;%0Aimport com.tinkerpop.pipes.util.Pipeline;
 %0A%0Aclass 
@@ -557,32 +557,298 @@
 e%3E clazz)%0A    %7B%0A
+        this.typeValue = getTypeValue( clazz );%0A    %7D%0A    %0A    @Override%0A    public void query(FramedGraphQuery q)%0A    %7B%0A        q.has(%22type%22, Text.CONTAINS, typeValue);%0A    %7D%0A    %0A    private static String getTypeValue( Class%3C? extends WindupVertexFrame%3E clazz ) %7B%0A
         TypeValu
@@ -1125,32 +1125,22 @@
         
-this.typeValue =
+return
  typeVal
@@ -1186,64 +1186,274 @@
     
-@Override%0A    public void query(FramedGraphQuery q)%0A    
+/**%0A     *  Adds a criterion to given pipeline which filters out vertices representing given WindupVertexFrame.%0A     */%0A    public static GremlinPipeline%3CVertex, Vertex%3E addPipeFor( GremlinPipeline%3CVertex, Vertex%3E pipeline, Class%3C? extends WindupVertexFrame%3E clazz )
 %7B%0A  
@@ -1450,33 +1450,40 @@
 lazz )%7B%0A        
-q
+pipeline
 .has(%22type%22, Tex
@@ -1490,31 +1490,34 @@
 t.CONTAINS, 
-t
+getT
 ypeValue
 );%0A    %7D%0A%7D
@@ -1498,26 +1498,60 @@
 NS, getTypeValue
-)
+( clazz ));%0A        return pipeline
 ;%0A    %7D%0A%7D

Add addPipeFor()