ContentBox Core API 1.6.0

contentbox.model.content
Class ContentService

WEB-INF.cftags.component
        extended by coldbox.system.orm.hibernate.BaseORMService
            extended by coldbox.system.orm.hibernate.VirtualEntityService
                extended by contentbox.model.content.ContentService
Direct Known Subclasses:
ContentStoreService , EntryService , PageService

public class ContentService
extends coldbox.system.orm.hibernate.VirtualEntityService

******************************************************************************* ContentBox - A Modular Content Platform Copyright 2012 by Luis Majano and Ortus Solutions, Corp www.gocontentbox.org | www.luismajano.com | 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. ******************************************************************************* A generic content service for content objects

Property Summary
Type Property & Description Default Serializable Required
 any authorService


Attributes:
  • inject = authorService@cb
true false
 any cacheBox


Attributes:
  • inject = cachebox
true false
 any categoryService


Attributes:
  • inject = categoryService@cb
true false
 any commentService


Attributes:
  • inject = commentService@cb
true false
 any contentVersionService


Attributes:
  • inject = contentVersionService@cb
true false
 any customFieldService


Attributes:
  • inject = customFieldService@cb
true false
 any log


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


Attributes:
  • inject = wirebox:populator
true false
 any settingService


Attributes:
  • inject = id:settingService@cb
true false
 any systemUtil


Attributes:
  • inject = SystemUtil@cb
true false
 
Constructor Summary
init([any entityName='cbContent'])
          Constructor
 
Method Summary
 any bulkPublishStatus(any contentID, any status)
          Bulk Publish Status Updates
 any clearAllCaches([boolean async='false'])
          Clear all content caches
 any clearAllPageWrapperCaches([boolean async='false'])
          Clear all page wrapper caches
 any clearPageWrapper(any slug, [boolean async='false'])
          Clear a page wrapper cache
 any clearPageWrapperCaches(any slug, [boolean async='false'])
          Clear all page wrapper caches
 ContentService deleteContent(any content)
          Delete a content object safely via hierarchies
 any findBySlug(any slug, boolean showUnpublished='false')
          Find a published content object by slug and published unpublished flags, if not found it returns a new content object
 any findPublishedContent([numeric max='0'], [numeric offset='0'], [any searchTerm=''], [any category=''], [boolean asQuery='false'], [any parent], [boolean showInMenu])
          Find published content objects
 array getAllFlatSlugs()
          Returns an array of slugs of all the content objects in the system
 array getAllForExport([any inData])
          Get all content for export as flat data
 any getIDBySlug(any slug)
          Get an id from a slug of a content object
 array getTopCommentedContent([numeric max='5'])
          Get the top commented content entries
 array getTopVisitedContent([numeric max='5'])
          Get the top visited content entries
 string importFromData(any importData, [boolean override='false'], any importLog)
          Import data from an array of structures of content or just one structure of a content entry
 string importFromFile(any importFile, [boolean override='false'])
          Import data from a ContentBox JSON file
private any inflateFromStruct(any contentData, any importLog, [any parent])
          Inflate a content object from a ContentBox JSON structure
 any isSlugUnique(any slug, [any contentID=''])
          Verify an incoming slug is unique or not
 any searchContent([any searchTerm=''], [numeric max='0'], [numeric offset='0'], [boolean asQuery='false'], [any sortOrder='publishedDate DESC'], [any isPublished='true'], [boolean searchActiveContent='true'])
          Searches published content with cool paramters, remember published content only
private any syncUpdateHits(any contentID)
          Update the content hits
 ContentService updateHits(any contentID, [boolean async='true'])
          Update a content's hits with some async flava
 
Methods inherited from class coldbox.system.orm.hibernate.VirtualEntityService
GETDATASOURCE, GETENTITYNAME, SETDATASOURCE, SETENTITYNAME, clear, convertIDValueToJavaType, convertValueToJavaType, count, countWhere, criteriaCount, criteriaQuery, deleteAll, deleteByID, deleteByQuery, deleteWhere, evict, executeQuery, exists, findAllWhere, findWhere, get, getAll, getKey, getPropertyNames, getSessionStatistics, getTableName, isSessionDirty, list, new, newCriteria, onMissingMethod
 
Methods inherited from class coldbox.system.orm.hibernate.BaseORMService
$delete, $deleteAll, $deleteByID, $deleteByQuery, $deleteWhere, $save, $saveAll, $transactioned, GETDEFAULTASQUERY, GETEVENTHANDLING, GETHQLDYNAMICCACHE, GETORM, GETORMEVENTHANDLER, GETQUERYCACHEREGION, GETUSEQUERYCACHING, GETUSETRANSACTIONS, SETDEFAULTASQUERY, SETEVENTHANDLING, SETHQLDYNAMICCACHE, SETORM, SETORMEVENTHANDLER, SETQUERYCACHEREGION, SETUSEQUERYCACHING, SETUSETRANSACTIONS, compileHQLFromDynamicMethod, createCriteriaQuery, createService, delete, evictEntity, evictQueries, findAll, findByExample, findDynamically, findIt, getEntityGivenName, getRestrictions, merge, populate, populateFromJSON, populateFromQuery, populateFromXML, populateWithPrefix, refresh, save, saveAll, sessionContains
 
Methods inherited from class WEB-INF.cftags.component
None
 

Constructor Detail

init

public init([any entityName='cbContent'])
Constructor

Parameters:
entityName - The content entity name to bind this service to.
Property Detail

