public static Specification < JpaAction > hasTargetAssignedArtifact ( final String controllerId , final String sha1Hash ) { return ( actionRoot , query , criteriaBuilder ) -> { final Join < JpaAction , JpaDistributionSet > dsJoin = actionRoot . join ( JpaAction_ . distributionSet ) ; final SetJoin < JpaDistributionSet , JpaSoftwareModule > modulesJoin = dsJoin . join ( JpaDistributionSet_ . modules ) ; final ListJoin < JpaSoftwareModule , JpaArtifact > artifactsJoin = modulesJoin . join ( JpaSoftwareModule_ . artifacts ) ; return criteriaBuilder . and ( criteriaBuilder . equal ( artifactsJoin . get ( JpaArtifact_ . sha1Hash ) , sha1Hash ) , criteriaBuilder . equal ( actionRoot . get ( JpaAction_ . target ) . get ( JpaTarget_ . controllerId ) , controllerId ) ) ; } ; }
Specification which joins all necessary tables to retrieve the dependency between a target and a local file assignment through the assigned action of the target . All actions are included not only active actions .