ActionSpecifications.java 文件源码

java
阅读 29 收藏 0 点赞 0 评论 0

项目:hawkbit 作者:
/**
 * 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
 */
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));
    };
}
评论列表
文章目录


问题


面经


文章

微信
公众号

扫码关注公众号