Derivatives of RestService
Derivatives of RestService interface facilitates creation of RESTful implementation of standard services.
Simple search (simple-search
)
simple-search
service:com.hcl.unica.system.integration.service.search.RestSearchService
The
com.example.service.rest.SimpleSearchService
class in asset-integration-starter project is a quick starter implementation for RESTfulsimple-search
service. Its parent iscom.hcl.unica.system.integration.service.search.RestSearchService
class.The
RestSearchService
class has a type parameter RS, which represents the type of response (post deserialization) received from the remote REST API. In this case it isSimpleSearchResponse
class defined inside theasset-integration-starter
project.RestSearchService
class implementsRestService
interface and defines theSearchRequest
class as the type argument RQ forRestService
. Thus, the object ofSearchRequest
becomes input to all thesimple-search
services (same input is used for Functional counterpart of simple-search as well).SearchRequest
class is part of the Content Integration SDK.In addition to defining the input type for the
simple-search
service,RestSearchService
class also overrides thetransformResponse
method and defines return value of this method to be ofContentPage
type.ContentPage
is also part of the Content Integration SDK and encapsulates the search result and associated pagination details.The plugin must extend its
simple-search
implementation from the servicecom.hcl.unica.system.integration.service.search.RestSearchService
to be recognized as asimple-search
service by the Content Integration Framework (Functional counterpart, discussed later, is also a valid choice to extend from, for thesimple-search
services implemented using the Functional approach).RestSearchService
extends fromcom.hcl.unica.system.integration.service.search .AbstractSearchService
abstract class.We recommend looking at
com.aem.service.AemSimpleSearchService
class from theaem-integration
project to know more about how theSearchRequest
class and theContentPage
class are used during service implementation.Adhering to the contract of
Presentable
interface while populating list of contents inContentPage
is a crucial part of this service implementation.Presentable
interface is covered in more detail in subsequent section.com.hcl.unica.system.integration.service.search.AbstractSearchService
This is a common base class for RESTful as well as Functional
simple-search
implementations. So, the details of this class also apply to the Functional implementation ofsimple-search
.This class defines the
com.hcl.unica.system.integration.service.gateway.SimpleSearchServiceGateway
interface as the service gateway for thesimple-search
service. ServiceGateways are the means to programmatically define input and output types of the service and the work with the service. A closer look at this interface tells us that thesimple-search
takes theSearchRequest
object and returns theContentPage
object.In addition to defining the service interface forsimple-search
, it introduces one more method for thesimple-search
service, namedgetSupportedContentTypes
. Everysimple-search
implementation can optionally override and implement this method. Please note that this method is verysimple-search
specific and has nothing to do with other standard and custom services. The signature of this method is as follows:public Map<String, String> getSupportedContentTypes();
Implementation of this method returns a
Map<String, String>
representing the supported categories of contents that can be searched in the target system. There is no specific semantic associated with the entries in this Map. It can be any meaningful key-value pair. It acts as a filter for client application during the search operation. As of current implementation of Unica Content Integration, this Map is used to populate entries in a drop down, wherein keys of the Map become values of the options, and values of the Map become display labels for the options. Thus, keys can carry internal names, or identifiers, and values should be readable and meaningful texts. If the user needs to search any specific type of content, he can choose one or more options from the supported types. In such case,simple-search
service receives a set of keys corresponding to the values chosen by the user. Set of keys received from the client application can be obtained fromExecutionContext
object by navigating through thegetRequest
method and then callinggetTypes()
on it. Thesimple-search
implementation deals with these set of keys, as per the target system’s programming interface, and filters the search items accordingly.Standard service parameter - supportedContentTypes
Overriding
getSupportedContentTypes
method is recommended only if the Map needs to be generated dynamically. Content Integration Framework provides an alternate approach to statically define this Map using a standard service parameter calledsupportedContentTypes
, configured underparams
element in the service declaration file. For example, refer thesimple-search
service declaration for AEM and WCM inside <ASSET_PICKER_HOME>/conf/plugin-services.yml file.
List content categories (list-content-categories
)
The following are the specialized interfaces and classes available for the
list-content-categories
service:
-
com.hcl.unica.system.integration.service.content.categories.list. RestContentCategoriesListService
The
com.example.service.rest
. ExampleContentCategoryListingService class in asset-integration-starter project is a quick starter for RESTful list-content-categories service. ExampleContentCategoryListingService class extends from RestContentCategoriesListService class.The
RestContentCategoriesListService
class has a type parameter RS, which represents the type of response (post deserialization) received from the remote REST API. In this case it is specified asList<ContentCategoryDetails>
for the sake of example.RestContentCategoriesListService
class implementsRestService
interface and defines thecom.hcl.unica.system.model.request.content.categories
.ContentCategoryListRequest class as the type argument RQ for RestService. Thus, the object of ContentCategoryListRequest becomes input to all the list-content-categories services (same input is used for Functional counterpart of list-content-categories as well).In addition to defining the input type for the list-content-categories service, RestContentCategoriesListService class also overrides the transformResponse method and mandates the return value of this method to be an object of
List<ContentCategory>
type.ContentCategory
class is part of Content Integration SDK.The plugin must extend the implementation of list-content-categories service from com.hcl.unica.system.integration.service.content.categories.list. RestContentCategoriesListService class to be recognized as a valid list-content-categories service by the Content Integration Framework (Functional counterpart, discussed later, is also a valid choice to extend from).
RestContentCategoriesListService
extends from
.com.hcl.unica.system.integration.service.content.categories.list.AbstractContentCategoriesListService class
-
com.hcl.unica.system.integration.service.content.categories.list.AbstractContentCategoriesListService
This is a common base class for
RESTful
as well as Functional implementations oflist-content-categories
service. So, the details covered herein applies to Functional version oflist-content-categories
as well.This class defines the
com.hcl.unica.system.integration.service.gateway.ContentCategoriesListServiceGateway
interface as the service gateway for thelist-content-categories
service. This interface extends fromcom.hcl.unica.system.integration.service.gateway
.ServiceGateway
interface and mandates theContentCategoryListRequest & List<ContentCategory>
objects to be the input and output types for thelist-content-categories
service.
List folders (list-folders
)
The following are the specialized interfaces and classes available for the
list-folders
service:
com.hcl.unica.system.integration.service.folder.list.RestFolderListService
The
com.aem.service.AemFolderListService
class inaem-integration
project is a reference implementation for RESTful list-folders service.AemFolderListService
class extends fromRestFolderListService
class.The
RestFolderListService
class has a type parameter RS, which represents the type of response (post deserialization) received from the remote REST API. In this case it isSimpleSearchResponse
class defined inside theaem-integration
project.RestFolderListService
class implementsRestService
interface and defines thecom.hcl.unica.system.model.request.folder.list.FolderListRequest
class as the type argument RQ forRestService
. Thus, the object ofFolderListRequest
becomes input to all thelist-folders
services (same input is used for Functional counterpart oflist-folders
as well).In addition to defining the input type for the
list-folders
service,RestFolderListService
class also overrides thetransformResponse
method and mandates the return value of this method to be an object ofList<Folder>
type. Folder is a standard type defined in Content Integration SDK.The plugin must extend the implementation of
list-folders
service fromcom.hcl.unica.system.integration.service.folder.list.RestFolderListService
class to be recognized as a valid list-folders service by the Content Integration Framework (Functional counterpart, discussed later, is also a valid choice to extend from).RestFolderListService
extends fromcom.hcl.unica.system.integration.service.folder.list.AbstractFolderListService
class.com.hcl.unica.system.integration.service.folder.list. AbstractFolderListService
This is a common base class for RESTful as well as Functional implementations of
list-folders
service. So, the details covered herein applies to Functional version oflist-folders
as well.This class defines the
com.hcl.unica.system.integration.service.gateway.FolderListServiceGateway
interface as the service gateway for thelist-folders
service. This interface extends fromcom.hcl.unica.system.integration.service.gateway.ServiceGateway
interface and mandates theFolderListRequest
andList<Folder>
objects to be the input and output types for thelist-folders
service.
List contents (list-contents
)
The following are the specialized interfaces and classes available for the list-contents service:
com.hcl.unica.system.integration.service.content.list.RestContentListService
The
com.aem.service.AemContentListServiceclass
inaem-integration
project is a reference implementation for RESTfullist-contents
service.AemContentListServiceclass
class extends fromRestContentListService
class.The
RestContentListService
class has a type parameter RS, which represents the type of response (post deserialization) received from the remote REST API. In this case it isSimpleSearchResponse
class defined inside theaem-integration
project.RestContentListService
class implementsRestService
interface and defines thecom.hcl.unica.system.model.request.content.list.ContentListRequest
class as the type argument RQ forRestService
. Thus, the object ofContentListRequest
becomes input to all thelist-contents
services (same input is used for Functional counterpart oflist-contents
as well).In addition to defining the input type for the
list-contents
service,RestContentListService
class also overrides thetransformResponse
method and mandates the return value of this method to be an object ofContentPage
type. This return type is same as the one used forsimple-search
service.ContentPage
is a standard type defined in Content Integration SDK.The plugin must extend the implementation of
list-contents
service fromcom.hcl.unica.system.integration.service.content.list.RestContentListService
class to be recognized as a validlist-contents
service by the Content Integration Framework (Functional counterpart, discussed later, is also a valid choice to extend from).RestContentListService
extends fromcom.hcl.unica.system.integration.service.content.list.AbstractContentListService
class.com.hcl.unica.system.integration.service.content.list.AbstractContentListService
This is a common base class for RESTful as well as Functional implementations of
list-contents
service. So, the details covered herein applies to Functional version oflist-contents
as well.This class defines the
com.hcl.unica.system.integration.service.gateway.ContentListServiceGateway
interface as the service gateway for thelist-contents
service. This interface extends fromcom.hcl.unica.system.integration.service.gateway.ServiceGateway
interface and mandates theContentListRequest
andContentPage
objects to be the input and output types for thelist-contents
service.
Get content details (get-content-details
)
The following are the specialized interfaces and classes available for the get-content-details service:
com.hcl.unica.system.integration.service.content.details.RestContentDetailsService
The
com.aem.service.AemObjectDetailsService
class inaem-integration
project is a reference implementation for RESTfulget-content-details
service.AemObjectDetailsService
class extends fromRestContentDetailsService
class.The
RestContentDetailsService
class has a type parameter RS, which represents the type of response (post deserialization) received from the remote REST API. In this case it isSimpleSearchResponse
class defined inside theaem-integration
project.RestContentDetailsService
class implementsRestService
interface and defines thecom.hcl.unica.system.model.request.content.details.ContentDetailsRequest
class as the type argument RQ forRestService
. Thus, the object ofContentDetailsRequest
becomes input to all theget-content-details
services (same input is used for Functional counterpart ofget-content-details
as well).In addition to defining the input type for the
get-content-details
service,RestContentDetailsService
class also overrides thetransformResponse
method and mandates the return value of this method to be an object of Presentable type.The plugin must extend the implementation of
get-content-details
service fromcom.hcl.unica.system.integration.service.content.details.RestContentDetailsService
class to be recognized as a validget-content-details
service by the Content Integration Framework (Functional counterpart, discussed later, is also a valid choice to extend from).RestContentDetailsService
extends from thecom.hcl.unica.system.integration.service.content.details.AbstractContentDetailsService
class.com.hcl.unica.system.integration.service.content.details.AbstractContentDetailsService
This is a common base class for RESTful as well as Functional implementations of
get-content-details
service. So, the details covered herein applies to Functional version ofget-content-details
as well.This class defines the
com.hcl.unica.system.integration.service.gateway.ContentDetailsServiceGateway
interface as the service gateway for theget-content-details
service.ServiceGateways
are the means to programmatically define input and output types of the service and facilitate invocation of the services. A closer look at this interface tells us that theget-content-details
service accepts theContentDetailsRequest
object and returns a Presentable object.
Get cognitive analysis (get-cognitive-analysis)
The following are the specialized interfaces and classes available for the get-cognitive-analysis service:
com.hcl.unica.system.integration.service.cognitive.analysis.RestCognitiveAnalysisService
The
com.example.service.rest.ExampleCognitiveAnalysisService
inasset-integration-starter
project is a quick starter implementation for RESTfulget-cognitive-analysis
service.ExampleCognitiveAnalysisService
in class extends fromRestCognitiveAnalysisService
class.The
RestCognitiveAnalysisService
class has a type parameter RS, which represents the type of response (post deserialization) received from the remote REST API. In this case it isCognitiveDetails
class defined inside theasset-integration-starter
project.RestCognitiveAnalysisService
class implementsRestService
interface and defines thecom.hcl.unica.system.model.request.cognitive.analysis.CognitiveAnalysisRequest
class as the type argument RQ forRestService
. Thus, the object ofCognitiveAnalysisRequest
becomes input to all theget-cognitive-analysis
services (same input is used for Functional counterpart as well).In addition to defining the input type for the
get-cognitive-analysis
service,RestCognitiveAnalysisService
class also overrides thetransformResponse
method and mandates the return value of this method to be an object ofcom.hcl.unica.system.model.response.cognitive.analysis.CognitiveAnalysis
type.CognitiveAnalysis
is a standard type defined in Content Integration SDK.The plugin must extend the implementation of
get-cognitive-analysis
service fromcom.hcl.unica.system.integration.service.cognitive.analysis.RestCognitiveAnalysisService
class to be recognized as a validget-cognitive-analysis
service by the Content Integration Framework (Functional counterpart, discussed later, is also a valid choice to extend from).RestCognitiveAnalysisService
extends fromcom.hcl.unica.system.integration.service.cognitive.analysis.AbstractCognitiveAnalysisService
class.com.hcl.unica.system.integration.service.cognitive.analysis.AbstractCognitiveAnalysisService
This is a common base class for RESTful as well as Functional implementations of
get-cognitive-analysis
service. So, the details covered herein applies to Functional version ofget-cognitive-analysis
as well.This class defines the
com.hcl.unica.system.integration.service.gateway.CognitiveAnalysisServiceGateway
interface as the service gateway for theget-cognitive-analysis
service. This interface extends fromcom.hcl.unica.system.integration.service.gateway.ServiceGateway
interface and mandates theCognitiveAnalysisRequest
andCognitiveAnalysis
objects to be the input and output types for theget-cognitive-analysis
service.