META-INF.jqassistant-rules.jaxrs-resource.xml Maven / Gradle / Ivy
<jqassistant-rules xmlns="http://schema.jqassistant.org/rule/v1.10"
                   xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
                   xsi:schemaLocation="http://schema.jqassistant.org/rule/v1.10 http://schema.jqassistant.org/rule/jqassistant-rule-v1.10.xsd">
<concept id="jaxrs:RequestMethodDesignator">
		<description>Finds request method designator annotations (i.e. @GET, @POST, @PUT, @DELETE, @HEAD, @OPTIONS) and labels them with 'JaxRS' and 'RequestMethodDesignator'
		</description>
		<cypher><![CDATA[
            MATCH
              (a:Type)
            WHERE
              a.fqn IN ["javax.ws.rs.GET", "javax.ws.rs.POST", "javax.ws.rs.PUT", "javax.ws.rs.DELETE", "javax.ws.rs.HEAD", "javax.ws.rs.OPTIONS"]
            SET
              a:JaxRS:RequestMethodDesignator
            RETURN
              a AS RequestMethodDesignator
        ]]></cypher>
	</concept>
	<concept id="jaxrs:Resource">
		<requiresConcept refId="jaxrs:RequestMethodDesignator" />
		<description>Finds classes or interfaces with atleast one method annotated with "@javax.ws.rs.Path" or with request method designator
		(i.e. @GET, @POST, @PUT, @DELETE, @HEAD, @OPTIONS) and labels them with 'JaxRS' and 'Resource'.
		</description>
		<cypher><![CDATA[
            MATCH
              (t:Type)-[:DECLARES]->(m:Method)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:Type)
            WHERE
              (a:JaxRS:RequestMethodDesignator OR a.fqn="javax.ws.rs.Path")
            AND
              (t:Class OR t:Interface)
            SET
              t:JaxRS:Resource
            RETURN
              DISTINCT t AS RestResource
        ]]></cypher>
	</concept>
	<concept id="jaxrs:SubResourceLocator">
		<requiresConcept refId="jaxrs:RequestMethodDesignator" />
		<description>Finds classes or interfaces with method annotated with "@javax.ws.rs.Path" but no request method designator
		and no entity parameters and labels the methods with 'JaxRS' and 'SubResourceLocator'.
		</description>
		<cypher><![CDATA[
            MATCH
              (t:Type)-[:DECLARES]->(m:Method)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:Type)
            WHERE
              a.fqn = "javax.ws.rs.Path"
            AND
              (t:Class OR t:Interface)
            AND
              NOT (m)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(:JaxRS:RequestMethodDesignator)
            AND
              (m)-[:HAS]->(:Parameter)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(:Type)
            SET
              m:JaxRS:SubResourceLocator
            RETURN
              DISTINCT m AS RestSubResourceLocator
        ]]></cypher>
	</concept>
	<concept id="jaxrs:ResourceMethod">
		<requiresConcept refId="jaxrs:Resource" />
		<description>Finds methods that belong to resource class or interface and annotated with request method designator
		(i.e. @GET, @POST, @PUT, @DELETE, @HEAD, @OPTIONS) and labels them with 'JaxRS' and 'ResourceMethod'.
		</description>
		<cypher><![CDATA[
            MATCH
              (c:JaxRS:Resource)-[:DECLARES]->(m:Method)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:JaxRS:RequestMethodDesignator)
            SET
              m:JaxRS:ResourceMethod
            RETURN
              m AS ResourceMethod
        ]]></cypher>
	</concept>
	<concept id="jaxrs:GetResourceMethod">
		<requiresConcept refId="jaxrs:ResourceMethod" />
		<description>Finds resource methods annotated with "@javax.ws.rs.GET" and labels them with 'GetResourceMethod'. </description>
		<cypher><![CDATA[
            MATCH
              (m:JaxRS:ResourceMethod)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:JaxRS:RequestMethodDesignator)
            WHERE
              a.fqn = "javax.ws.rs.GET"
            SET
              m:GetResourceMethod
            RETURN
              m AS GetMethod
        ]]></cypher>
	</concept>
	<concept id="jaxrs:PutResourceMethod">
		<requiresConcept refId="jaxrs:ResourceMethod" />
		<description>Finds resource methods annotated with "@javax.ws.rs.PUT" and labels them with 'PutResourceMethod'. </description>
		<cypher><![CDATA[
            MATCH
              (m:JaxRS:ResourceMethod)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:JaxRS:RequestMethodDesignator)
            WHERE
              a.fqn = "javax.ws.rs.PUT"
            SET
              m:PutResourceMethod
            RETURN
              m AS PutMethod
        ]]></cypher>
	</concept>
	<concept id="jaxrs:PostResourceMethod">
		<requiresConcept refId="jaxrs:ResourceMethod" />
		<description>Finds resource methods annotated with "@javax.ws.rs.POST" and labels them with 'PostResourceMethod'. </description>
		<cypher><![CDATA[
            MATCH
              (m:JaxRS:ResourceMethod)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:JaxRS:RequestMethodDesignator)
            WHERE
              a.fqn = "javax.ws.rs.POST"
            SET
              m:PostResourceMethod
            RETURN
              m AS PostMethod
        ]]></cypher>
	</concept>
	<concept id="jaxrs:DeleteResourceMethod">
		<requiresConcept refId="jaxrs:ResourceMethod" />
		<description>Finds resource methods annotated with "@javax.ws.rs.DELETE" and labels them with 'DeleteResourceMethod'. </description>
		<cypher><![CDATA[
            MATCH
              (m:JaxRS:ResourceMethod)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:JaxRS:RequestMethodDesignator)
            WHERE
              a.fqn = "javax.ws.rs.DELETE"
            SET
              m:DeleteResourceMethod
            RETURN
              m AS DeleteMethod
        ]]></cypher>
	</concept>
	<concept id="jaxrs:HeadResourceMethod">
		<requiresConcept refId="jaxrs:ResourceMethod" />
		<description>Finds resource methods annotated with "@javax.ws.rs.HEAD" and labels them with 'HeadResourceMethod'. </description>
		<cypher><![CDATA[
            MATCH
              (m:JaxRS:ResourceMethod)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:JaxRS:RequestMethodDesignator)
            WHERE
              a.fqn = "javax.ws.rs.HEAD"
            SET
              m:HeadResourceMethod
            RETURN
              m AS HeadMethod
        ]]></cypher>
	</concept>
	<concept id="jaxrs:OptionsResourceMethod">
		<requiresConcept refId="jaxrs:ResourceMethod" />
		<description>Finds resource methods annotated with "@javax.ws.rs.OPTIONS" and labels them with 'OptionsResourceMethod'. </description>
		<cypher><![CDATA[
            MATCH
              (m:JaxRS:ResourceMethod)-[:ANNOTATED_BY]-()-[:OF_TYPE]->(a:JaxRS:RequestMethodDesignator)
            WHERE
              a.fqn = "javax.ws.rs.OPTIONS"
            SET
              m:OptionsResourceMethod
            RETURN
              m AS OptionsMethod
        ]]></cypher>
	</concept>
</jqassistant-rules>
    © 2015 - 2025 Weber Informatics LLC | Privacy Policy