TeamsHelper

The TeamsHelper class is useful to manage all the Team database operations

Author

N7ghtm4r3 - Tecknobit

See also

Constructors

Link copied to clipboard
constructor()

Types

Link copied to clipboard
Record class representing a team payload useful to create or edit a Team

Properties

Link copied to clipboard
private val ADD_MEMBERS_QUERY: String = "INSERT INTO members(owner,team_id,team_role) VALUES "
ADD_MEMBERS_QUERY the query used to add new members to a team
Link copied to clipboard
protected val ATTACH_TEAM_TO_COLLECTIONS_QUERY: String = "REPLACE INTO collections_teams(collection_id,team_id) VALUES "
ATTACH_TEAM_TO_COLLECTIONS_QUERY the query used to attach collections to the team
Link copied to clipboard
protected val ATTACH_TEAM_TO_LINKS_QUERY: String = "REPLACE INTO teams_links(link_id,team_id) VALUES "
ATTACH_TEAM_TO_LINKS_QUERY the query used to attach links to the team
Link copied to clipboard
private val COMMA: String = ","
COMMA comma character
Link copied to clipboard
private val DETACH_TEAM_FROM_COLLECTIONS_QUERY: String = "DELETE FROM collections_teams WHERE team_id='%s' AND collection_id IN ("
DETACH_TEAM_FROM_COLLECTIONS_QUERY the query used to detach collections from a team
Link copied to clipboard
private val DETACH_TEAM_FROM_LINKS_QUERY: String = "DELETE FROM teams_links WHERE team_id='%s' AND link_id IN ("
DETACH_TEAM_FROM_LINKS_QUERY the query used to detach links from a team
Link copied to clipboard
protected open var entityManager: EntityManager
entityManager entity manager helper
Link copied to clipboard
val LOGOS_DIRECTORY: String = "logos"
LOGOS_DIRECTORY the key of the logos folder where the logos of the team will be saved
Link copied to clipboard
val PROFILES_DIRECTORY: String = "profiles"
Link copied to clipboard
protected val RELATIONSHIP_VALUES_SLICE: String = "(?, ?)"
RELATIONSHIP_VALUES_SLICE query part to insert in the join table new row
Link copied to clipboard
private val REMOVE_MEMBERS_FROM_TEAM_QUERY: String = "DELETE FROM members WHERE team_id='%s' AND owner IN ("
REMOVE_MEMBERS_FROM_TEAM_QUERY the query used to remove members from a team
Link copied to clipboard
private val REPLACE_MEMBERS_QUERY: String = "REPLACE INTO members(owner,team_id,team_role) VALUES "
REPLACE_MEMBERS_QUERY the query used to replace member in a team
Link copied to clipboard
val RESOURCES_KEY: String = "resources"
Link copied to clipboard
val RESOURCES_PATH: String = "resources/"
Link copied to clipboard
private val ROUND_BRACKET: String = ")"
ROUND_BRACKET round bracket character
Link copied to clipboard
private val SINGLE_QUOTE: String = "'"
SINGLE_QUOTE single quote character
Link copied to clipboard
@Autowired
private open var teamsRepository: TeamsRepository
teamsRepository instance for the teams repository
Link copied to clipboard
protected val TUPLE_VALUES_SLICE: String = "(?, ?, ?)"
TUPLE_VALUES_SLICE query part to insert in the join table new row

Functions

Link copied to clipboard
open fun changeMemberRole(teamId: String, memberId: String, role: Team.RefyTeamMember.TeamRole)
Method change the role of a team member
Link copied to clipboard
open fun createLogoResource(resource: MultipartFile, resourceId: String): String
Method to create the pathname for a logo picture of a team
Link copied to clipboard
open fun createProfileResource(resource: MultipartFile, resourceId: String): String
Link copied to clipboard
open fun createResource(resource: MultipartFile, resourcesDirectory: String, resourceId: String): String
Link copied to clipboard
open fun createTeam(userId: String, teamId: String, payload: TeamsHelper.TeamPayload)
Method to create a new team
Link copied to clipboard
open fun deleteLogoResource(teamId: String): Boolean
Method to delete a logo picture of a team
Link copied to clipboard
Link copied to clipboard
open fun deleteResource(resourcesDirectory: String, resourceId: String): Boolean
Link copied to clipboard
open fun deleteTeam(teamId: String)
Method to delete a team
Link copied to clipboard
open fun editTeam(userId: String, team: Team, payload: TeamsHelper.TeamPayload)
Method to edit a team
Link copied to clipboard
protected open fun <I> executeDeleteBatch(deleteQuery: String, itemToDeleteId: String, values: List<I>)
Method to execute a batch query to delete attachments
Link copied to clipboard
protected open fun <I> executeInsertBatch(insertQuery: String, valuesSlice: String, values: Collection<I>, batchQuery: RefyItemsHelper.BatchQuery)
Method to execute a batch query to insert attachments
Link copied to clipboard
open fun getAllUserTeams(userId: String): List<Team>
Method to get all the user's teams
Link copied to clipboard
private open fun getBatchQuery(team: Team, members: List<String>): RefyItemsHelper.BatchQuery
Method to get the batch query to manage the team members
Link copied to clipboard
Method to get the workflow to manage the team's attachments
Link copied to clipboard
open fun getItemIfAllowed(userId: String, teamId: String): Team
Method used to get an item if the user is authorized
Link copied to clipboard
open fun getSuffixResource(resource: MultipartFile): String
Link copied to clipboard
open fun getUserOwnedTeams(userId: String): List<Team>
Method to get the user's owned teams
Link copied to clipboard
open fun getUserTeams(userId: String): HashSet<String>
Method to get the user's owned teams identifiers
Link copied to clipboard
protected open fun manageAttachments(workflow: RefyItemsHelper.AttachmentsManagementWorkflow, valuesSlice: String, itemId: String, ids: List<String>, batchQuery: RefyItemsHelper.BatchQuery)
Method to manage the attachments of an item to a container
Link copied to clipboard
open fun manageTeamCollections(teamId: String, collections: List<String>)
Method to manage the collections shared with a team
Link copied to clipboard
open fun manageTeamLinks(teamId: String, links: List<String>)
Method to manage the links attached to a team
Link copied to clipboard
open fun removeMember(teamId: String, memberId: String)
Method to remove a member from a team
Link copied to clipboard
open fun saveResource(resource: MultipartFile, path: String)