Repository: incubator-griffin Updated Branches: refs/heads/master 614a48a81 -> e531cb2aa
Fix code style bug in MeasureRepo Author: Eugene <toyboxman0...@163.com> Closes #379 from toyboxman/MeasureRepo. Project: http://git-wip-us.apache.org/repos/asf/incubator-griffin/repo Commit: http://git-wip-us.apache.org/repos/asf/incubator-griffin/commit/e531cb2a Tree: http://git-wip-us.apache.org/repos/asf/incubator-griffin/tree/e531cb2a Diff: http://git-wip-us.apache.org/repos/asf/incubator-griffin/diff/e531cb2a Branch: refs/heads/master Commit: e531cb2aac8e759ec06dca766e098dcd84f7f9b1 Parents: 614a48a Author: Eugene <toyboxman0...@163.com> Authored: Thu Aug 2 07:59:28 2018 +0800 Committer: William Guo <gu...@apache.org> Committed: Thu Aug 2 07:59:28 2018 +0800 ---------------------------------------------------------------------- .../griffin/core/measure/repo/MeasureRepo.java | 55 ++++++++++++++++++-- 1 file changed, 51 insertions(+), 4 deletions(-) ---------------------------------------------------------------------- http://git-wip-us.apache.org/repos/asf/incubator-griffin/blob/e531cb2a/service/src/main/java/org/apache/griffin/core/measure/repo/MeasureRepo.java ---------------------------------------------------------------------- diff --git a/service/src/main/java/org/apache/griffin/core/measure/repo/MeasureRepo.java b/service/src/main/java/org/apache/griffin/core/measure/repo/MeasureRepo.java index a5d3aef..f47ece2 100644 --- a/service/src/main/java/org/apache/griffin/core/measure/repo/MeasureRepo.java +++ b/service/src/main/java/org/apache/griffin/core/measure/repo/MeasureRepo.java @@ -26,20 +26,67 @@ import org.springframework.data.repository.CrudRepository; import java.util.List; -public interface MeasureRepo<T extends Measure> extends CrudRepository<T, Long> { +/** + * Interface to access measure repository + * + * @param <T> Measure and its subclass + */ +public interface MeasureRepo<T extends Measure> + extends CrudRepository<T, Long> { + /** + * search repository by name and deletion state + * + * @param name query condition + * @param deleted query condition + * @return measure collection + */ List<T> findByNameAndDeleted(String name, Boolean deleted); + /** + * search repository by deletion state + * + * @param deleted query condition + * @return measure collection + */ List<T> findByDeleted(Boolean deleted); + /** + * search repository by owner and deletion state + * + * @param owner query condition + * @param deleted query condition + * @return measure collection + */ List<T> findByOwnerAndDeleted(String owner, Boolean deleted); + /** + * search repository by id and deletion state + * + * @param id query condition + * @param deleted query condition + * @return measure collection + */ T findByIdAndDeleted(Long id, Boolean deleted); - @Query("select DISTINCT m.organization from #{#entityName} m where m.deleted = ?1 and m.organization is not null") + /** + * search repository by deletion state + * + * @param deleted query condition + * @return organization collection + */ + @Query("select DISTINCT m.organization from #{#entityName} m " + + "where m.deleted = ?1 and m.organization is not null") List<String> findOrganizations(Boolean deleted); - @Query("select m.name from #{#entityName} m " + - "where m.organization= ?1 and m.deleted= ?2") + /** + * search repository by organization and deletion state + * + * @param organization query condition + * @param deleted query condition + * @return organization collection + */ + @Query("select m.name from #{#entityName} m " + + "where m.organization= ?1 and m.deleted= ?2") List<String> findNameByOrganization(String organization, Boolean deleted); }