2020import java .util .Collection ;
2121import java .util .List ;
2222import java .util .Optional ;
23- import org .springframework .data .jpa .repository .Query ;
24- import org .springframework .data .repository .query .Param ;
2523
2624/**
2725 * @author Pavel Bortnik
@@ -33,20 +31,23 @@ public interface UserFilterRepository extends ReportPortalRepository<UserFilter,
3331 * Finds filter by 'id' and 'project id'
3432 *
3533 * @param id {@link UserFilter#id}
36- * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} whose filter will be extracted
34+ * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} whose filter
35+ * will be extracted
3736 * @return {@link UserFilter} wrapped in the {@link Optional}
3837 */
3938 Optional <UserFilter > findByIdAndProjectId (Long id , Long projectId );
4039
4140 /**
4241 * @param ids {@link Iterable} of the filter Ids
43- * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} whose filters will be extracted
42+ * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} whose
43+ * filters will be extracted
4444 * @return The {@link List} of the {@link UserFilter}
4545 */
4646 List <UserFilter > findAllByIdInAndProjectId (Collection <Long > ids , Long projectId );
4747
4848 /**
49- * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} whose filters will be extracted
49+ * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} whose
50+ * filters will be extracted
5051 * @return The {@link List} of the {@link UserFilter}
5152 */
5253 List <UserFilter > findAllByProjectId (Long projectId );
@@ -56,8 +57,8 @@ public interface UserFilterRepository extends ReportPortalRepository<UserFilter,
5657 *
5758 * @param name {@link UserFilter#name}
5859 * @param owner {@link UserFilter#owner}
59- * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} on which filter existence will
60- * be checked
60+ * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} on which
61+ * filter existence will be checked
6162 * @return if exists 'true' else 'false'
6263 */
6364 boolean existsByNameAndOwnerAndProjectId (String name , String owner , Long projectId );
@@ -66,31 +67,10 @@ public interface UserFilterRepository extends ReportPortalRepository<UserFilter,
6667 * Checks the existence of the {@link UserFilter} with specified name on a project
6768 *
6869 * @param name {@link UserFilter#name}
69- * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} on which filter existence will
70- * be checked
70+ * @param projectId Id of the {@link com.epam.ta.reportportal.entity.project.Project} on which
71+ * filter existence will be checked
7172 * @return if exists 'true' else 'false'
7273 */
7374 boolean existsByNameAndProjectId (String name , Long projectId );
7475
75- /**
76- * Finds locked dashboards that use the specified filter. Returns dashboard names.
77- *
78- * @param filterId The filter ID
79- * @param projectId The project ID to filter dashboards
80- * @return List of dashboard names
81- */
82- @ Query (value = """
83- SELECT d.name
84- FROM dashboard d
85- INNER JOIN owned_entity oe ON d.id = oe.id
86- WHERE oe.locked = true
87- AND oe.project_id = :projectId
88- AND d.id IN (
89- SELECT dw.dashboard_id
90- FROM dashboard_widget dw
91- INNER JOIN widget_filter wf ON dw.widget_id = wf.widget_id
92- WHERE wf.filter_id = :filterId
93- )
94- """ , nativeQuery = true )
95- List <String > findLockedDashboardsByFilterId (@ Param ("filterId" ) Long filterId , @ Param ("projectId" ) Long projectId );
9676}
0 commit comments