Class orion.core.ContentTypeService
A service for querying orion.core.ContentTypes.
Defined in: </shared/eclipse/e4/orion/I201309261019/plugins/org.eclipse.orion.client.core/web/orion/contentTypes.js>.
Constructor Attributes | Constructor Name and Description |
---|---|
orion.core.ContentTypeService(serviceRegistry)
A service for querying 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.ContentTypeService(serviceRegistry)
A service for querying orion.core.ContentTypes. Clients should request the
"orion.core.contenttypes"
service from the orion.serviceregistry.ServiceRegistry rather than instantiate this class directly. This constructor is
intended for use only by page initialization code.
- Parameters:
- {orion.serviceregistry.ServiceRegistry} serviceRegistry
- The service registry to use for looking up registered content types and for registering this service.
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
.