Article
Basic article handling that enables functionality as clearing and creating new copies of a newsitem article
clear(disableWarning)
Clear the article and create a new based on the configured base template.
Parameters
Param | Type | Description |
disableWarning |
| Required - Optional, default false. If true, the article will be cleared without warning |
copy(name)
Attempt to execute copy hooks if at least one exists, then create a new, unsaved, article based on the current article.
Parameters
Param | Type | Description |
name |
| Required - Name or identifier of caller |
setPubStatus(data)
Sets the publication status for this document. The value is one of what is defined in the NewsML G2 standard: https://www.iptc.org/std/NewsML-G2/latest/QuickStart-NewsML-G2-ItemBasics under the Publication Status section, together with custom extension in the format [customExtensionPrefix]:[customValue], such as imext:draft
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The value to be set in pubStatus. Expected value is in the form "stat:usable" |
data.eventType |
| Type of event to be sent when data has changed. default "document:changed" |
Example
addService(data)
Adds a service to the itemMeta section of the article. The service tag concists of a mandatory 'qcode' value and an optional 'why' attribute with extra information.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The change specification |
data.change.qcode |
| Required - The value to be set in the qcode for the service. Expected value is in the form "xxx:yyy" |
data.change.why |
| Required - Optional parameter for the 'why' attribute for service. |
data.eventType |
| Type of event to be sent when data has changed. default "document:changed" |
Example
removeService(data)
Removes a service from the itemMeta section of the article.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The qcode value matching the service to be removed. If there is no match, no event is sent. |
data.eventType |
| Type of event to be sent when data has changed. default "document:changed" |
Example
setPubStart(data)
Sets the publish start time, using ISO_8601 standard. If value is null, pubStart will be unset.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The time, in ISO_8601 |
data.eventType |
| Type of event to send when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setPubStop(data)
Sets the publish stop time, using ISO_8601 standard.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The time, in ISO_8601 |
data.eventType |
| Type of event to send when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setTitle(data)
Sets the value of the title.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - Value of the title to set. Must not be null or undefined |
data.eventType |
| Type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setEdNote(data)
Sets the value of editor note
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The text value of editor note. If null or empty, the element will be removed from document. |
data.eventType |
| Type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setItemMetaExtProperty(data)
Sets the value of a property. If value is null, the property will be removed. The type of property to change is specified by the type argument.
The type is defined by the [customPrefix]:[type] syntax, such as imext:url
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - Specification of the property to set. |
data.change.type |
| Required - The identification of the property |
data.change.value |
| Required - The value of the property. If null, the property will be removed. |
data.eventType |
| Type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
addItemMetaLink(data)
Adds a link to the itemMeta section of the article.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - Specifies the link to be created. |
data.change.rel |
| Required - The 'rel' attribute of the link. Example: "author". This parameter is mandatory and must be defined. Must not contain spaces |
data.change.type |
| Required - The 'type' attribute of the link. Example: "x-im/person". This parameter is mandatory and must be defined. |
data.change.uri |
| Required - The 'uri' pointing to an external resource. This OR the 'uuid' parameter must be present. |
data.change.uuid |
| Required - The 'uuid', which is an ID of a resource in the writer repository. This OR the 'uri' parameter must be present. |
data.change.data |
| Required - An optional data block with custom tags. |
data.change.links |
| Required - Optional links for the link to be created. Should be of the same format as the top-most link. |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
removeItemMetaLink(data)
Removes a link from itemMeta section
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The link to remove |
data.rel |
| Required - The rel attribute of the link |
data.uri |
| Required - The URI that identifies the link, OR |
data.uuid |
| Required - The uuid that identifies the link. |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setAltId(data)
Sets the alternative ID for the article. If null, the element will be removed.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The new ID to set |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setSlugline(data)
Sets the slugline for the article. If null, the element will be removed.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The new slugline |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setDescription(data)
Sets the description of the article. If null, the element will be removed.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The new description |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setLanguage(data)
Sets the language for the article. If null, the element will be removed.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The language to set |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setIdfLanguage(data)
Sets the language in the idf
section of the document. See https://www.w3.org/2005/05/font-size-test/starhtml-test.html for valid language codes.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The specification of language and optional direction |
data.change.lang |
| Required - The language specification, as specified in the link above. |
data.change.dir |
| Required - The text direction |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
setBy(data)
Sets the byline for the article. If null, the element will be removed.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The new byline |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
setHeadline(data)
Sets the headline of the article. If null, the element will be removed.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The new headline |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
addContentMetaLink(data)
Adds a link to the contentMeta section of the article.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - Specifies the link to be created. |
data.change.rel |
| Required - The 'rel' attribute of the link. Example: "author". This parameter is mandatory and must be defined. |
data.change.type |
| Required - The 'type' attribute of the link. Example: "x-im/person". This parameter is mandatory and must be defined. |
data.change.uri |
| Required - The 'uri' pointing to an external resource. This OR the 'uuid' parameter must be present. |
data.change.uuid |
| Required - The 'uuid', which is an ID of a resource in the writer repository. This OR the 'uri' parameter must be present. |
data.change.data |
| Required - An optional data block with custom tags. |
data.change.links |
| Required - Optional links for the link to be created. Should be of the same format as the top-most link. |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
removeContentMetaLink(data)
Removes a link from contentMeta section
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The link to remove |
data.rel |
| Required - The rel attribute of the link |
data.uri |
| Required - The URI that identifies the link, OR |
data.uuid |
| Required - The uuid that identifies the link. |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
addContentMetadata(data)
Adds an object element to the metadata section in contentMeta
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The specification of the object tag to add |
data.change.id |
| Required - A mandatory id of the object |
data.change.type |
| Required - A mandatory type of object |
data.change.title |
| Required - A an optional title of the object |
data.change.data |
| Required - Optional data element, with custom tags. |
data.change.links |
| Required - Optional array with link elements. The link follows the same format as with #addContentMetaLink |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
removeContentMetadata(data)
Removes an object in the contentMeta metadata section of the article.
Parameters
Param | Type | Description |
data |
| Required - The change specification |
data.change |
| Required - The specification of the object tag to remove |
data.change.id |
| Required - The ID for the tag to remove. This argument is required |
data.eventType |
| The type of event to be sent when data has changed. Default Event.DOCUMENT_CHANGED |
Example
itemMeta(path) ⇒ DocumentNode
DocumentNode
Returns the itemMeta node
Returns: DocumentNode
- A node instance
Throws:
Error when node does not exist
Parameters
Param | Description |
path | Required - Optional path to find node under itemMeta |
contentMeta(path) ⇒ DocumentNode
DocumentNode
Returns the contentMeta node
Returns: DocumentNode
- A node instance
Throws:
Error when node does not exist
Parameters
Param | Description |
path | Required - Optional path to find node under contentMeta |
Last updated