Projects
Repository
The ProjectsRepository
interface is
useful to manage the queries for the projects
Author
N7ghtm4r3 - Tecknobit
See also
JpaRepository
Functions
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + PROJECTS_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY
+ " AND " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to delete an
existing Project
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE pg FROM " + PROJECTS_GROUPS_TABLE + " pg LEFT JOIN " + PROJECTS_KEY
+ " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + "pg." + PROJECT_IDENTIFIER_KEY + " WHERE "
+ PROJECTS_KEY + "." + AUTHOR_KEY + "=:" + AUTHOR_KEY",
nativeQuery = true
)
Method to execute the query to delete the
current list of projects of an user
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET "
+ NAME_KEY + "=:" + NAME_KEY + ","
+ PROJECT_DESCRIPTION_KEY + "=:" + PROJECT_DESCRIPTION_KEY + ","
+ PROJECT_VERSION_KEY + "=:" + PROJECT_VERSION_KEY + ","
+ PROJECT_REPOSITORY_KEY + "=:" + PROJECT_REPOSITORY_KEY
+ " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND "
+ IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY",
nativeQuery = true
)
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET "
+ NAME_KEY + "=:" + NAME_KEY + ","
+ PROJECT_ICON_KEY + "=:" + PROJECT_ICON_KEY + ","
+ PROJECT_DESCRIPTION_KEY + "=:" + PROJECT_DESCRIPTION_KEY + ","
+ PROJECT_VERSION_KEY + "=:" + PROJECT_VERSION_KEY + ","
+ PROJECT_REPOSITORY_KEY + "=:" + PROJECT_REPOSITORY_KEY
+ " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND "
+ IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to edit an
existing Project
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Query(value = "SELECT * FROM " + PROJECTS_KEY +
" WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY +
" ORDER BY " + CREATION_DATE_KEY + " DESC ",
nativeQuery = true
)
Method to execute the query to select the
list of a Project
authored by the user id
Link copied to clipboard
@Query(value = "SELECT " + PROJECTS_KEY + ".*" + " FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY +
" INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " +
PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY +
" AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" +
" WHERE " + PROJECTS_KEY + "." + AUTHOR_KEY + "=:" + AUTHOR_KEY +
" AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " +
PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " +
PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " +
GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." +
IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY +
" = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY +
" INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " +
PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY +
" AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" +
" WHERE " + GROUP_MEMBERS_TABLE + "." +
IDENTIFIER_KEY + " =:" + AUTHOR_KEY +
" AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = 'JOINED'" +
" AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY +
" AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" ORDER BY " + CREATION_DATE_KEY + " DESC ",
nativeQuery = true
)
Method to execute the query to select the
list of a Project
currently IN_DEVELOPMENT
Link copied to clipboard
@Query(value = "SELECT * FROM " + PROJECTS_KEY + " WHERE "
+ AUTHOR_KEY + "=:" + AUTHOR_KEY +
" AND " + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " +
PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " +
PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " +
GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." +
IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY +
" = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "." +
IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY +
" = 'JOINED' AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY +
" AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" ORDER BY " + CREATION_DATE_KEY + " DESC ",
nativeQuery = true
)
Method to execute the query to select the
list of a Project
Link copied to clipboard
@Query(value = "SELECT " + PROJECTS_KEY + ".*" + " FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY +
" INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " +
PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY +
" AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" +
" WHERE " + PROJECTS_KEY + "." + AUTHOR_KEY + "=:" + AUTHOR_KEY +
" AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " +
PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " +
PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " +
GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." +
IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY +
" = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY +
" INNER JOIN " + UPDATES_KEY + " as " + UPDATE_KEY + " ON " +
PROJECTS_KEY + "." + IDENTIFIER_KEY + "=" + UPDATE_KEY + "." + PROJECT_KEY +
" AND " + UPDATE_KEY + "." + UPDATE_STATUS_KEY + " = 'IN_DEVELOPMENT'" +
" WHERE " + GROUP_MEMBERS_TABLE + "." +
IDENTIFIER_KEY + " =:" + AUTHOR_KEY +
" AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY + " = 'JOINED'" +
" AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY +
" AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" ORDER BY " + CREATION_DATE_KEY + " DESC ",
nativeQuery = true
)
Method to execute the query to select the
list of a Project
currently IN_DEVELOPMENT
Link copied to clipboard
@Query(value = ""SELECT * FROM " + PROJECTS_KEY + " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND "
+ IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY + " UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY
+ " AS " + PROJECTS_KEY + " LEFT JOIN " + PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "."
+ IDENTIFIER_KEY + " =:" + IDENTIFIER_KEY + " LEFT JOIN " + GROUPS_KEY + " ON "
+ PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." + IDENTIFIER_KEY
+ " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY + " = "
+ GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "."
+ IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY
+ " = 'JOINED' AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY",
nativeQuery = true
)
Method to execute the query to select an
existing Project
Link copied to clipboard
@Query(value = ""SELECT * FROM " + PROJECTS_KEY + " WHERE " + IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to select a Project
by its id
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""SELECT " + GROUP_IDENTIFIER_KEY + " FROM " + PROJECTS_GROUPS_TABLE + " WHERE "
+ PROJECT_IDENTIFIER_KEY + "=:" + PROJECT_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to select the
list of a Group's
id of a project
Link copied to clipboard
@Query(value = "SELECT * FROM " + PROJECTS_KEY + " WHERE "
+ AUTHOR_KEY + "=:" + AUTHOR_KEY +
" AND " + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" UNION SELECT " + PROJECTS_KEY + ".* FROM " + PROJECTS_KEY + " AS " + PROJECTS_KEY + " LEFT JOIN " +
PROJECTS_GROUPS_TABLE + " ON " + PROJECTS_KEY + "." + IDENTIFIER_KEY + " = " +
PROJECTS_GROUPS_TABLE + "." + PROJECT_IDENTIFIER_KEY + " LEFT JOIN " +
GROUPS_KEY + " ON " + PROJECTS_GROUPS_TABLE + "." + GROUP_IDENTIFIER_KEY + " = " + GROUPS_KEY + "." +
IDENTIFIER_KEY + " LEFT JOIN " + GROUP_MEMBERS_TABLE + " ON " + GROUPS_KEY + "." + IDENTIFIER_KEY +
" = " + GROUP_MEMBERS_TABLE + "." + GROUP_MEMBER_KEY + " WHERE " + GROUP_MEMBERS_TABLE + "." +
IDENTIFIER_KEY + " =:" + AUTHOR_KEY + " AND " + GROUP_MEMBERS_TABLE + "." + INVITATION_STATUS_KEY +
" = 'JOINED' AND " + GROUPS_KEY + "." + AUTHOR_KEY + " !=:" + AUTHOR_KEY +
" AND " + PROJECTS_KEY + "." + NAME_KEY + " LIKE %:" + NAME_KEY + "%" +
" AND COALESCE(:" + FILTERS_KEY + ") IS NULL" +
" OR " + PROJECTS_KEY + "." + PROJECT_VERSION_KEY + " IN (:" + FILTERS_KEY + ")" +
" ORDER BY " + CREATION_DATE_KEY + " DESC ",
nativeQuery = true
)
Method to execute the query to select the
list of a Project
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = "INSERT INTO " + PROJECTS_KEY
+ "( "
+ AUTHOR_KEY + ","
+ IDENTIFIER_KEY + ","
+ NAME_KEY + ","
+ PROJECT_ICON_KEY + ","
+ CREATION_DATE_KEY + ","
+ PROJECT_DESCRIPTION_KEY + ","
+ PROJECT_VERSION_KEY + ","
+ PROJECT_REPOSITORY_KEY + ") VALUES "
+ "( "
+ ":" + AUTHOR_KEY + ","
+ ":" + IDENTIFIER_KEY + ","
+ ":" + NAME_KEY + ","
+ ":" + PROJECT_ICON_KEY + ","
+ ":" + CREATION_DATE_KEY + ","
+ ":" + PROJECT_DESCRIPTION_KEY + ","
+ ":" + PROJECT_VERSION_KEY + ","
+ ":" + PROJECT_REPOSITORY_KEY + ")",
nativeQuery = true
)
Method to execute the query to add a new Project
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""DELETE FROM " + PROJECTS_GROUPS_TABLE + " WHERE " + PROJECT_IDENTIFIER_KEY + "=:"
+ PROJECT_IDENTIFIER_KEY + " AND " + GROUP_IDENTIFIER_KEY + "=:" + GROUP_IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to remove a
group from a project
Link copied to clipboard
Link copied to clipboard
Link copied to clipboard
@Modifying(clearAutomatically = true
)
@Query(value = ""UPDATE " + PROJECTS_KEY + " SET "
+ PROJECT_VERSION_KEY + "=:" + PROJECT_VERSION_KEY
+ " WHERE " + AUTHOR_KEY + "=:" + AUTHOR_KEY + " AND "
+ IDENTIFIER_KEY + "=:" + IDENTIFIER_KEY",
nativeQuery = true
)
Method to execute the query to update to the
last published update project_version the project_version of
the
Project