ConceptService

Top level api object from which all other api modules are available. ConceptService class

A Service class filled with utility functions for Concept items and enhanced data loading. ConceptService is accessed through the writer

Available operations to register callback handlers

getPropertyMap()⇒ object

Get loaded property map

Returns: object - PropertyMap

on(conceptType, operation, handler)

Function to register handlers for specific ConceptType operations

Parameters

Example

ConceptService.on(
    'x-im/category',
    ConceptService.operations.ADD,
    this.handleNewCategory
)

off(conceptType, operation, handler)

Function to remove registered handler

Parameters

Example

ConceptService.off(
    'x-im/category',
     ConceptService.operations.ADD,
     this.handleNewCategory
)

has(conceptType, operation)⇒ boolean

Function to check if a specific conceptType has a registered handler for a specific operation

Returns: boolean - if a handler has been registered

Parameters

Example

if (ConceptService.has('x-im/category', ConceptService.operations.ADD)) {
    // Do stuff
}

trigger(operation, conceptItem)

Function to trigger registered handler for conceptType operations

Parameters

Example

ConceptService.trigger(
    ConceptService.operations.ADD,
    conceptItem = {
        uuid: xxx,
        create: true,
        ....
    }
)

getArticleConceptByUUID(uuid)

Get article concept by uuid

Parameters

getArticleConceptsByType(conceptType, multipleTypes, subtypes)⇒ array

Get concepts of a specific type, currently in the article

Returns: array - ConceptItems

Parameters

addArticleConcept(conceptItem, triggerDocumentChanged)

Add concept link to article

Parameters

addArticleConcepts(conceptItems, triggerDocumentChanged)

Add an array of concept links to article

Parameters

updateArticleChannelRel(conceptItem)

Update concept rel

Parameters

updateArticleConcept(conceptItem, triggerDocumentChanged)

Update existing concept link in article

Parameters

removeArticleConceptItem()

Deprecated

removeArticleConcept(conceptItem)

Remove concept link from article

Parameters

removeArticleConcepts(conceptItems)

Remove an array of concept links from article

Parameters

removeAllArticleLinksOfType(conceptType)

Remove all links of a specific type from the article

Parameters

extractBroaderText(conceptItem, [truncated])⇒ string

Recursive function to extract n number of parent names

Returns: string - Broader names combine

Parameters

getConceptItemXml(conceptItem)⇒ string

Get the actual concept XML from storage

Returns: string - XML response

Parameters

getConceptItemConfigJson(conceptItem)

Get the concept type config, cached or remote

Parameters

createConceptItemXml(xml)

Create a new concept item in storage

Parameters

updateConceptItemXml(uuid, xml)

Update the actual concept item in storage

Parameters

fetchConceptItemProperties(conceptItem, string)⇒ object

fetch remaining props (not stored on the article) from oc

Returns: object - conceptItem

Parameters

Example

import {ConceptService} from 'writer'

ConceptService.fetchConceptItemProperties({
     'uuid': '12345678-1234-4567-7891-789456123456'
})

searchForConceptSuggestions(args, conceptTypes, term, subtypes, associatedWith, allowedStatuses, customQuery)⇒ array

Search for concepts

Returns: array - response An array with result objects

Parameters

Example

const result = await ConceptService.searchForConceptSuggestions(
     conceptTypes: 'x-im/section',
     term: '*',
     subtypes: null,
     associatedWith: 'x-im/channel',
     allowedConceptStatuses = ["draft", "usable"]
)

search(query)⇒ array

A search Concept function Will use submitted query to search for items with contenttype concept

Returns: array - searchResult

Parameters

getRemoteConceptsByType(conceptType)⇒ array

Get concepts from remote storage by concept-type

Returns: array - array of concepts with matching type

Parameters

getGroupConcepts(groupType, includeConceptsWithoutGroup)

Get all concept-groups by group-type (subType), optionally include all concepts of subtype, that does not have an associated group

Parameters

Last updated