Represents the root of a website. A "website" in this context is a product, ie the customer facing side of some activity, such as a learning management system or a business website. Resources within a WebsiteRootFolder will often behave differently than if they were located under an OrganisationRootFolder, because the assumption is that websites are for customers, while administrators access the organisation directly. While WebsiteRootFolder is a view of a repository, or rather a branch within a repository, it also provides access to other repositories. Any repository within the containing organisation can be accessed by name from the root folder. For example, if an org has a repository called "maven" as well as the "milton.io" website, requests to http://milton.io/maven will show the maven repository.
Group: Resources
Extends: BranchFolder
Implements: WebsiteBranchResource, RootFolder, CommonCollectionResource, GetableResource, PropFindableResource, WebsiteResource, RepositoryResource
Properties
| Property | Returns | Description |
|---|---|---|
| adminDomainName | String | The admin domain name for the organisation that owns this website, with the dev-mode port appended when running against a loopbackdns.com domain. |
| allGroupFolders | List<GroupFolder> | All group folders defined by the organisation that owns this website. A group folder organises related groups together, eg a set of teams or regions. |
| allGroups | List<Group> | All groups defined by the organisation that owns this website. |
| attributes | Map<String,Object> | A general purpose, request scoped map of attributes attached to this root folder, created empty on first access. |
| comments | List<CommentBean> | The comments posted against this website resource. |
| domainName | String | The domain name this website branch is served on, eg the custom domain for the live branch or a generated subdomain for a draft branch. |
| emailAddress | String | The default "from" address used for automated emails sent by this website, built as "noreply@" followed by the website's domain name. |
| externalUrl | String | The fully qualified base URL of this website, with no path appended. |
| id | String | A unique identifier for this website root folder, combining the website's name and the branch's name. |
| languages | List<Language> | The languages available for translated content on this platform instance. |
| modifiedDate | Date | When this website branch was last modified, taken from the head commit's date, or from the branch's own created date if it has no commits yet. |
| name | String | Always empty. A website root folder has no name of its own, since it is the root of the URL space for its domain. |
| newComment | String | Always null. This getter exists only so that newComment is recognised as a bean property, pairing with setNewComment which does the actual work of posting a comment. |
| numComments | int | The number of comments posted against this website resource. |
| orgData | OrgData | The OrgData for the organisation that owns this website. This can be used to get a list of members within the organisation. |
| orgTypes | List<OrgType> | All organisation types defined by the organisation holding this website, computed once and cached for the lifetime of this instance. |
| readonly | boolean | True if the underlying branch is read only, eg a published archive branch that content can no longer be committed to. |
| requiresHttps | boolean | True if this website branch is configured to force https. |
| settings | WebsiteSettings | The website settings, eg theme name and other configuration, stored for this website branch's data session. |
| themeName | String | The name of the theme currently applied to this website branch. |
| usersFolder | UsersFolder | The folder of user profile resources for this website, created on first access and cached for the lifetime of this instance. |
| versioned | boolean | True if this website was resolved on a versioned host address, eg a draft version accessed via the "_host" request parameter or cookie rather than the branch's normal domain. |
| website | Website | The underlying Website entity this root folder is a branch of. |
| websiteName | String | The path-safe, unique name of the underlying Website entity, as opposed to its display title. |
Inherited from RootFolder
Properties
| Property | Returns | Description |
|---|---|---|
| selectedLangCode | String | The language code currently selected for the request, as determined by TranslationService. |
| selectedLanguage | Language | The Language matching the currently selected language code, looked up from getLanguages. |
Methods
findEntity(Profile user) · getSelectedLangCode() · getSelectedLanguage() · childOrg(long id) · childOrg(String orgId) · findOrgType(String name) · addOrgType(String orgId, String orgType) · createOrgType(String name, String title) · removeOrgType(String orgId, String orgType) · findWebsite(long id) · findWebsite(String name)
findEntity(Profile user)
Returns: PrincipalResource
Locates the resource representing the given profile - a user, group or organisation - within this folder.
| Parameter | Description |
|---|---|
user | the profile to find a resource for |
getSelectedLangCode()
Returns: String
The language code currently selected for the request, as determined by TranslationService.
getSelectedLanguage()
Returns: Language
The Language matching the currently selected language code, looked up from getLanguages.
childOrg(long id)
Returns: Organisation
Locates a descendant organisation of this root folder's organisation by its internal Kademi id.
| Parameter | Description |
|---|---|
id | the internal id of the organisation to find |
childOrg(String orgId)
Returns: Organisation
Locates a descendant organisation of this root folder's organisation by its external org id.
| Parameter | Description |
|---|---|
orgId | the external org id of the organisation to find |
findOrgType(String name)
Returns: OrgType
Finds an org type with the given name, searching this root folder's organisation and then its ancestors.
| Parameter | Description |
|---|---|
name | the name of the org type to find |
addOrgType(String orgId, String orgType)
Returns: void
Adds an existing org type to the organisation identified by orgId, a child of this root folder's organisation, and fires an indexed-item-updated event for it.
| Parameter | Description |
|---|---|
orgId | the external org id of the organisation to update |
orgType | the name of the org type to add |
createOrgType(String name, String title)
Returns: OrgType
Creates and persists a new org type on this root folder's organisation, and fires an indexed-item-updated event for it.
| Parameter | Description |
|---|---|
name | the name of the org type to create |
title | the display name for the new org type |
removeOrgType(String orgId, String orgType)
Returns: void
Removes an org type from the organisation identified by orgId, a child of this root folder's organisation, and fires an indexed-item-updated event for it.
| Parameter | Description |
|---|---|
orgId | the external org id of the organisation to update |
orgType | the name of the org type to remove |
findWebsite(long id)
Returns: Website
Finds a website of this root folder's organisation by its internal id.
| Parameter | Description |
|---|---|
id | the internal id of the website to find |
findWebsite(String name)
Returns: Website
Finds a website of this root folder's organisation by its name.
| Parameter | Description |
|---|---|
name | the name of the website to find |
Methods
getUsersFolder() · getName() · getWebsiteName() · getId() · getDomainName() · getModifiedDate() · getWebsite() · getAttributes() · getEmailAddress() · is(String type) · getThemeName() · isReadonly() · getComments() · getNumComments() · setNewComment(String s) · getNewComment() · getExternalUrl() · externalUrl(String path) · group(String name) · isVersioned() · getLoginToken(UserResource user) · getLoginToken(ProfileBean profileBean) · getLoginToken(Profile p) · getOrgData() · getOrgTypes() · getAdminDomainName() · getAllGroups() · getAllGroupFolders() · getLanguages() · getSettings() · returnWithCurrent(Function<RootFolder,Object> c) · doWithCurrent(Consumer<RootFolder> c) · isRequiresHttps()
getUsersFolder()
Returns: UsersFolder
The folder of user profile resources for this website, created on first access and cached for the lifetime of this instance.
getName()
Returns: String
Always empty. A website root folder has no name of its own, since it is the root of the URL space for its domain.
getWebsiteName()
Returns: String
The path-safe, unique name of the underlying Website entity, as opposed to its display title.
getId()
Returns: String
A unique identifier for this website root folder, combining the website's name and the branch's name.
getDomainName()
Returns: String
The domain name this website branch is served on, eg the custom domain for the live branch or a generated subdomain for a draft branch.
getModifiedDate()
Returns: Date
When this website branch was last modified, taken from the head commit's date, or from the branch's own created date if it has no commits yet.
getWebsite()
Returns: Website
The underlying Website entity this root folder is a branch of.
getAttributes()
Returns: Map<String,Object>
A general purpose, request scoped map of attributes attached to this root folder, created empty on first access.
getEmailAddress()
Returns: String
The default "from" address used for automated emails sent by this website, built as "noreply@" followed by the website's domain name.
is(String type)
Returns: boolean
True if type is "website", or if the superclass recognises type as one of its own resource types. Used throughout templates and roles to test what kind of resource is being looked at without an instanceof check.
| Parameter | Description |
|---|---|
type | the resource type name to test for |
getThemeName()
Returns: String
The name of the theme currently applied to this website branch.
isReadonly()
Returns: boolean
True if the underlying branch is read only, eg a published archive branch that content can no longer be committed to.
getComments()
Returns: List<CommentBean>
The comments posted against this website resource.
getNumComments()
Returns: int
The number of comments posted against this website resource.
setNewComment(String s)
Returns: void
Post a new comment against this resource, from the currently logged in user. Exists as a write-only bean property, paired with getNewComment, so a form can post a comment by setting this field.
| Parameter | Description |
|---|---|
s | the comment text to post |
getNewComment()
Returns: String
Always null. This getter exists only so that newComment is recognised as a bean property, pairing with setNewComment which does the actual work of posting a comment.
getExternalUrl()
Returns: String
The fully qualified base URL of this website, with no path appended.
externalUrl(String path)
Returns: String
Build a fully qualified URL for an (optional) path to this website. If path is already a fully qualified http or https URL it is returned unchanged.
| Parameter | Description |
|---|---|
path | an absolute or relative path to append, or an already fully qualified URL, may be null |
group(String name)
Returns: Group
Look up a group of the organisation that owns this website, by name.
| Parameter | Description |
|---|---|
name | the group's name |
isVersioned()
Returns: boolean
True if this website was resolved on a versioned host address, eg a draft version accessed via the "_host" request parameter or cookie rather than the branch's normal domain.
getLoginToken(UserResource user)
Returns: String
As getLoginToken(Profile), for the profile behind the given user resource.
| Parameter | Description |
|---|---|
user | the user resource to build a login token for |
getLoginToken(ProfileBean profileBean)
Returns: String
As getLoginToken(Profile), for the profile wrapped by the given profile bean.
| Parameter | Description |
|---|---|
profileBean | the profile bean to build a login token for |
getLoginToken(Profile p)
Returns: String
Build the signed cookie query string parameters that log the given profile in when appended to a URL on this website, eg for SSO links from emails or other websites.
| Parameter | Description |
|---|---|
p | the profile to build a login token for, must not be null |
getOrgData()
Returns: OrgData
The OrgData for the organisation that owns this website. This can be used to get a list of members within the organisation.
getOrgTypes()
Returns: List<OrgType>
All organisation types defined by the organisation holding this website, computed once and cached for the lifetime of this instance.
getAdminDomainName()
Returns: String
The admin domain name for the organisation that owns this website, with the dev-mode port appended when running against a loopbackdns.com domain.
getAllGroups()
Returns: List<Group>
All groups defined by the organisation that owns this website.
getAllGroupFolders()
Returns: List<GroupFolder>
All group folders defined by the organisation that owns this website. A group folder organises related groups together, eg a set of teams or regions.
getLanguages()
Returns: List<Language>
The languages available for translated content on this platform instance.
getSettings()
Returns: WebsiteSettings
The website settings, eg theme name and other configuration, stored for this website branch's data session.
returnWithCurrent(Function<RootFolder,Object> c)
Returns: Object
Run the given function with this website root folder set as the current root folder, and return its result. Fails if this website's organisation is not the current tenant organisation.
| Parameter | Description |
|---|---|
c | - the function to run |
doWithCurrent(Consumer<RootFolder> c)
Returns: void
Run the given task with this website root folder set as the current root folder. Fails if this website's organisation is not the current tenant organisation.
| Parameter | Description |
|---|---|
c | - the task to run inside this websiterootfolder context |
isRequiresHttps()
Returns: boolean
True if this website branch is configured to force https.