# WebsiteRootFolder 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. Package: `io.milton.cloud.server.apps.website` Group: Resources Extends: `BranchFolder` Implements: `WebsiteBranchResource`, [RootFolder](RootFolder.md), `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](GroupFolder.md)> | 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](Group.md)> | All groups defined by the organisation that owns this website. | | `attributes` | `Map` | A general purpose, request scoped map of attributes attached to this root folder, created empty on first access. | | `comments` | List<[CommentBean](CommentBean.md)> | 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](Language.md)> | 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](OrgData.md) | 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](OrgType.md)> | 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](WebsiteSettings.md) | 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](Website.md) | 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. | ## Methods ### `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](Website.md) The underlying Website entity this root folder is a branch of. ### `getAttributes()` Returns: `Map` 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](CommentBean.md)> 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](Group.md) 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](OrgData.md) 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](OrgType.md)> 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](Group.md)> All groups defined by the organisation that owns this website. ### `getAllGroupFolders()` Returns: List<[GroupFolder](GroupFolder.md)> 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](Language.md)> The languages available for translated content on this platform instance. ### `getSettings()` Returns: [WebsiteSettings](WebsiteSettings.md) The website settings, eg theme name and other configuration, stored for this website branch's data session. ### `returnWithCurrent(Function 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 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. ## Inherited from RootFolder ### Properties | Property | Returns | Description | |---|---|---| | `selectedLangCode` | `String` | The language code currently selected for the request, as determined by TranslationService. | | `selectedLanguage` | [Language](Language.md) | The Language matching the currently selected language code, looked up from getLanguages. | ### Methods #### `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](Language.md) The Language matching the currently selected language code, looked up from getLanguages. #### `childOrg(long id)` Returns: [Organisation](Organisation.md) 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](Organisation.md) 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](OrgType.md) 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](OrgType.md) 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](Website.md) 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](Website.md) Finds a website of this root folder's organisation by its name. | Parameter | Description | |---|---| | `name` | the name of the website to find |