code: 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));
          };
      }
docs: 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.
  
  @param controllerId
  the target to verify if the given artifact is currently
  assigned or had been assigned
  @param sha1Hash
  of the local artifact to check wherever the target had ever
  been assigned
  @return a specification to use with spring JPA