Class orion.core.ContentTypeRegistry
A service for querying orion.core.ContentTypes.
Defined in: </shared/eclipse/e4/orion/I201404012230/bundles/org.eclipse.orion.client.core/web/orion/contentTypes.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.core.ContentTypeRegistry(dataSource)
A registry that provides information about orion.core.ContentTypes.
|
Method Attributes | Method Name and Description |
---|---|
getContentType(id)
Gets a ContentType by ID.
|
|
Gets all the ContentTypes in the registry.
|
|
Gets a map of all ContentTypes.
|
|
getFileContentType(fileMetadata)
Looks up the ContentType for a file or search result, given the metadata.
|
|
getFilenameContentType(filename)
Looks up the ContentType, given a filename.
|
|
isExtensionOf(contentTypeA, contentTypeB)
Determines whether a ContentType is an extension of another.
|
|
isSomeExtensionOf(contentType, contentTypes)
Similar to #isExtensionOf, but works on an array of contentTypes.
|
Class Detail
orion.core.ContentTypeRegistry(dataSource)
A registry that provides information about orion.core.ContentTypes.
If a orion.serviceregistry.ServiceRegistry is available, clients should request the service with
objectClass "orion.core.contentTypeRegistry"
from the registry rather than instantiate this
class directly. This constructor is intended for use only by page initialization code.
- Parameters:
- {orion.serviceregistry.ServiceRegistry|orion.core.ContentType[]} dataSource
- The service registry
to use for looking up available content types and for registering this ContentTypeRegistry.
Alternatively, an array of ContentType data may be passed instead, which allows clients to use this ContentTypeRegistry without a service registry.
Method Detail
{orion.core.ContentType}
getContentType(id)
Gets a ContentType by ID.
- Parameters:
- {String} id
- The ContentType ID.
- Returns:
- {orion.core.ContentType} The ContentType having the given ID, or
null
.
{orion.core.ContentType[]}
getContentTypes()
Gets all the ContentTypes in the registry.
- Returns:
- {orion.core.ContentType[]} An array of all registered ContentTypes.
{Object}
getContentTypesMap()
Gets a map of all ContentTypes.
- Returns:
- {Object} A map whose keys are ContentType IDs and values are the orion.core.ContentType having that ID.
{orion.core.ContentType}
getFileContentType(fileMetadata)
Looks up the ContentType for a file or search result, given the metadata.
- Parameters:
- {Object} fileMetadata
- Metadata for a file or search result.
- Returns:
- {orion.core.ContentType} The ContentType for the file, or
null
if none could be found.
{orion.core.ContentType}
getFilenameContentType(filename)
Looks up the ContentType, given a filename.
- Parameters:
- {String} filename
- The filename.
- Returns:
- {orion.core.ContentType} The ContentType for the file, or
null
if none could be found.
{Boolean}
isExtensionOf(contentTypeA, contentTypeB)
Determines whether a ContentType is an extension of another.
- Parameters:
- {orion.core.ContentType|String} contentTypeA
- ContentType or ContentType ID.
- {orion.core.ContentType|String} contentTypeB
- ContentType or ContentType ID.
- Returns:
- {Boolean} Returns
true
ifcontentTypeA
equalscontentTypeB
, orcontentTypeA
descends fromcontentTypeB
.
{Boolean}
isSomeExtensionOf(contentType, contentTypes)
Similar to #isExtensionOf, but works on an array of contentTypes.
- Parameters:
- {orion.core.ContentType|String} contentType
- ContentType or ContentType ID.
- {orion.core.ContentType[]|String[]} contentTypes
- Array of ContentTypes or ContentType IDs.
- Returns:
- {Boolean}
true
ifcontentType
equals or descends from any of the ContentTypes incontentTypes
.