authorService

any authorService

Attributes:
inject - authorService@cb
required - false
serializable - true
default -

cacheBox

any cacheBox

Attributes:
inject - cachebox
required - false
serializable - true
default -

categoryService

any categoryService

Attributes:
inject - categoryService@cb
required - false
serializable - true
default -

commentService

any commentService

Attributes:
inject - commentService@cb
required - false
serializable - true
default -

contentVersionService

any contentVersionService

Attributes:
inject - contentVersionService@cb
required - false
serializable - true
default -

customFieldService

any customFieldService

Attributes:
inject - customFieldService@cb
required - false
serializable - true
default -

log

any log

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

populator

any populator

Attributes:
inject - wirebox:populator
required - false
serializable - true
default -

settingService

any settingService

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

systemUtil

any systemUtil

Attributes:
inject - SystemUtil@cb
required - false
serializable - true
default -

Method Detail

bulkPublishStatus

public any bulkPublishStatus(any contentID, any status)
Bulk Publish Status Updates

Parameters:
contentID - The list or array of ID's to bulk update
status - The status either 'publish' or 'draft

clearAllCaches

public any clearAllCaches([boolean async='false'])
Clear all content caches

Parameters:
async - Run it asynchronously or not, defaults to false

clearAllPageWrapperCaches

public any clearAllPageWrapperCaches([boolean async='false'])
Clear all page wrapper caches

Parameters:
async - Run it asynchronously or not, defaults to false

clearPageWrapper

public any clearPageWrapper(any slug, [boolean async='false'])
Clear a page wrapper cache

Parameters:
slug - The slug to clean
async - Run it asynchronously or not, defaults to false

clearPageWrapperCaches

public any clearPageWrapperCaches(any slug, [boolean async='false'])
Clear all page wrapper caches

Parameters:
slug - The slug partial to clean on
async - Run it asynchronously or not, defaults to false

deleteContent

public ContentService deleteContent(any content)
Delete a content object safely via hierarchies

Parameters:
content - the Content object to delete

findBySlug

public any findBySlug(any slug, boolean showUnpublished='false')
Find a published content object by slug and published unpublished flags, if not found it returns a new content object

Parameters:
slug - The slug to search
showUnpublished - To also show unpublished content, defaults to false.

findPublishedContent

public any findPublishedContent([numeric max='0'], [numeric offset='0'], [any searchTerm=''], [any category=''], [boolean asQuery='false'], [any parent], [boolean showInMenu])
Find published content objects

Parameters:
max - The maximum number of records to paginate
offset - The offset in the pagination
searchTerm - The search term to search
category - The category to filter the content on
asQuery - Return as query or array of objects, defaults to array of objects
parent - The parent ID to filter on or not
showInMenu - Whether to filter with the show in menu bit or not

getAllFlatSlugs

public array getAllFlatSlugs()
Returns an array of slugs of all the content objects in the system.


getAllForExport

public array getAllForExport([any inData])
Get all content for export as flat data

Parameters:
inData - The data to use for exporting, usually concrete implementtions can override this.

getIDBySlug

public any getIDBySlug(any slug)
Get an id from a slug of a content object

Parameters:
slug - The slug to search an ID for.

getTopCommentedContent

public array getTopCommentedContent([numeric max='5'])
Get the top commented content entries

Parameters:
max - The maximum to retrieve, defaults to 5 entries

getTopVisitedContent

public array getTopVisitedContent([numeric max='5'])
Get the top visited content entries

Parameters:
max - The maximum to retrieve, defaults to 5 entries

importFromData

public string importFromData(any importData, [boolean override='false'], any importLog)
Import data from an array of structures of content or just one structure of a content entry

Parameters:
importData - The data to import
override - Override records or not
importLog - The import log buffer

importFromFile

public string importFromFile(any importFile, [boolean override='false'])
Import data from a ContentBox JSON file. Returns the import log

Parameters:
importFile - The absolute file path to use for importing
override - Override records or not

inflateFromStruct

private any inflateFromStruct(any contentData, any importLog, [any parent])
Inflate a content object from a ContentBox JSON structure

Parameters:
contentData - The content structure inflated from JSON
importLog - The string builder import log
parent - If the inflated content object has a parent then it can be linked directly, no inflating necessary. Usually for recursions

isSlugUnique

public any isSlugUnique(any slug, [any contentID=''])
Verify an incoming slug is unique or not

Parameters:
slug - The slug to search for uniqueness
contentID - Limit the search to the passed contentID usually for updates

searchContent

public any searchContent([any searchTerm=''], [numeric max='0'], [numeric offset='0'], [boolean asQuery='false'], [any sortOrder='publishedDate DESC'], [any isPublished='true'], [boolean searchActiveContent='true'])
Searches published content with cool paramters, remember published content only

Parameters:
searchTerm - The search term to search
max - The maximum number of records to paginate
offset - The offset in the pagination
asQuery - Return as query or array of objects, defaults to array of objects
sortOrder - The sorting of the search results, defaults to publishedDate DESC
isPublished - Search for published, non-published or both content objects [true, false, 'all']
searchActiveContent - Search only content titles or both title and active content. Defaults to both.

syncUpdateHits

private any syncUpdateHits(any contentID)
Update the content hits

Parameters:
contentID - The content id to update

updateHits

public ContentService updateHits(any contentID, [boolean async='true'])
Update a content's hits with some async flava

Parameters:
contentID - The content id to update
async - Async or not

ContentBox Core API 1.6.0