Derivatives of FunctionalService
Derivatives of FunctionalService interface facilitates creation of functional implementation of standard services. Functional service is just an object with a public method which takes a certain input and generates the desired output.
Simple search (simple-search
)
The following are the specialized interfaces and classes available for simple-search service:
com.hcl.unica.system.integration.service.search.SearchService
The
com.example.service.functional.SimpleSearchService
class in theasset-integration-starter
project is a quick starter implementation for the Functionalsimple-search service
. It extends from thecom.hcl.unica.system.integration.service.search.SearchService
class.The
SearchService
class implements theFunctionalService
interface and defines theSearchRequest
class and theContentPage
class to be the type arguments RQ & RS respectively for the FunctionalService. Thus, the object of theSearchRequest
becomes an input to all thesimple-search
services and theContentPage
is expected as an output on completion of the service.The plugin must extend its
simple-search
implementation from thecom.hcl.unica.system.integration.service.search.SearchService
class to be recognized as asimple-search
service by the Content Integration Framework (RESTful counterpart discussed in earlier section is also a valid choice to extend from for thesimple-search
services implemented using RESTful approach).The
SearchService
extends from thecom.hcl.unica.system.integration.service.search.AbstractSearchService
abstract class. It introduces one more method, namedgetSupportedContentTypes
. For more information on the method, see Derivatives of RestService.
Resource loader (resource-loader
)
The following are the specialized interfaces and classes available for the resource-loader service:
com.hcl.unica.system.integration.service.resourceloader.WebResourceLoaderService
Thecom.example.service.functional.ResourceLoaderService
class in asset-integration-starter project is a quick starter implementation for Functionalresource-loader
service. It extends from the following class:com.hcl.unica.system.integration.service.resourceloader.WebResourceLoaderService
The
WebResourceLoaderService
class implements theFunctionalService
interface and defines theResourceRequest
and theHttpResponse
types to be the type arguments RQ & RS, respectively, for theFunctionalService
. Thus, the object of theResourceRequest
becomes an input to all theresource-loader
services and theHttpResponse
is expected as an output on completion of the service (the same input and output types are used for RESTful counterpart of the resource-loader). For more information onResourceRequest
&HttpResponse
types, see Derivatives of RestService.The plugin must extend its
resource-loader
implementation from thecom.hcl.unica.system.integration.service.resourceloader.WebResourceLoaderService
service to be recognized as aresource-loader
service by the Content Integration Framework (HTTP counterpart discussed in the earlier section is also a valid choice to extend from for theresource-loader
services implemented using the HTTP approach).The WebResourceLoaderService extends from the following class:com.hcl.unica.system.integration.service.resourceloader. AbstractWebResourceLoaderService
For more information about this class, see Derivatives of RestService.
List content categories (list-content-categories
)
The following are the specialized interfaces and classes available for list-content-categories service:
com.hcl.unica.system.integration.service.content.categories.list.ContentCategoriesListService
Plugin can alternatively choose Functional approach to implement
list-content-categories
service by extending the implementation fromContentCategoriesListService
class. TheContentCategoriesListService
class implements theFunctionalService
interface and mandates theContentCategoryListRequest
and theList<ContentCategory>
classes to be the type arguments RQ and RS respectively for theFunctionalService
. Thus, the object of theContentCategoryListRequest
becomes an input to thelist-content-categories
service and the object ofList<ContentCategory>
type is expected as an output on completion of the service.- The plugin must extend its list-content-categories implementation from the
com.hcl.unica.system.integration.service.content.categories.list.ContentCategoriesListService
class to be recognized as a validlist-content-categories
service by the Content Integration Framework (RESTful counterpart discussed in earlier section is also a valid choice to extend from).ContentCategoriesListService
extends fromAbstractContentCategoriesListService
class. Details ofAbstractContentCategoriesListService
class are covered in the Derivatives of RestService topic.
List folders (list-folders
)
The following are the specialized interfaces and classes available for list-folders service:
com.hcl.unica.system.integration.service.folder.list.FolderListService
Plugin can alternatively choose Functional approach to implement
list-folders
service by extending the implementation fromFolderListService
class. TheFolderListService
class implements theFunctionalService
interface and mandates theFolderListRequest
and theList<Folder>
classes to be the type arguments RQ and RS respectively for theFunctionalService
. Thus, the object of theFolderListRequest
becomes an input to thelist-folders
service and the object ofList<Folder>
type is expected as an output on completion of the service.- The plugin must extend its list-folders implementation from the
com.hcl.unica.system.integration.service.folder.list.FolderListService
class to be recognized as a validlist-folders
service by the Content Integration Framework (RESTful counterpart discussed in earlier section is also a valid choice to extend from).FolderListService
extends fromAbstractFolderListService
class. Details ofAbstractFolderListService
class are covered in the Derivatives of RestService topic.
List contents (list-contents
)
The following are the specialized interfaces and classes available for list-contents service:
com.hcl.unica.system.integration.service.content.list.ContentListService
Plugin can alternatively choose Functional approach to implement
list-contents
service by extending the implementation fromContentListService
class. TheContentListService
class implements theFunctionalService
interface and mandates theContentListRequest
and theContentPage
classes to be the type arguments RQ and RS respectively for theFunctionalService
. Thus, the object of theContentListRequest
becomes an input to thelist-contents
service and the object ofContentPage
type is expected as an output on completion of the service.- The plugin must extend its list-contents implementation from the
com.hcl.unica.system.integration.service.content.list.ContentListService
class to be recognized as a valid list-contents service by the Content Integration Framework (RESTful counterpart discussed in earlier section is also a valid choice to extend from).ContentListService
extends fromAbstractContentListService
class. Details ofAbstractContentListService
class are covered in the Derivatives of RestService topic.
Get content details (get-content-details
)
The following are the specialized interfaces and classes available for get-content-details service:
com.hcl.unica.system.integration.service.content.details.ContentDetailsService
Plugin can alternatively choose Functional approach to implement
get-content-details
service by extending the implementation fromContentDetailsService
class.The
ContentDetailsService
class implements theFunctionalService
interface and mandates theContentDetailsRequest
and the Presentable classes to be the type arguments RQ and RS respectively for theFunctionalService
. Thus, the object of theContentDetailsRequest
becomes an input to theget-content-details
service and the object of Presentable type is expected as an output on completion of the service.The plugin must extend its
get-content-details
implementation from thecom.hcl.unica.system.integration.service.content.details.ContentDetailsService
class to be recognized as a validget-content-details
service by the Content Integration Framework (RESTful counterpart discussed in earlier section is also a valid choice to extend from).ContentDetailsService
extends fromAbstractContentDetailsService
class. Details ofAbstractContentDetailsService
class are covered in the Derivatives of RestService topic.
Get object schema (get-object-schema
)
get-object-schema
service is used to generate the master schema of
domain object or entity used by the respective system to represent the content.
Master schema in simplest form is just a hierarchical metadata of each mappable
content attribute. Attribute hierarchy and metadata is expected to match the JSON
representation of the domain object. Attribute metadata mainly includes the data
type of the attribute, format of the value held in the attribute, unique identifier
of the attribute and display title or label for the attribute.
The following are the specialized interfaces and classes available for
get-object-schema
service:
com.hcl.unica.system.integration.service.object.schema.ObjectSchemaProviderService
The
ObjectSchemaProviderService
class implements theFunctionalService
interface and mandates thecom.hcl.unica.system.model.ObjectSchemaRequest
and thecom.hcl.unica.system.model.json.schema.ObjectSchema
classes to be the type arguments RQ and RS respectively for theFunctionalService
. Thus, the object of theObjectSchemaRequest
becomes an input to theget-object-schema
service and the object ofObjectSchema
type is expected as an output on completion of the service. Plugin however need not build theObjectSchema
by itself. It should just override and implement following abstract method fromObjectSchemaProviderService
class.ObjectProfile getObjectProfile(ObjectSchemaRequest objectSchemaRequest)
The
getObjectProfile()
method acceptsObjectSchemaRequest
and returnsObjectProfile
. (These types are discussed in subsequent section.)The plugin must extend
get-object-schema
implementation from thecom.hcl.unica.system.integration.service.object.schema.ObjectSchemaProviderService
class to be recognized as a validget-object-schema
service by the Content Integration Framework. There is no RESTful counterpart of this standard super class since object schema generation does not include any HTTP interaction. Plugins can implement custom RESTful service and invoke it internally from withinget-object-schema
service if required.com.hcl.unica.system.model.ObjectSchemaRequest
Object of this class is supplied as an input to the
get-object-schema
service. The most important method of this class isgetObjectIdentity()
which returns an object of typecom.hcl.unica.system.model.ObjectIdentity
encapsulating the details of the content chosen by the user to request the master schema. It includesapplicationId
(the system identifier),objectType
(content type/category identifier) andobjectId
(unique identifier of the selected content). Regardless of the category and/or content chosen by the user at the time of setting up content mapping, the generated schema must include attributes of all kinds of contents supported by the respective system. In other words, only one master schema is used for mapping all types of contents provided by the given system.The
getEnrichmentObjectJson()
method inObjectSchemaRequest
class can be ignored as of current release.com.hcl.unica.system.integration.service.object.schema.ObjectProfile
This is a return type of
getObjectProfile()
method inget-object-schema
service. It carries the Java type corresponding to the domain entity/object for the respective system. Content Integration Framework consults this Java type to generate the schema for public and non-public non static class properties (inclusive of Enums & Optionals).@MappableAttribute
annotation can be used to configure each individual class property to control the schema generated by Content Integration Framework. Refer to thecom.aem.model.response.simplesearch.SimpleSearchItem
domain object inaem-integration reference
project to get an idea about how this annotation is used. More details are provided on@MappableAttribute
in next section.ObjectProfile
can optionally include an instance ofcom.hcl.unica.system.integration.service.object.schema.ObjectSchemaEnricher
to dynamically add/modify/remove attributes from the schema thus generated. Next section explainsObjectSchemaEnricher
in detail.com.hcl.unica.system.integration.service.object.schema.ObjectSchemaEnricher
ObjectSchemaEnricher
is an abstract class. Plugin should extend it to have desired implementation. The type parameter toObjectSchemaEnricher
class represents the Java type containing the additional details required for enriching the statically generated object schema. These additional details might be provided by the client applications of Unica Content Integration. As of current release, no additional details are provided, hence it should be set to Void while implementing the schema enricher.ObjectSchemaEnricher
declares only one abstract method which should be implemented by the plugin:abstract public ObjectSchema enrich( ObjectSchema objectSchema, ObjectSchemaEnrichmentRequest<T> objectSchemaEnrichmentRequest )
The first argument to this method is an instance of
com.hcl.unica.system.model.json.schema.ObjectSchema
class. It contains the automatically generated domain object schema derived from the Java type supplied inObjectProfile
. At its core,ObjectSchema
is just aMap<String, AttributeSchema>
, wherein class property names forms the keys of this map and property metadata ends up as an object ofAttributeSchema
. If the class property in turn refers to another object, the correspondingAttributeSchema
will have anotherMap<String, AttributeSchema>
containing the attributes of that object type and so on.Note: It is important to note that attribute names used as the keys in attribute map correspond to the JSON properties which ends up in the JSON representation of the domain object. Hence, if@JsonProperty
annotation is used to override the JSON property name for certain class attribute, then Content Integration Framework automatically detects it and use the overridden property name.ObjectSchema
as well asAttributeSchema
extend fromcom.hcl.unica.system.model.json.schema.AttributeContainer
abstract class.AttributeContainer
provides convenience methods toObjectSchema
andAttributeSchema
classes for navigating through attribute hierarchy as well as for adding, modifying and removing attributes at any level in the hierarchy to ease the schema enrichment. Attributes at any level in the hierarchy can be accessed and manipulated using their names as appearing in JSON representation.com.hcl.unica.system.model.json.schema.generator.annotations.MappableAttribute
@MappableAttribute
annotation provides a way to control how Content Integration Framework generates object schema from the respective Java type. Use of@MappableAttribute
is not mandatory. If it is not used, Content Integration Framework automatically figures out property metadata. If required, this annotation should be placed on top of desired class properties. Following annotation attributes can be used to control the schema generation:- hidden – Set this to true to explicitly exclude
certain property from object schema (
@JsonIgnore
is presently not considered by Content Integration Framework. Hence, any property excluded from JSON representation using@JsonIgnore
must be explicitly excluded from schema) - id – Supply unique identifier for the property.
Content Integration Framework needs unique identifier for each mappable
class property. If
@MappableAttribute
is not used, or id is not specified, it generates one automatically based on the location of property inside the class.Automatic generation of attribute identifier is subject to the name and the hierarchical location of class property inside the domain object graph. It implies that if the property name is changed and/or moved up or down the object graph hierarchy, it will change the identifier associated with it. Such refactoring can mislead Content Integration Framework while reading the values of refactored attributes and may lead to undesired data in mapped contents (such as Offers in COM). Hence, to avoid such inadvertent changes in attribute identifiers, we recommend you to assign unique attribute identifiers manually, which remain constant regardless of the name and location of class properties.
- title – Display title/label for the property. If omitted, Content Integration Framework generates one using property name.
- type – One of the values from
com.hcl.unica.system.model.json.schema.generator.annotations.AttributeType
. If omitted, Content Integration Framework automatically figures out the appropriate type. - format – One of the values from
com.hcl.unica.system.model.json.schema.generator.annotations.AttributeFormat
. Content Integration Framework can automatically identify standard java temporal types (Date
,LocalDateTime
,Instant
) and set the attribute type toDATETIME
. Other formats should be explicitly declared. - implementation – Should be used for polymorphic references to explicitly declare the Java type to be considered for automatic schema generation.
- hiddenProperties -
@MappableAttribute
annotation can be used at the class level to hide multiple properties at single place.hiddenProperties
takes an array of Strings containing the names of properties (direct as well as inherited ones) to be excluded from automatically generated schema. It is particularly useful for hiding properties inherited from third party parent class.
Java Type to AttributeType Mapping
Following table summarizes the mapping between Java type and AttributeType/AttributeFormat used by the Content Integration Framework for automatic schema generation:
Java Type AttributeType AttributeFormat String
Character
Char
CharSequence
LocalDate
LocalTime
ZonedDateTime
OffsetDateTime
OffsetTime
ZoneId
Calendar
UUID
STRING
Boolean
boolean
BOOLEAN
BigInteger
Integer
Int
Long
Long
Short
Short
Byte
byte
INTEGER
BigDecimal
Number
Double
Double
Float
float
NUMBER
Date
LocalDateTime
Instant
Content Integration Framework expects date values be expressed in UTC standard time. Temporal values expressed in any other timezone can lead to inaccurate temporal calculations in further use cases.
INTEGER
DATETIME
- hidden – Set this to true to explicitly exclude
certain property from object schema (
Get cognitive analysis (get-cognitive-analysis
)
The following are the specialized interfaces and classes available for get-cognitive-analysis service:
com.hcl.unica.system.integration.service.cognitive.analysis.CognitiveAnalysisService
Plugin can alternatively choose Functional approach to implement
get-cognitive-analysis
service by extending the implementation fromCognitiveAnalysisService
class. TheCognitiveAnalysisService
class implements theFunctionalService
interface and mandates theCognitiveAnalysisRequest
and theCognitiveAnalysis
classes to be the type arguments RQ and RS respectively for theFunctionalService
. Thus, the object of theCognitiveAnalysisRequest
becomes an input to theget-cognitive-analysis
service and the object ofCognitiveAnalysis
type is expected as an output on completion of the service.- The plugin must extend its
get-cognitive-analysis
implementation from thecom.hcl.unica.system.integration.service.cognitive.analysis.CognitiveAnalysisService
class to be recognized as a validget-cognitive-analysis
service by the Content Integration Framework (RESTful counterpart discussed in earlier section is also a valid choice to extend from).CognitiveAnalysisService extends from
AbstractCognitiveAnalysisService
class. Details ofAbstractCognitiveAnalysisService
class are covered in the Derivatives of RestService topic.