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

PropertyReturnsDescription
bodyStringBody content of this directory's index page, or an empty string if it has no index page.
branchBranchThe branch this directory belongs to, delegated to from its parent resource.
childrenResourceList<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.
contentManagedPermissionsbooleanWhether this directory's permissions are managed as content, rather than through the standard role system. Always true for a directory resource.
dirbooleanWhether this resource is a directory. Always true.
directoryNodeDirectoryNodeThe underlying directory node for this resource in the versioned content repository, creating it from the parent node if it does not yet exist.
filesList<ContentResource>Files (not folders) that are direct children of this directory.
hashStringContent hash of this directory's underlying directory node, or null if the node has not been created.
indexRenderFileResourceThe index.html page of this directory, if one has already been created, otherwise null.
itemTypeStringThe "itemType" template parameter of this directory's index page, used to classify the folder for search.
paramNamesList<String>Names of the template parameters set on this directory's index page.
pathFromBranchPathThis directory's path relative to the root of its branch, built from its parent's path plus its own name.
searchCategoryStringThe "category" template parameter of this directory's index page, used to classify the folder for search.
searchTagsStringThe "tags" template parameter of this directory's index page, used to tag the folder for search.
subFoldersList<ContentDirectoryResource>Subfolders of this directory, excluding the reserved ".mil" metadata folder.
titleStringTitle 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.

ParameterDescription
newNamethe 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.

ParameterDescription
namethe name of the HTML page to find or create
autocreateif 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.

ParameterDescription
namethe 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.

ParameterDescription
typethe 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.

To get full access to the Kademi Hub existing customers can login here, or new customers can register here.