A folder in the WebDAV / URL tree of a repository, backed by a directory node in the content-versioned repository snapshot. Lists and creates child files and folders, renders an index.html page (or delegates to a registered folder-view application) when browsed, and exposes title, body and named parameters read from that index page for use in Velocity templates via its "milton" bean properties.
Group: Resources
Extends: AbstractContentResource
Implements: ContentDirectoryResource, PutableResource, GetableResource, ParameterisedResource, PostableResource, DeletableCollectionResource, TitledPage, LockingCollectionResource
Properties
| Property | Returns | Description |
|---|---|---|
| body | String | Body content of this directory's index page, or an empty string if it has no index page. |
| branch | Branch | The branch this directory belongs to, delegated to from its parent resource. |
| children | ResourceList<CommonResource> | The child files and folders of this directory, including any browseable application pages registered by ApplicationManager. Built lazily on first access and cached for the lifetime of this resource. |
| contentManagedPermissions | boolean | Whether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource. |
| dir | boolean | Whether this resource is a directory. Always true. |
| directoryNode | DirectoryNode | The underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist. |
| files | List<ContentResource> | Files (not folders) that are direct children of this directory. |
| hash | String | Content hash of this directory's underlying directory node, or null if the node has not been created. |
| index | RenderFileResource | The index.html page of this directory, if one has already been created, otherwise null. |
| itemType | String | The "itemType" template parameter of this directory's index page, used to classify the folder for search. |
| paramNames | List<String> | Names of the template parameters set on this directory's index page. |
| pathFromBranch | Path | This directory's path relative to the root of its branch, built from its parent's path plus its own name. |
| searchCategory | String | The "category" template parameter of this directory's index page, used to classify the folder for search. |
| searchTags | String | The "tags" template parameter of this directory's index page, used to tag the folder for search. |
| subFolders | List<ContentDirectoryResource> | Subfolders of this directory, excluding the reserved ".mil" metadata folder. |
| title | String | Title of the directory: the title attribute of its index page if one exists and has a title, otherwise the directory's name. |
Methods
getChildren() · createDirectoryResource(String newName) · save() · isDir() · getDirectoryNode() · getIndex() · getHtmlPage(String name, boolean autocreate) · getTitle() · getBody() · getParam(String name) · getParamNames() · doSaveHtml() · is(String type) · getBranch() · getHash() · getSubFolders() · getFiles() · isContentManagedPermissions() · getItemType() · getSearchCategory() · getSearchTags() · getPathFromBranch()
getChildren()
Returns: ResourceList<CommonResource>
The child files and folders of this directory, including any browseable application pages registered by ApplicationManager. Built lazily on first access and cached for the lifetime of this resource.
createDirectoryResource(String newName)
Returns: DirectoryResource
Creates a new subdirectory of this directory with the given name and saves the change. Fails if a resource with that name already exists.
| Parameter | Description |
|---|---|
newName | the name of the subdirectory to create |
save()
Returns: void
Persists this directory by delegating to its parent's save method. Requires a logged-in user.
isDir()
Returns: boolean
Whether this resource is a directory. Always true.
getDirectoryNode()
Returns: DirectoryNode
The underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist.
getIndex()
Returns: RenderFileResource
The index.html page of this directory, if one has already been created, otherwise null.
getHtmlPage(String name, boolean autocreate)
Returns: RenderFileResource
Finds a named HTML page among this directory's children, parsing it for templating, or creates a new one if autocreate is true and no page with that name exists.
| Parameter | Description |
|---|---|
name | the name of the HTML page to find or create |
autocreate | if true, creates and returns a new page when none exists; otherwise returns null |
getTitle()
Returns: String
Title of the directory: the title attribute of its index page if one exists and has a title, otherwise the directory's name.
getBody()
Returns: String
Body content of this directory's index page, or an empty string if it has no index page.
getParam(String name)
Returns: String
Reads a named template parameter from this directory's index page.
| Parameter | Description |
|---|---|
name | the name of the parameter to read |
getParamNames()
Returns: List<String>
Names of the template parameters set on this directory's index page.
doSaveHtml()
Returns: void
Saves the index page if any of its title, body or parameters have been changed via this resource. Does nothing if nothing has been changed, or if there is no index page to save.
is(String type)
Returns: boolean
Returns true for "folder", "physicalFolder" and "directory" (but not for a directory whose name starts with a full stop, ie a hidden directory), and for "html" because folders generate a HTML representation when accessed over the web.
| Parameter | Description |
|---|---|
type | the resource type to test |
getBranch()
Returns: Branch
The branch this directory belongs to, delegated to from its parent resource.
getHash()
Returns: String
Content hash of this directory's underlying directory node, or null if the node has not been created.
getSubFolders()
Returns: List<ContentDirectoryResource>
Subfolders of this directory, excluding the reserved ".mil" metadata folder.
getFiles()
Returns: List<ContentResource>
Files (not folders) that are direct children of this directory.
isContentManagedPermissions()
Returns: boolean
Whether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource.
getItemType()
Returns: String
The "itemType" template parameter of this directory's index page, used to classify the folder for search.
getSearchCategory()
Returns: String
The "category" template parameter of this directory's index page, used to classify the folder for search.
getSearchTags()
Returns: String
The "tags" template parameter of this directory's index page, used to tag the folder for search.
getPathFromBranch()
Returns: Path
This directory's path relative to the root of its branch, built from its parent's path plus its own name.