Save news item. Triggers a validation of the news item.
replaceSource(sourceXml, [etag])
Replace the NewsML source. Will effectively replace the current article with anything in the incoming NewsML.
Parameters
Param
Type
Default
sourceXml
string
etag
string
null
setSource()
Deprecated
Use api.newsItem.replaceSource() instead
getGuid()⇒ string | null
Return the GUID in the NewsItemArticle Can return null if no GUID is found in NewsItem
setGuid(uuid)
Set news item guid (uuid)
Parameters
Param
Type
Description
uuid
string
Required - New uuid or null to clear
getLocale()⇒ string
Gets locale from article's idf-element. Formatted with underscore, eg. sv_SE, en_GB, nl_NL. Uses fallback languages if the article's language only uses two characters. If fallback fails, will return the configured "language"-property from writer-config.
getLanguageParts()⇒ Object
Gets a language parts object parsed from article's NewsML.
setLanguage(name, languageCode, textDirection)
Sets xml:lang property on article's idf-element. Language code should be two two-character codes separated by a dash, eg. sv-SE, en-GB
Parameters
Param
Type
Default
Description
name
string
Required - Plugin-id that set language
languageCode
string
Required - Two two-character language-region codes, separated by a dash. eg. sv-SE, en-GB, nl-NL
textDirection
string
"ltr"
Required -'ltr' or 'rtl'
getNewsPriority()⇒ Object
Get news priority.
Returns: Object - News priority object in JXON format
createNewsPriority(name, newsPriority)
Create and insert a new newsPriority object into the news item content meta data. Triggers a documentChanged event to all documentChanged listeners except the plugin making the change.
Parameters
Param
Type
name
string
newsPriority
object
setNewsPriority(name, newsPriority)
Set news priority.
Parameters
Param
Type
Description
name
string
Required - Name of the plugin making the call
newsPriority
Object
Required - News priority object
getMainChannel()⇒ object
Get main channel (channel with attribute why="imext:main")
getSections()⇒ Array | *
Get Sections. Finds all the service nodes with a qCode containing imsection:
Renames @qcode to qcode so plugins doesn't have to handle
getSection()⇒ *
Get Section.
Find section on article if any. If no section null is returned. Note that by using this function it is presumed that there can be max one section on an article.
getChannels()⇒ Array
Get Channels Finds all the service nodes with a qCode containing imchn:
Renames @qcode to qcode so plugins doesn't have to handle
updateSection(name, section)
Update Section. Removes existing section and add new. Note expects article to only allow one section.
Throws:
Error
Parameters
Param
Description
name
Required - Name of plugin.
section
Required - Section object to set on article.
removeSection(name, section, muteEvent)
Removes .
Throws:
Error
Parameters
Param
Type
Description
name
string
Required - Name of plugin.
section
string
Required - Section object to remove.
muteEvent
boolean
Required - Optional. Mute event if set to true, only used internally.
addChannel(name, channel, setAsMainChannel)
Add a channel as a . Renaming qcode to @qcode.
Throws:
Error
Parameters
Param
Type
Description
name
string
Required - Name of plugin
channel
string
Required - Name of channel
setAsMainChannel
boolean
Required - Set this channel as main channel
removeChannel(name, channel, muteEvent)
Removes .
Throws:
Error
Parameters
Param
Type
Description
name
string
Required - Name of plugin
channel
string
Required - Name of channel
muteEvent
boolean
Required - Optional. Mute event if set to true, only used internally.
getPubStatus()⇒ Object
Get the pubStatus of document
Returns: Object - Return object with current pubStatus of document
setPubStatus(name, pubStatus)
Set pubStatus Creates a pubStatus node in itemMeta if it not exists
Required - Expect object with value property. Type is ignored. Object {value: "2016-02-08T20:37:25 01:00"}
removePubStart(name)
Remove the node for the pubStart
Parameters
Param
name
getPubStop()⇒ object
Get pubStop
setPubStop(name, pubStop)
Set pubStop.
Parameters
Param
Type
name
string
pubStop
object
removePubStop(name)
Remove the node for pubStop.
Parameters
Param
Type
Description
name
string
Required - Plugin name
getEdNote()⇒ String
Get editorial note from edNote element in itemMeta section.
setEdNote(content)
Set editorial note content in edNote element in itemMeta section
Throws:
Error
Parameters
Param
Type
Description
content
string
Required - String content of editorial note
getNewspilotArticleId()⇒ *
Get Newspilot article id (if any).
getAuthors()⇒ *
Get all author links in itemMeta links
getCreator()⇒ object
Get the NavigaID user who created the article
Returns: object - Normalized USER with linked Organisation and unit
getUpdater()⇒ object
Get the NavigaID user who last updated the article
Returns: object - Normalized USER with linked Organisation and unit
getSharedWith()⇒ object
Get NavigaID organisation and linked unit(s) that the article is shared with
Returns: object - Normalized USER with linked Organisation and unit
removeAuthorByUUID(name, uuid)
Remove an author from newsItem.
Throws:
NotFoundError When no node is found by provided UUID the NotFoundError is thrown
Parameters
Param
Type
Description
name
string
Required - Name of the plugin
uuid
string
Required - The UUID of the author to be deleted
addAuthor(name, author)
Add an known author with a specified uuid to the newsItem
Parameters
Param
Type
Description
name
string
Required - Plugin name
author
object
Required - Author object with the properties name and uuid
addSimpleAuthor(name, author)
Add an simple/unknown author to the newsItem
Parameters
Param
Type
Description
name
string
Required - Plugin name
author
object
Required - Author object with the properties name and uuid
updateAuthorWithUUID(name, uuid, author)
Updates itemMeta > links > link[type="x-im/author"]/@name for specified uuid.
If parameter author object contains any of
email
firstName
lastName
phone
facebookUrl
twitterUrl
shortDescription
longDescription a child element, 'data', will be created and a child element to that element with the name of object field will be created, e.g. data > phone.
Note that an existing 'data' element will be removed from link.
Parameters
Param
Type
Description
name
string
Required - Plugin name
uuid
string
Required - The uuid for the author in the newsItem
author
object
Required - Object containing name and, optional, fields (see above)
Required - An array of types considered being tags. Example ['x-im/person, x-im/channel']
addTag(name, tag)
Adds a tag to itemMeta > links section in newsItem
The format used is identical to the search response provided by concepts backend
Parameters
Param
Type
Description
name
string
Required - The name of the plugin
tag
object
Required - Must containt title, type and uuid
Example
updateTag(name, uuid, tag)
Update a tag in itemMeta > links section
Throws:
NotFoundError When no node is found by provided UUID the NotFoundError is thrown
Parameters
Param
Type
Description
name
string
Required - The name of the plugin
uuid
string
Required - The UUID of the link element
tag
object
Required - The tag, same format as concept backend provides in search {"name": [ "2016 Eurovision Song Contest" ], "type": [ "story" ], "typeCatalog": [ "imnat" ], "imType": [ "x-im/story" ] }
removeLinkByUUID(name, uuid)
Removes a link in itemMeta links by providing an UUID
Parameters
Param
Description
name
Required - The name of the plugin calling the method
uuid
Required - The uuid of the link to be removed
removeLinkByURI(name, uri)
Removes a link in itemMeta links by providing an URI
Parameters
Param
Type
Description
name
string
Required - The name of the plugin calling the method
uri
string
Required - The URI of the link to be removed
removeAllLinksByType(name, type)
Removes all links in itemMeta links by providing a type
Parameters
Param
Type
Description
name
string
Required - of the plugin calling the method
type
string
Required - of the links to be removed
removeLinkByUUIDAndRel(name, uuid, rel)
Remove a link from itemMeta links section by type and rel attributes
Required - A concept profile object that atleast contains title and uuid
Example
getContentProfiles()⇒ array | null
Returns a list of all existing content-profiles in NewsItem
getConceptByUuid()⇒ object | null
Returns a conceptItem with matching UUID
Returns: object | null - ConceptItem or null
getCategories()⇒ array | null
Returns a list of all existing categories in NewsItem
getArticleSubType()⇒ String
Get the sub-type of the article (if there is one) For regular stories/articles this will return an empty string Other types includes: x-im/print, x-im/fact etc
Returns: String - Subtype or empty string
getExtProperty(sectionName, type, raw)⇒ string | Element
Retrieve either an itemMetaExtProperty or contentMetaExtProperty value from the item or content meta sections. Optionally return full element if raw parameter is set to true.
Parameters
Param
Type
Default
Description
sectionName
string
Required - Either 'itemMeta' or 'contentMeta'
type
string
Required -
raw
boolean
false
Required - Optional, return as raw dom element, default is false
setExtProperty(name, sectionName, type, value)
Create new or set a value of existing itemMetaExtProperty or contentMetaExtProperty
Parameters
Param
Type
Description
name
string
Required - Identifier of caller
sectionName
string
Required - Either 'itemMeta' or 'contentMeta'
type
string
Required - Type string
value
string
Required - Value
deleteExtProperty(name, sectionName, type)
Delete a specified itemMetaExtProperty or contentMetaExtProperty
Parameters
Param
Type
Description
name
string
Required - Identifier of caller
sectionName
string
Required - Either 'itemMeta' or 'contentMeta'
type
string
Required - Type
getTemporaryId()⇒ * | null
Returns the generated temporary id for the article. Temporary id is used when a new article is created and before it's saved the first time.
setTemporaryId(temporaryArticleID)
Set a temporaryId for the article
Parameters
Param
temporaryArticleID
hasTemporaryId()⇒ boolean
Checks if current article has a temporary id
getIdForArticle()⇒ string
Get the id for the article
getHasPublishedVersion()⇒ bool
Get value of itemMetaExtProperty element with type imext:haspublihedversion that indicates whether the newsitem has published version or not.
setHasPublishedVersion(name, value)
Set itemMetaExtProperty element with type imext:haspublihedversion to true/false in item > meta sections to indicate whether this newsitem has a published version or not.
Parameters
Param
Type
Description
name
string
Required - Identifier of caller
value
bool
Required - True or false
getContentMetaObjectsByType(objectType)⇒ Array
Deprecated
Retrieve objects from contentmeta.medata section based on type.
Returns: Array - Array of objects in jxon format
Parameters
Param
Type
Description
objectType
string
Required - The type of object
getContentMetaObjectById(id)⇒ Object
Deprecated
Retrieve object from contentmeta.medata section based on id.
Returns: Object - Object in jxon format
Parameters
Param
Type
Description
id
string
Required - The id of object
setContentMetaObject(name, jxonObject)
Deprecated
Create and add an object into the contentmeta.metadata section. The object is encoded as a jxon object with the mandatory attributes id and type. All data must reside in the sub data structure. If an object with the specified id already exists it is silently replaced. Triggers a document:changed event.
Parameters
Param
Type
Description
name
string
Required - Name of the plugin making the call
jxonObject
Object
Required - The jxon encoded object
Example
Example (Results in)
removeContentMetaObject(name, id)
Deprecated
Remove a specific object identied by id from the contentmeta.metadata section. Triggers a document:changed event.
Parameters
Param
Type
Description
name
string
Required - Name of the plugin making the call
id
string
Required - The id of the object
invalidate()
Invalidate document and displays notification that document is invalid
getVersionCreated()⇒ *
Get version created date. Resides in newsItem > itemMeta block. If no version created date was found, null is returned.
getFirstCreated()⇒ *
Get first created date. Resides in newsItem > itemMeta block. If no first created date was found, null is returned.
getContentCreated()⇒ *
Deprecated
Get content created date. Resides in newsItem > contentMeta block. If no content created date was found, null is returned.
getContentModified()⇒ *
Deprecated
Get content modified date. Resides in newsItem > contentMeta block. If no content modified date was found, null is returned.