contentbox.model.comments

Class CommentService

railo-context.Component
        extended by coldbox.system.orm.hibernate.BaseORMService
            extended by coldbox.system.orm.hibernate.VirtualEntityService
                extended by contentbox.model.comments.CommentService
Class Attributes:
  • singleton
  •  
  • synchronized : false
  •  
  • accessors : false
  •  
  • persistent : false
  •  

    ContentBox - A Modular Content Platform Copyright 2012 by Luis Majano and Ortus Solutions, Corp www.ortussolutions.com Apache License, Version 2.0 Copyright Since [2012] [Luis Majano and Ortus Solutions,Corp] Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at http://www.apache.org/licenses/LICENSE-2.0 Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License. Service to handle comment operations.

    Property Summary
    type property default serializable required
    any CBHelper


    • inject = id:CBHelper@cb
    true false
    any interceptorService


    • inject = coldbox:interceptorService
    true false
    any log


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


    • inject = coldbox:plugin:MailService
    true false
    any renderer


    • inject = provider:ColdBoxRenderer
    true false
    any settingService


    • inject = id:settingService@cb
    true false
    Constructor Summary
    init()
          Constructor.
    Method Summary
    private any activateURLs(any text)
         Activate URL's from text.
    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.
    void deleteUnApprovedComments([numeric expirationDays='0'])
         Deletes unapproved comments.
    any findApprovedComments([any contentID], [any contentType], [any max='0'], [any offset='0'], [any sortOrder='desc'])
         Comment listing for UI of approved comments, returns struct of results=[comments,count].
    numeric getApprovedCommentCount()
         Get the total number of approved comments in the system.
    numeric getUnApprovedCommentCount()
         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)
         Save a comment according to our rules and process it.
    struct search([any search=''], [any isApproved], [any contentID], [any max='0'], [any offset='0'])
         comment search returns struct with keys [comments,count].
    private void sendNotificationEmails(any comment, any settings)
         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 coldbox.system.orm.hibernate.VirtualEntityService
    clear, convertIDValueToJavaType, convertValueToJavaType, count, countWhere, criteriaCount, criteriaQuery, deleteAll, deleteByID, deleteByQuery, deleteWhere, evict, executeQuery, exists, findAllWhere, findWhere, get, getAll, getDatasource, getEntityName, getKey, getPropertyNames, getSessionStatistics, getTableName, isSessionDirty, list, new, newCriteria, onMissingMethod, setDatasource, setEntityName
     
    Methods inherited from class coldbox.system.orm.hibernate.BaseORMService
    $delete, $deleteAll, $deleteByID, $deleteByQuery, $deleteWhere, $save, $saveAll, $transactioned, compileHQLFromDynamicMethod, createCriteriaQuery, createService, delete, evictEntity, evictQueries, findAll, findByExample, findDynamically, findIt, getDefaultAsQuery, getEntityGivenName, getEventHandling, getHQLDynamicCache, getORM, getORMEventHandler, getQueryCacheRegion, getRestrictions, getUseQueryCaching, getUseTransactions, merge, populate, populateFromJSON, populateFromQuery, populateFromXML, populateWithPrefix, refresh, save, saveAll, sessionContains, setDefaultAsQuery, setEventHandling, setHQLDynamicCache, setORM, setORMEventHandler, setQueryCacheRegion, setUseQueryCaching, setUseTransactions
     
    Methods inherited from class railo-context.Component
    None

    Constructor Detail

    init

    public init()

    Constructor


    Property Detail

    CBHelper

    property any CBHelper

    Attributes:
    required - false
    inject - id:CBHelper@cb
    serializable - true

    interceptorService

    property any interceptorService

    Attributes:
    required - false
    inject - coldbox:interceptorService
    serializable - true

    log

    property any log

    Attributes:
    required - false
    inject - logbox:logger:{this}
    serializable - true

    mailService

    property any mailService

    Attributes:
    required - false
    inject - coldbox:plugin:MailService
    serializable - true

    renderer

    property any renderer

    Attributes:
    required - false
    inject - provider:ColdBoxRenderer
    serializable - true

    settingService

    property any settingService

    Attributes:
    required - false
    inject - id:settingService@cb
    serializable - true

    Method Detail

    activateURLs

    private any activateURLs(any text)

    Activate URL's from text

    Parameters:
    text

    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'

    deleteUnApprovedComments

    public void deleteUnApprovedComments([numeric expirationDays='0'])

    Deletes unapproved comments

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

    findApprovedComments

    public any findApprovedComments([any contentID], [any contentType], [any max='0'], [any offset='0'], [any sortOrder='desc'])

    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

    getApprovedCommentCount

    public numeric getApprovedCommentCount()

    Get the total number of approved comments in the system


    getUnApprovedCommentCount

    public numeric getUnApprovedCommentCount()

    Get the total number of unapproved comments in the system


    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)

    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

    search

    public struct search([any search=''], [any isApproved], [any contentID], [any max='0'], [any offset='0'])

    comment search returns struct with keys [comments,count]

    Parameters:
    search
    isApproved
    contentID
    max
    offset

    sendNotificationEmails

    private void sendNotificationEmails(any comment, any settings)

    Send a notification email for comments

    Parameters:
    comment - Comment to moderate check
    settings - The contentbox 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.