contentbox.models.system

Class SiteService

lucee.Component
    extended by cborm.models.BaseORMService
      extended by cborm.models.VirtualEntityService
        extended by contentbox.models.system.SiteService

ContentBox - A Modular Content Platform Copyright since 2012 by Ortus Solutions, Corp www.ortussolutions.com/products/contentbox --- Manage sites in ContentBox

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


    • access = public
    • returntype = any
    • inject = cacheStorage@cbStorages
    true false
    any categoryService


    • access = public
    • returntype = any
    • inject = provider:categoryService@contentbox
    true false
    any contentService


    • access = public
    • returntype = any
    • inject = provider:contentService@contentbox
    true false
    any cookieStorage


    • access = public
    • returntype = any
    • inject = cookieStorage@cbStorages
    true false
    any loadedModules


    • access = public
    • returntype = any
    • inject = coldbox:setting:modules
    true false
    any mediaService


    • access = public
    • returntype = any
    • inject = provider:mediaService@contentbox
    true false
    any menuService


    • access = public
    • returntype = any
    • inject = provider:menuService@contentbox
    true false
    any requestService


    • access = public
    • returntype = any
    • inject = coldbox:requestService
    true false
    any requestStorage


    • access = public
    • returntype = any
    • inject = requestStorage@cbStorages
    true false
    any settingService


    • access = public
    • returntype = any
    • inject = provider:settingService@contentbox
    true false
    any themeService


    • access = public
    • returntype = any
    • inject = provider:themeService@contentbox
    true false
    Constructor Summary
    init()
          Constructor.
    Method Summary
    private any _save(any site)
         Save operation called by the transactional `save()` method.
    SiteService delete(any site)
         Delete an entire site from the system.
    Site discoverSite()
         This method discovers which site you are on and returns it depending on the following markers:.
    boolean ensureSiteMediaFolder(any site)
         This method makes sure the site has a media root folder by convention in the media library.
    array getAllFlat([boolean isActive])
         Get an array/struct representation of all sites in the system.
    any getAllForExport()
         Get all sites for export.
    array getAllSiteThemes()
         Returns a collection of all the themes that are used in all active sites.
    any getBySlugOrFail(any slug)
         Get by slug or fail.
    string getCacheStorage()
    string getCategoryService()
    string getContentService()
    string getCookieStorage()
    Site getCurrentWorkingSite()
         Get the current working site in the admin UI.
    any getCurrentWorkingsiteID()
         Get the current working site in the admin UI.
    Site getDefaultSite()
         Get the default site object.
    string getDefaultsiteID()
         Get the default site Identifier.
    string getLoadedModules()
    string getMediaService()
    string getMenuService()
    any getOrFail(any siteID)
         Get an id or fail.
    string getRequestService()
    string getRequestStorage()
    string getSettingService()
    string getThemeService()
    string importFromData(any importData, [boolean override='false'], any importLog)
         Import data from an array of structures or a single structure of data.
    string importFromFile(any importFile, [boolean override='false'])
         Import data from a ContentBox JSON file.
    any importSite(any site, any memento, any importLog, any override)
         Import a site into ContentBox.
    Site save(any site, [boolean transactional='true'])
         Save a site object in the system.
    any setCacheStorage(any cacheStorage)
    any setCategoryService(any categoryService)
    any setContentService(any contentService)
    any setCookieStorage(any cookieStorage)
    SiteService setCurrentWorkingsiteID(any siteID)
         Store the current working site in the admin UI.
    any setLoadedModules(any loadedModules)
    any setMediaService(any mediaService)
    any setMenuService(any menuService)
    any setRequestService(any requestService)
    any setRequestStorage(any requestStorage)
    any setSettingService(any settingService)
    any setThemeService(any themeService)
     
    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, getPropertyNames, getTableName, idCast, list, new, newCriteria, onMissingMethod, setEntityName
     
    Methods inherited from class cborm.models.BaseORMService
    $transactioned, buildJavaProxy, clear, createService, 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, 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

    cacheStorage

    property any cacheStorage

    Attributes:
    access - public
    required - false
    returntype - any
    inject - cacheStorage@cbStorages
    serializable - true

    categoryService

    property any categoryService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - provider:categoryService@contentbox
    serializable - true

    contentService

    property any contentService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - provider:contentService@contentbox
    serializable - true

    cookieStorage

    property any cookieStorage

    Attributes:
    access - public
    required - false
    returntype - any
    inject - cookieStorage@cbStorages
    serializable - true

    loadedModules

    property any loadedModules

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

    mediaService

    property any mediaService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - provider:mediaService@contentbox
    serializable - true

    menuService

    property any menuService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - provider:menuService@contentbox
    serializable - true

    requestService

    property any requestService

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

    requestStorage

    property any requestStorage

    Attributes:
    access - public
    required - false
    returntype - any
    inject - requestStorage@cbStorages
    serializable - true

    settingService

    property any settingService

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

    themeService

    property any themeService

    Attributes:
    access - public
    required - false
    returntype - any
    inject - provider:themeService@contentbox
    serializable - true

    Method Detail

    _save

    private any _save(any site)

    Save operation called by the transactional `save()` method Due to transactional issues on Lucee

    Parameters:
    site

    delete

    public SiteService delete(any site)

    Delete an entire site from the system

    Overrides:
    delete in class cborm.models.BaseORMService
    Parameters:
    site - The site to remove

    discoverSite

    public Site discoverSite()

    This method discovers which site you are on and returns it depending on the following markers: - Are we in the admin, use the current working site - incoming `siteID` (rc) - incoming `siteSlug` (rc) - incoming header: `x-contentbox-site` - full incoming url

    Returns:
    The site object

    ensureSiteMediaFolder

    public boolean ensureSiteMediaFolder(any site)

    This method makes sure the site has a media root folder by convention in the media library following the patter: /{root}/sites/{slug}

    Parameters:
    site - The site to ensure the media directory for
    Returns:
    True if it created it, false if it already existed.

    getAllFlat

    public array getAllFlat([boolean isActive])

    Get an array/struct representation of all sites in the system

    Parameters:
    isActive - If passed, bind via this boolean flag
    Returns:
    array of { siteID, name, slug, domainRegex, domainAliases, isActive }

    getAllForExport

    public any getAllForExport()

    Get all sites for export


    getAllSiteThemes

    public array getAllSiteThemes()

    Returns a collection of all the themes that are used in all active sites

    Returns:
    array of { activeTheme:string, siteID:numeric }

    getBySlugOrFail

    public any getBySlugOrFail(any slug)

    Get by slug or fail

    Parameters:
    slug - The site slug
    Throws:
    EntityNotFound

    getCacheStorage

    public string getCacheStorage()


    getCategoryService

    public string getCategoryService()


    getContentService

    public string getContentService()


    getCookieStorage

    public string getCookieStorage()


    getCurrentWorkingSite

    public Site getCurrentWorkingSite()

    Get the current working site in the admin UI. We look in the cache first, if none is set, we use the `default` site.


    getCurrentWorkingsiteID

    public any getCurrentWorkingsiteID()

    Get the current working site in the admin UI. We look in the cache first, if none is set, we use the `default` site.


    getDefaultSite

    public Site getDefaultSite()

    Get the default site object


    getDefaultsiteID

    public string getDefaultsiteID()

    Get the default site Identifier


    getLoadedModules

    public string getLoadedModules()


    getMediaService

    public string getMediaService()


    getMenuService

    public string getMenuService()


    getOrFail

    public any getOrFail(any siteID)

    Get an id or fail

    Overrides:
    getOrFail in class cborm.models.VirtualEntityService
    Parameters:
    siteID
    Throws:
    EntityNotFound

    getRequestService

    public string getRequestService()


    getRequestStorage

    public string getRequestStorage()


    getSettingService

    public string getSettingService()


    getThemeService

    public string getThemeService()


    importFromData

    public string importFromData(any importData, [boolean override='false'], any importLog)

    Import data from an array of structures or a single structure of data

    Parameters:
    importData - A struct or array of data to import
    override - Override content if found in the database, defaults to false
    importLog - The import log buffer
    Returns:
    The console log of the import

    importFromFile

    public string importFromFile(any importFile, [boolean override='false'])

    Import data from a ContentBox JSON file. Returns the import log

    Parameters:
    importFile - The json file to import
    override - Override content if found in the database, defaults to false
    Returns:
    The console log of the import
    Throws:
    InvalidImportFormat

    importSite

    public any importSite(any site, any memento, any importLog, any override)

    Import a site into ContentBox.

    Parameters:
    site - The site object that will be used to import
    memento - The site memento that we will import
    importLog - The string buffer that represents the import log
    override - Override content if found in the database, defaults to false

    save

    public Site save(any site, [boolean transactional='true'])

    Save a site object in the system. If the site is a new site, we make sure all proper settings are created and configured.

    Overrides:
    save in class cborm.models.BaseORMService
    Parameters:
    site - A persisted or new site object
    transactional - Transaction the call or leave as is, useful for imports, bulk saves, etc.

    setCacheStorage

    public any setCacheStorage(any cacheStorage)

    Parameters:
    cacheStorage

    setCategoryService

    public any setCategoryService(any categoryService)

    Parameters:
    categoryService

    setContentService

    public any setContentService(any contentService)

    Parameters:
    contentService

    setCookieStorage

    public any setCookieStorage(any cookieStorage)

    Parameters:
    cookieStorage

    setCurrentWorkingsiteID

    public SiteService setCurrentWorkingsiteID(any siteID)

    Store the current working site in the admin UI

    Parameters:
    siteID - The site to store as the current working one

    setLoadedModules

    public any setLoadedModules(any loadedModules)

    Parameters:
    loadedModules

    setMediaService

    public any setMediaService(any mediaService)

    Parameters:
    mediaService

    setMenuService

    public any setMenuService(any menuService)

    Parameters:
    menuService

    setRequestService

    public any setRequestService(any requestService)

    Parameters:
    requestService

    setRequestStorage

    public any setRequestStorage(any requestStorage)

    Parameters:
    requestStorage

    setSettingService

    public any setSettingService(any settingService)

    Parameters:
    settingService

    setThemeService

    public any setThemeService(any themeService)

    Parameters:
    themeService