Interface WidgetRepository

    • Method Detail

      • findByIdAndProjectId

        java.util.Optional<Widget> findByIdAndProjectId​(java.lang.Long id,
                                                        java.lang.Long projectId)
        Finds widget by 'id' and 'project id'
        Parameters:
        id - ShareableEntity.id
        projectId - Id of the Project whose widget will be extracted
        Returns:
        Widget wrapped in the Optional
      • findAllByProjectId

        java.util.List<Widget> findAllByProjectId​(java.lang.Long projectId)
        Parameters:
        projectId - Id of the Project whose widgets will be extracted
        Returns:
        The List of the Widget
      • existsByNameAndOwnerAndProjectId

        boolean existsByNameAndOwnerAndProjectId​(java.lang.String name,
                                                 java.lang.String owner,
                                                 java.lang.Long projectId)
        Checks the existence of the Widget with specified name for a user on a project
        Parameters:
        name - Widget.name
        owner - ShareableEntity.owner
        projectId - Id of the Project on which widget existence will be checked
        Returns:
        if exists 'true' else 'false'
      • findAllByProjectIdAndWidgetTypeInAndContentFieldsContains

        @Query("SELECT w FROM Widget w WHERE w.project.id = :projectId AND w.widgetType IN :widgetTypes AND :contentField MEMBER w.contentFields")
        java.util.List<Widget> findAllByProjectIdAndWidgetTypeInAndContentFieldsContains​(@Param("projectId")
                                                                                         java.lang.Long projectId,
                                                                                         @Param("widgetTypes")
                                                                                         java.util.List<java.lang.String> widgetTypes,
                                                                                         @Param("contentField")
                                                                                         java.lang.String contentField)
      • findAllByProjectIdAndWidgetTypeInAndContentFieldContaining

        @Query(value="SELECT * FROM widget w JOIN shareable_entity se on w.id = se.id JOIN content_field cf on w.id = cf.id  WHERE se.project_id = :projectId AND w.widget_type IN :widgetTypes AND cf.field LIKE :contentFieldPart || \'%\'",
               nativeQuery=true)
        java.util.List<Widget> findAllByProjectIdAndWidgetTypeInAndContentFieldContaining​(@Param("projectId")
                                                                                          java.lang.Long projectId,
                                                                                          @Param("widgetTypes")
                                                                                          java.util.List<java.lang.String> widgetTypes,
                                                                                          @Param("contentFieldPart")
                                                                                          java.lang.String contentFieldPart)