= Presentation Layer SPI

:Notice: Licensed to the Apache Software Foundation (ASF) under one or more contributor license agreements. See the NOTICE file distributed with this work for additional information regarding copyright ownership. The ASF licenses this file to you under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at. http://www.apache.org/licenses/LICENSE-2.0 . Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR  CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.
:page-partial:


The persistence layer SPIs influence how the framework persists domain objects, for example controlling how to create an audit log of changes to domain objects.


.Presentation Layer SPI
[cols="2m,4a",options="header"]
|===

|SPI
|Description


|xref:refguide:applib:index/services/conmap/ContentMappingService.adoc[ContentMappingService]
|(Attempt to) map the returned data into the representation required by the client's HTTP `Accept` header.

The framework will call all available implementations until a mapping is made (chain of responsibility pattern).
The framework itself provides a couple of implementations:

* xref:refguide:applib:index/services/commanddto/conmap/ContentMappingServiceForCommandDto.adoc[ContentMappingServiceForCommandDto]
* xref:refguide:applib:index/services/commanddto/conmap/ContentMappingServiceForCommandsDto.adoc[ContentMappingServiceForCommandsDto]



|xref:refguide:applib:index/services/userreg/EmailNotificationService.adoc[EmailNotificationService]
|Notify a user during xref:refguide:applib:index/services/userreg/UserRegistrationService.adoc[self-registration] of users.


|xref:refguide:applib:index/services/error/ErrorReportingService.adoc[ErrorReportingService]
|Record details of an error occurring in the system (eg in an external incident recording system such as JIRA), and return a more friendly (jargon-free) message to display to the end user, with optional reference (eg `XXX-1234`).


|xref:refguide:applib:index/services/exceprecog/ExceptionRecognizerService.adoc[ExceptionRecognizerService]
|Convert certain exceptions (eg foreign or unique key violation in the database) into a format that can be rendered to the end-user.

All available implementations are called (chain of responsibility pattern).



|xref:refguide:applib:index/services/hint/HintIdProvider.adoc[HintIdProvider]
|Provide a "logical" identity for view models such that UI hints can be stored for them.


|xref:refguide:applib:index/services/hint/HintStore.adoc[HintStore]
|Stores UI hints on a per-object basis.
For example, the viewer remembers which tabs are selected, and for collections which view is selected (eg table or hidden), which page of a table to render, or whether "show all" (rows) is toggled.



|xref:refguide:applib:index/services/publishing/spi/PageRenderSubscriber.adoc[PageRenderSubscriber]
|Hook to allow work to be performed before rendering the page.
For example, this could be used for simple metric gathering.
Or, it could be used to preload data in bulk to avoid N+1 problems.



|xref:refguide:applib:index/services/routing/RoutingService.adoc[RoutingService]
|Return an alternative object than that returned by an action.



|xref:refguide:applib:index/services/tablecol/TableColumnOrderService.adoc[TableColumnOrderService]
|Allows the columns of a parented or standalone table to be reordered, based upon the parent object, collection id and type of object in the collection.

|xref:refguide:applib:index/services/tablecol/TableColumnVisibilityService.adoc[TableColumnVisibilityService]
|Filters the columns of a parented or standalone tables.

xref:security:secman:about.adoc[SecMan] provides an implementation of this service that filters out columns based on security permissions.



|xref:refguide:applib:index/services/i18n/TranslationService.adoc[TranslationService]
|Translate an app's UI, messages and exceptions for the current user (as per the language provided by xref:refguide:applib:index/services/i18n/LanguageProvider.adoc[LanguageProvider].


|xref:refguide:applib:index/services/urlencoding/UrlEncodingService.adoc[UrlEncodingService]
|Converts strings into a form safe for use within a URL.
Used to convert view models mementos into usable URL form.


|xref:refguide:viewer:index/commons/applib/services/userprof/UserProfileUiService.adoc[UserProfileUiService]
|Obtain an alternative (usually enriched/customized) name for the current user, to render in the UI.

|===


