package org.jboss.windup.rules.apps.javaee.model;

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

import com.tinkerpop.blueprints.Direction;
import com.tinkerpop.frames.Adjacency;
import com.tinkerpop.frames.Property;
import com.tinkerpop.frames.modules.typedgraph.TypeValue;

/**
 * Contains metadata associated with a JPA Named Query.
 * 
 * @author <a href="mailto:bradsdavis@gmail.com">Brad Davis</a>
 * 
 */
@TypeValue(JPANamedQueryModel.TYPE)
public interface JPANamedQueryModel extends WindupVertexFrame
{
    String QUERY_NAME = "queryName";
    String QUERY = "query";
    String TYPE = "JPANamedQueryModel";


    /**
     * Contains the query name
     */
    @Property(QUERY_NAME)
    String getQueryName();

    /**
     * Contains the query name
     */
    @Property(QUERY_NAME)
    void setQueryName(String queryName);

    
    /**
     * Contains the query
     */
    @Property(QUERY)
    String getQuery();

    /**
     * Contains the query
     */
    @Property(QUERY)
    void setQuery(String query);

    /**
     * Contains the jpa entity model
     */
    @Adjacency(label = JPAEntityModel.NAMED_QUERY, direction = Direction.IN)
    void setJpaEntity(JPAEntityModel jpaEntity);

    /**
     * Contains the jpa entity model
     */
    @Adjacency(label = JPAEntityModel.NAMED_QUERY, direction = Direction.IN)
    JPAEntityModel getJpaEntity();
}

@@ -44,16 +44,288 @@
 model;%0A%0A
+import com.tinkerpop.blueprints.Vertex;%0Aimport com.tinkerpop.frames.modules.javahandler.JavaHandler;%0Aimport com.tinkerpop.frames.modules.javahandler.JavaHandlerContext;%0Aimport org.jboss.windup.graph.model.HasApplications;%0Aimport org.jboss.windup.graph.model.ProjectModel;%0A
 import o
@@ -371,16 +371,16 @@
 xFrame;%0A
-
 %0Aimport 
@@ -784,16 +784,33 @@
 texFrame
+, HasApplications
 %0A%7B%0A    S
@@ -1622,24 +1622,24 @@
 rection.IN)%0A
-
     JPAEntit
@@ -1660,11 +1660,567 @@
 ntity();
+%0A%0A    @JavaHandler%0A    @Override%0A    Iterable%3CProjectModel%3E getApplications();%0A%0A    @JavaHandler%0A    @Override%0A    boolean belongsToProject(ProjectModel projectModel);%0A%0A%0A    abstract class Impl implements JPANamedQueryModel, JavaHandlerContext%3CVertex%3E%0A    %7B%0A        public Iterable%3CProjectModel%3E getApplications()%0A        %7B%0A            return this.getJpaEntity().getApplications();%0A        %7D%0A%0A        public boolean belongsToProject(ProjectModel projectModel)%0A        %7B%0A            return this.getJpaEntity().belongsToProject(projectModel);%0A        %7D%0A    %7D
 %0A%7D%0A

Implement HasApplications in JPANamedQueryModel