CustomLinksHelper

@Service
open class CustomLinksHelper : LinksBaseHelper<T>

The CustomLinksHelper class is useful to manage all the CustomRefyLink database operations

Author

N7ghtm4r3 - Tecknobit

See also

Constructors

Link copied to clipboard
constructor()

Properties

Link copied to clipboard
private val ATTACH_FIELDS_TO_CUSTOM_LINK_QUERY: String = "REPLACE INTO fields(id,field_value,field_key) VALUES "
ATTACH_FIELDS_TO_CUSTOM_LINK_QUERY the query used to attach the fields to the link
Link copied to clipboard
private val ATTACH_RESOURCES_TO_CUSTOM_LINK_QUERY: String = "REPLACE INTO resources(id,resource_value,resource_key) VALUES "
ATTACH_RESOURCES_TO_CUSTOM_LINK_QUERY the query used to attach the resources to the link
Link copied to clipboard
private val COMMA: String = ","
COMMA comma character
Link copied to clipboard
@Autowired
private open var customLinksRepository: CustomLinksRepository
customLinksRepository instance for the custom links repository
Link copied to clipboard
private val DETACH_FIELDS_FROM_CUSTOM_LINK_QUERY: String = "DELETE FROM fields WHERE id='%s' AND field_key IN ("
DETACH_FIELDS_FROM_CUSTOM_LINK_QUERY the query used to detach the fields from the link
Link copied to clipboard
private val DETACH_RESOURCES_FROM_CUSTOM_LINK_QUERY: String = "DELETE FROM resources WHERE id='%s' AND resource_key IN ("
DETACH_RESOURCES_FROM_CUSTOM_LINK_QUERY the query used to detach the resources from the link
Link copied to clipboard
protected open var entityManager: EntityManager
entityManager entity manager helper
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 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
protected val TUPLE_VALUES_SLICE: String = "(?, ?, ?)"
TUPLE_VALUES_SLICE query part to insert in the join table new row

Functions

Link copied to clipboard
private open fun attachMap(linkId: String, attachQuery: String, map: Map<String, Any>)
Method to attach a map value to the link
Link copied to clipboard
open fun createCustomLink(userId: String, linkId: String, title: String, description: String, hasUniqueAccess: Boolean, expiredTime: CustomRefyLink.ExpiredTime, resources: Map<String, Any>, fields: Map<String, Any>)
Method to execute the query to save a link
Link copied to clipboard
open fun deleteLink(linkId: String)
Method to delete a link
Link copied to clipboard
open fun editCustomLink(userId: String, linkId: String, title: String, description: String, hasUniqueAccess: Boolean, expiredTime: CustomRefyLink.ExpiredTime, resources: Map<String, Any>, fields: Map<String, Any>)
Method to execute the query to save a link
Link copied to clipboard
private open fun editMap(linkId: String, attachQuery: String, detachQuery: String, currentMap: Map<String, String>, map: Map<String, Any>)
Method to edit a map attached to the link
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 findById(linkId: String): CustomRefyLink
Method to find a custom link by its identifier
Link copied to clipboard
open fun getItemIfAllowed(userId: String, linkId: String): CustomRefyLink
Method used to get an item if the user is authorized
Link copied to clipboard
Method to get all the user's custom links
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