Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
46 changes: 46 additions & 0 deletions cypher/Java/JakartaEE_REST_Annotations.cypher
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
// Jakarta Enterprise Edition JAX-RS REST Annotations
//
// --- Method Http Annotation ---
MATCH (method:Method)-[:ANNOTATED_BY]->(httpMethodLink:Annotation)-[:OF_TYPE]->(httpMethodAnnotation:Type)
WHERE ((httpMethodAnnotation.fqn STARTS WITH 'jakarta.ws.rs.'
OR httpMethodAnnotation.fqn STARTS WITH 'javax.ws.rs.')
AND httpMethodAnnotation.name IN ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'])
// --- Method Path Annotation ---
OPTIONAL MATCH (method)-[:ANNOTATED_BY]->(pathMethodLink:Annotation)-[:OF_TYPE]->(pathMethodAnnotation:Type)
WHERE pathMethodAnnotation.fqn in ['jakarta.ws.rs.Path', 'javax.ws.rs.Path']
OPTIONAL MATCH (pathMethodLink)-[:HAS]->(pathMethodValue:Value{name: 'value'})
// --- Method Parameter Annotation ---
OPTIONAL MATCH (method)-[:HAS]->(methodParam:Parameter)-[:ANNOTATED_BY]->(methodParamLink:Annotation)-[:OF_TYPE]->(methodParamAnnotation:Type)
WHERE ((methodParamAnnotation.fqn STARTS WITH 'jakarta.ws.rs.'
OR methodParamAnnotation.fqn STARTS WITH 'javax.ws.rs.')
AND methodParamAnnotation.name ENDS WITH 'Param'
AND methodParamAnnotation.name <> 'PathParam')
OPTIONAL MATCH (methodParamLink)-[:HAS]->(methodParamValue:Value{name: 'value'})
// --- Type Path Annotation ---
OPTIONAL MATCH (method)<-[:DECLARES]-(pathType:Type)
OPTIONAL MATCH (pathType)-[:ANNOTATED_BY]->(pathTypeLink:Annotation)-[:OF_TYPE]->(pathTypeAnnotation:Type)
WHERE pathTypeAnnotation.fqn in ['jakarta.ws.rs.Path', 'javax.ws.rs.Path']
OPTIONAL MATCH (pathTypeLink)-[:HAS]->(pathTypeValue:Value{name: 'value'})
// --- SubType Path Annotation ---
OPTIONAL MATCH (pathType:Type)<-[:EXTENDS*1..3]-(subPathType:Type)-[:ANNOTATED_BY]->(subPathTypeLink:Annotation)-[:OF_TYPE]->(subPathTypeAnnotation:Type)
WHERE subPathTypeAnnotation.fqn in ['jakarta.ws.rs.Path', 'javax.ws.rs.Path']
OPTIONAL MATCH (subPathTypeLink)-[:HAS]->(subPathTypeValue:Value{name: 'value'})
// --- Application Path Annotation ---
OPTIONAL MATCH (artifact:Artifact)-[:CONTAINS]->(pathType)
OPTIONAL MATCH (artifact)-[:CONTAINS]->(applicationPathType:Type)-[:ANNOTATED_BY]->(applicationPathLink:Annotation)-[:OF_TYPE]->(applicationPathAnnotation:Type)
WHERE applicationPathAnnotation.fqn in ['jakarta.ws.rs.ApplicationPath', 'javax.ws.rs.ApplicationPath']
OPTIONAL MATCH (applicationPathLink)-[:HAS]->(applicationPathValue:Value{name: 'value'})
// --- Return Results ---
RETURN replace(
coalesce(applicationPathValue.value, '') + '/' +
coalesce(subPathTypeValue.value, pathTypeValue.value, '') + '/' +
coalesce(pathMethodValue.value, '')
, '//', '/') AS path
,httpMethodAnnotation.name AS httpMethod
,replace(last(split(artifact.fileName, '/')), '.jar', '') AS resourceArtifact
,coalesce(subPathType.fqn, pathType.fqn) AS resourceType
,method.name AS resourceMethod
,collect(methodParamAnnotation.name + ': ' +
methodParamValue.value
) AS methodParameters
ORDER BY path, httpMethod, resourceType, resourceMethod
40 changes: 40 additions & 0 deletions cypher/Java/JakartaEE_REST_Annotations_Nodes.cypher
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
// Jakarta Enterprise Edition JAX-RS REST Annotations Nodes
//
// --- Method Http Annotation ---
MATCH (method:Method)-[:ANNOTATED_BY]->(httpMethodLink:Annotation)-[:OF_TYPE]->(httpMethodAnnotation:Type)
WHERE ((httpMethodAnnotation.fqn STARTS WITH 'jakarta.ws.rs.'
OR httpMethodAnnotation.fqn STARTS WITH 'javax.ws.rs.')
AND httpMethodAnnotation.name IN ['GET', 'POST', 'PUT', 'DELETE', 'PATCH', 'HEAD', 'OPTIONS'])
// --- Method Path Annotation ---
OPTIONAL MATCH (method)-[:ANNOTATED_BY]->(pathMethodLink:Annotation)-[:OF_TYPE]->(pathMethodAnnotation:Type)
WHERE pathMethodAnnotation.fqn in ['jakarta.ws.rs.Path', 'javax.ws.rs.Path']
OPTIONAL MATCH (pathMethodLink)-[:HAS]->(pathMethodValue:Value{name: 'value'})
// --- Method Parameter Annotation ---
OPTIONAL MATCH (method)-[:HAS]->(methodParam:Parameter)-[:ANNOTATED_BY]->(methodParamLink:Annotation)-[:OF_TYPE]->(methodParamAnnotation:Type)
WHERE ((methodParamAnnotation.fqn STARTS WITH 'jakarta.ws.rs.'
OR methodParamAnnotation.fqn STARTS WITH 'javax.ws.rs.')
AND methodParamAnnotation.name ENDS WITH 'Param'
AND methodParamAnnotation.name <> 'PathParam')
OPTIONAL MATCH (methodParamLink)-[:HAS]->(methodParamValue:Value{name: 'value'})
// --- Type Path Annotation ---
OPTIONAL MATCH (method)<-[:DECLARES]-(pathType:Type)
OPTIONAL MATCH (pathType)-[:ANNOTATED_BY]->(pathTypeLink:Annotation)-[:OF_TYPE]->(pathTypeAnnotation:Type)
WHERE pathTypeAnnotation.fqn in ['jakarta.ws.rs.Path', 'javax.ws.rs.Path']
OPTIONAL MATCH (pathTypeLink)-[:HAS]->(pathTypeValue:Value{name: 'value'})
// --- SubType Path Annotation ---
OPTIONAL MATCH (pathType:Type)<-[:EXTENDS*1..3]-(subPathType:Type)-[:ANNOTATED_BY]->(subPathTypeLink:Annotation)-[:OF_TYPE]->(subPathTypeAnnotation:Type)
WHERE subPathTypeAnnotation.fqn in ['jakarta.ws.rs.Path', 'javax.ws.rs.Path']
OPTIONAL MATCH (subPathTypeLink)-[:HAS]->(subPathTypeValue:Value{name: 'value'})
// --- Application Path Annotation ---
OPTIONAL MATCH (artifact:Artifact)-[:CONTAINS]->(pathType)
OPTIONAL MATCH (artifact)-[:CONTAINS]->(applicationPathType:Type)-[:ANNOTATED_BY]->(applicationPathLink:Annotation)-[:OF_TYPE]->(applicationPathAnnotation:Type)
WHERE applicationPathAnnotation.fqn in ['jakarta.ws.rs.ApplicationPath', 'javax.ws.rs.ApplicationPath']
OPTIONAL MATCH (applicationPathLink)-[:HAS]->(applicationPathValue:Value{name: 'value'})
// --- Return Results ---
RETURN method
,httpMethodLink, httpMethodAnnotation
,methodParam, methodParamLink, methodParamAnnotation, methodParamValue
,pathMethodLink, pathMethodAnnotation, pathMethodValue
,pathType, pathTypeLink, pathTypeAnnotation, pathTypeValue
,subPathType, subPathTypeLink, subPathTypeAnnotation, subPathTypeValue
,artifact, applicationPathType, applicationPathLink, applicationPathAnnotation, applicationPathValue
56 changes: 56 additions & 0 deletions cypher/Java/Spring_Web_Request_Annotations.cypher
Original file line number Diff line number Diff line change
@@ -0,0 +1,56 @@
// Spring Web Request Annotations
//
// --- Method HTTP Annotation ---
MATCH (method:Method)-[:ANNOTATED_BY]->(httpMethodLink:Annotation)-[:OF_TYPE]->(httpMethodAnnotation:Type)
WHERE httpMethodAnnotation.fqn STARTS WITH 'org.springframework.web.bind.annotation.'
AND httpMethodAnnotation.name IN ['RequestMapping', 'GetMapping', 'PostMapping', 'PutMapping', 'DeleteMapping', 'PatchMapping']
// --- Method HTTP Annotation Path Value ---
OPTIONAL MATCH (httpMethodLink)-[:HAS]->(httpPathAnnotationProperty:Value)-[:CONTAINS]->(httpPathAnnotationValue:Value)
WHERE httpPathAnnotationProperty.name IN ['value', 'path']
// --- Method HTTP Annotation Path Value ---
OPTIONAL MATCH (httpMethodLink)-[:HAS]->(httpMethodAnnotationProperty:Value)-[:CONTAINS]->(httpMethodAnnotationValue:Value)
WHERE httpMethodAnnotationProperty.name = 'method'
// --- Method HTTP Annotation Other Values ---
OPTIONAL MATCH (httpMethodLink)-[:HAS]->(httpAnnotationAdditionalProperty:Value)-[:CONTAINS]->(httpAnnotationAdditionalValue:Value)
WHERE NOT httpAnnotationAdditionalProperty.name IN ['value', 'path', 'method']
// --- Method Parameter Annotation ---
OPTIONAL MATCH (method)-[:HAS]->(methodParam:Parameter)-[:ANNOTATED_BY]->(methodParamLink:Annotation)-[:OF_TYPE]->(methodParamAnnotation:Type)
WHERE methodParamAnnotation.fqn STARTS WITH 'org.springframework.web.bind.annotation.'
OPTIONAL MATCH (methodParamLink)-[:HAS]->(methodParamAnnotationValue:Value)
// --- Type Path Annotation ---
OPTIONAL MATCH (method)<-[:DECLARES]-(resourceType:Type)
OPTIONAL MATCH (resourceType)-[:ANNOTATED_BY]->(pathTypeLink:Annotation)-[:OF_TYPE]->(pathTypeAnnotation:Type)
WHERE pathTypeAnnotation.fqn = 'org.springframework.web.bind.annotation.RequestMapping'
OPTIONAL MATCH (pathTypeLink)-[:HAS]->(pathTypeAnnotationProperty:Value)-[:CONTAINS]->(pathTypeAnnotationValue:Value)
WHERE pathTypeAnnotationProperty.name IN ['value', 'path']
// --- SubType Path Annotation ---
OPTIONAL MATCH (resourceType:Type)<-[:EXTENDS*1..5]-(subResourceType:Type)-[:ANNOTATED_BY]->(subResourceTypeLink:Annotation)-[:OF_TYPE]->(subResourceTypeAnnotation:Type)
WHERE subResourceTypeAnnotation.fqn = 'org.springframework.web.bind.annotation.RequestMapping'
OPTIONAL MATCH (subResourceTypeLink)-[:HAS]->(subResourceTypeAnnotationProperty:Value)-[:CONTAINS]->(subResourceTypeAnnotationValue:Value)
WHERE subResourceTypeAnnotationProperty.name IN ['value', 'path']
// --- Artifact ---
OPTIONAL MATCH (artifact:Artifact)-[:CONTAINS]->(resourceType)
// --- Return Results ---
RETURN replace(
coalesce(subResourceTypeAnnotationValue.value, pathTypeAnnotationValue.value, '') +
'/' +
coalesce(httpPathAnnotationValue.value, '')
, '//', '/') AS path
,coalesce(
httpMethodAnnotationValue.value,
toUpper(
replace(replace(httpMethodAnnotation.name, 'Mapping', ''), 'Request', 'All')
)
) AS httpMethod
,replace(last(split(artifact.fileName, '/')), '.jar', '') AS resourceArtifact
,coalesce(subResourceType.fqn, resourceType.fqn) AS resourceType
,method.name AS resourceMethod
,collect(
httpAnnotationAdditionalProperty.name + ': ' +
httpAnnotationAdditionalValue.value
) AS additionalHttpProperties
,collect(methodParamAnnotation.name +
replace('.' + methodParamAnnotationValue.name, '.value', '') +
': ' +
methodParamAnnotationValue.value) AS methodParameters
ORDER BY path, httpMethod, resourceType, resourceType
3 changes: 3 additions & 0 deletions scripts/reports/JavaCsv.sh
Original file line number Diff line number Diff line change
Expand Up @@ -46,4 +46,7 @@ execute_cypher "${JAVA_CYPHER_DIR}/Java_deprecated_element_usage_detailed.cypher
execute_cypher "${JAVA_CYPHER_DIR}/Annotated_code_elements.cypher" > "${FULL_REPORT_DIRECTORY}/AnnotatedCodeElements.csv"
execute_cypher "${JAVA_CYPHER_DIR}/Annotated_code_elements_per_artifact.cypher" > "${FULL_REPORT_DIRECTORY}/AnnotatedCodeElementsPerArtifact.csv"

execute_cypher "${JAVA_CYPHER_DIR}/JakartaEE_REST_Annotations.cypher" > "${FULL_REPORT_DIRECTORY}/JakartaEE_REST_Annotations.csv"
execute_cypher "${JAVA_CYPHER_DIR}/Spring_Web_Request_Annotations.cypher" > "${FULL_REPORT_DIRECTORY}/Spring_Web_Request_Annotations.csv"

echo "JavaCsv: $(date +'%Y-%m-%dT%H:%M:%S%z') Successfully finished"
2 changes: 1 addition & 1 deletion scripts/reports/compilations/JupyterReports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
# It only consideres scripts in the "reports" directory (overridable with REPORTS_SCRIPT_DIR) one directory above this one.
# These require phython, conda (e.g. miniconda) as well as several packages.
# For PDF generation chromium is required additionally.
# Therefore these reports will take longer and require more ressources than just plain database queries/procedures.
# Therefore these reports will take longer and require more resources than just plain database queries/procedures.

# Requires reports/*.sh

Expand Down
2 changes: 1 addition & 1 deletion scripts/reports/compilations/VisualizationReports.sh
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
# Runs all Visualization reports.
# It only consideres scripts in the "reports" directory (overridable with REPORTS_SCRIPT_DIR) one directory above this one.
# These require node.js.
# Therefore these reports will take longer and require more ressources than just plain database queries/procedures.
# Therefore these reports will take longer and require more resources than just plain database queries/procedures.

# Requires reports/*.sh
# Needs to run after reports/TopologySortCsv.sh that provides the property "topologicalSortIndex" to be queried.
Expand Down