使用 jQAssistant 检查所有 public EJB 方法是否都使用 @RolesAllowed 或 @PermitAll 进行注释

Using jQAssistant for checking that all public EJB methods are annotated with @RolesAllowed or @PermitAll

我想写一个 Cypher rule for jQAssistant 来检查是否所有 public EJB 方法都用 @RolesAllowed@PermitAll 注释。

这可能吗?由于我是 Neo4j 的 Cypher 查询语言的新手,我在 Cypher 中制定 "not exists" 条件以查找 "all public methods in EJB classes (= classes that have the @Stateless annotation) that are not annotated with @RolesAllowed or @PermitAll".

时遇到问题

诀窍是将不存在的部分放在 where 子句中,例如

match
  (:Stateless)-[:DECLARES]->(m:Method)
where
  m.visibility ="public"
  and not (
    (m)-[:ANNOTATED_BY]->()-[:OF_TYPE]->(:Type{fqn:"...PermitAll")
    or
    ... 
  )
return
  m

希望这能说明这个想法,在平板电脑上写这些东西是相当困难的。下周我可以给你一个更高级的例子。