contentbox.models.comments

Class CommentService

lucee.Component
    extended by cborm.models.BaseORMService
      extended by cborm.models.VirtualEntityService
        extended by contentbox.models.comments.CommentService

ContentBox - A Modular Content Platform Copyright since 2012 by Ortus Solutions, Corp www.ortussolutions.com/products/contentbox --- Service to handle comment operations.

Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  
    Property Summary
    type property default serializable required
    any CBHelper


    • access = public
    • returntype = any
    • inject = id:CBHelper@contentbox
    true false
    any interceptorService


    • access = public
    • returntype = any
    • inject = coldbox:interceptorService
    true false
    any log


    • access = public
    • returntype = any
    • inject = logbox:logger:{this}
    true false
    any mailService


    • access = public
    • returntype = any
    • inject = mailService@cbmailservices
    true false
    any renderer


    • access = public
    • returntype = any
    • inject = coldbox:renderer
    true false
    any securityService


    • access = public
    • returntype = any
    • inject = id:securityService@contentbox
    true false
    any settingService


    • access = public
    • returntype = any
    • inject = id:settingService@contentbox
    true false
    Constructor Summary
    init()
          Constructor.
    Method Summary
    private boolean anyKeywordMatch([any comment], [any matchList])
         Regex matching of a list of entries against a comment and matching keyword list.
    any bulkStatus([any commentID], [any status=''])
         Bulk Updates.
    CommentService deleteUnApproved([numeric expirationDays='0'])
         Deletes unapproved comments.
    struct findAllApproved([any contentID], [any contentType], [any max='0'], [any offset='0'], [string sortOrder='desc'], [string siteID=''])
         Comment listing for UI of approved comments, returns struct of results=[comments,count].
    numeric getApprovedCount([string siteID=''])
         Get the total number of approved comments in the system.
    numeric getTotalCount([string siteID=''])
         Get the total comment counts in the system.
    numeric getTotalCountByContent([string contentId=''], [boolean isApproved])
         Get the total comment counts by content object.
    numeric getUnApprovedCount([string siteID=''])
         Get the total number of unapproved comments in the system.
    private boolean runModerationRules(any comment, any settings)
         Run moderation rules on an incoming comment and set of contentbox settings.
    struct saveComment(any comment, any loggedInUser)
         Save a comment according to our rules and process it.
    struct search([any search=''], [any isApproved], [any contentID], [numeric max='0'], [numeric offset='0'], [any sortOrder='createdDate DESC'], [string siteID=''])
         comment search returns struct with keys [comments,count].
    private void sendNotificationEmails(any comment, any siteSettings)
         Send a notification email for comments.
    void sendSubscriptionNotifications(any comment)
         Sends subscription emails to subscribers of the content.
    private boolean userHasPreviousAcceptedComment(any email)
         Check if the user has already a comment in the system.
     
    Methods inherited from class cborm.models.VirtualEntityService
    autoCast, convertIdValueToJavaType, convertValueToJavaType, count, countWhere, deleteAll, deleteByID, deleteByQuery, deleteWhere, evictCollection, executeQuery, exists, findAllWhere, findWhere, get, getAll, getEntityName, getKey, getOrFail, getPropertyNames, getTableName, idCast, list, new, newCriteria, onMissingMethod, setEntityName
     
    Methods inherited from class cborm.models.BaseORMService
    $transactioned, buildJavaProxy, clear, createService, delete, evict, evictQueries, findAll, findByExample, findIt, findOrFail, getBeanPopulator, getDatasource, getDefaultAsQuery, getDirtyPropertyNames, getDynamicProcessor, getEntityGivenName, getEntityMetadata, getEventHandling, getKeyValue, getLogger, getORMEventHandler, getObjectPopulator, getOrm, getPropertyValues, getQueryCacheRegion, getRestrictions, getSessionStatistics, getStringBuilder, getUseQueryCaching, getUseTransactions, getWirebox, isDirty, isSessionDirty, merge, nullValue, populate, populateFromJson, populateFromQuery, populateFromXml, populateWithPrefix, refresh, save, saveAll, sessionContains, setDatasource, setDefaultAsQuery, setEventHandling, setLogger, setORM, setORMEventHandler, setQueryCacheRegion, setUseQueryCaching, setUseTransactions, setWirebox, when
     
    Methods inherited from class lucee.Component
    None

    Constructor Detail

    init

    public init()

    Constructor


    Property Detail

    CBHelper

    property any CBHelper

    Attributes:
    access - public
    required - false
    returntype - any
    inject - id:CBHelper@contentbox
    serializable - true

    interceptorService

    property any interceptorService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - coldbox:interceptorService
    serializable - true

    log

    property any log

    Attributes:
    access - public
    required - false
    returntype - any
    inject - logbox:logger:{this}
    serializable - true

    mailService

    property any mailService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - mailService@cbmailservices
    serializable - true

    renderer

    property any renderer

    Attributes:
    access - public
    required - false
    returntype - any
    inject - coldbox:renderer
    serializable - true

    securityService

    property any securityService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - id:securityService@contentbox
    serializable - true

    settingService

    property any settingService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - id:settingService@contentbox
    serializable - true

    Method Detail

    anyKeywordMatch

    private boolean anyKeywordMatch([any comment], [any matchList])

    Regex matching of a list of entries against a comment and matching keyword list

    Parameters:
    comment
    matchList

    bulkStatus

    public any bulkStatus([any commentID], [any status=''])

    Bulk Updates

    Parameters:
    commentID - The list or array of ID's to bulk update
    status - The status either 'approve' or 'moderate'
    Returns:
    CommentService

    deleteUnApproved

    public CommentService deleteUnApproved([numeric expirationDays='0'])

    Deletes unapproved comments

    Parameters:
    expirationDays - Required level of staleness in days to delete (0=all unapproved)

    findAllApproved

    public struct findAllApproved([any contentID], [any contentType], [any max='0'], [any offset='0'], [string sortOrder='desc'], [string siteID=''])

    Comment listing for UI of approved comments, returns struct of results=[comments,count]

    Parameters:
    contentID - The content ID to filter on
    contentType - The content type discriminator to filter on
    max - The maximum number of records to return, 0 means all
    offset - The offset in the paging, 0 means 0
    sortOrder - Sort the comments asc or desc, by default it is desc
    siteID - The site to filter on if needed
    Returns:
    struct with { comments, count }

    getApprovedCount

    public numeric getApprovedCount([string siteID=''])

    Get the total number of approved comments in the system

    Parameters:
    siteID - The site to filter on

    getTotalCount

    public numeric getTotalCount([string siteID=''])

    Get the total comment counts in the system

    Parameters:
    siteID - The site to filter on

    getTotalCountByContent

    public numeric getTotalCountByContent([string contentId=''], [boolean isApproved])

    Get the total comment counts by content object

    Parameters:
    contentId - The content id to filter on
    isApproved - If passed, use it to filter on

    getUnApprovedCount

    public numeric getUnApprovedCount([string siteID=''])

    Get the total number of unapproved comments in the system

    Parameters:
    siteID - The site to filter on

    runModerationRules

    private boolean runModerationRules(any comment, any settings)

    Run moderation rules on an incoming comment and set of contentbox settings. If this method returns a false then the comment is moderated and can continue to be saved. If returns false, then it is blocked and must NOT be saved.

    Parameters:
    comment - Comment to moderate check
    settings - The contentbox settings to moderate against

    saveComment

    public struct saveComment(any comment, any loggedInUser)

    Save a comment according to our rules and process it. Returns a structure of information results = [moderated:boolean,messages:array]

    Parameters:
    comment - The comment to try to save
    loggedInUser - The current logged in user making the comment. If no logged in User, this is a non-persisted entity

    search

    public struct search([any search=''], [any isApproved], [any contentID], [numeric max='0'], [numeric offset='0'], [any sortOrder='createdDate DESC'], [string siteID=''])

    comment search returns struct with keys [comments,count]

    Parameters:
    search - Search query
    isApproved - approved bit
    contentID - matching content id
    max - max records
    offset - offset for pagination
    sortOrder - The sort order, defaults to `createdDate DESC`
    siteID - The site to filter on if needed
    Returns:
    struct with { comments, count }

    sendNotificationEmails

    private void sendNotificationEmails(any comment, any siteSettings)

    Send a notification email for comments

    Parameters:
    comment - Comment to moderate check
    siteSettings - The contentbox site settings to moderate against

    sendSubscriptionNotifications

    public void sendSubscriptionNotifications(any comment)

    Sends subscription emails to subscribers of the content

    Parameters:
    comment - The comment object

    userHasPreviousAcceptedComment

    private boolean userHasPreviousAcceptedComment(any email)

    Check if the user has already a comment in the system

    Parameters:
    email - The email address to check.