Package de.pisa.psa.rst.hdl
Klasse PsaRstApiEvtHdl
java.lang.Object
de.pisa.psa.rst.hdl.PsaRstApiEvtHdl
- Alle implementierten Schnittstellen:
AutoCloseable
- Bekannte direkte Unterklassen:
PsaRstApiEvtHdlIn
,PsaRstApiEvtHdlOut
REST API: event handler
- Seit:
- 21.06.2023
- Autor:
- weiland
-
Verschachtelte Klassen - Übersicht
Verschachtelte KlassenModifizierer und TypKlasseBeschreibungstatic class
Highlighting for EUREKA results -
Feldübersicht
Felder -
Konstruktorübersicht
Konstruktoren -
Methodenübersicht
Modifizierer und TypMethodeBeschreibungvoid
addJsonMixin
(Class<?> target, Class<?> mixin) Mix-in annotations to the JSON generationprotected javax.ws.rs.core.Response
buildResponse
(String json) build the responseprotected de.pisa.psc.srv.dto.PscDto
cloneRecords
(String dto_dsc, Set<String> gid_set, int max) clone records into a data objectvoid
close()
de.pisa.psc.srv.dto.PscDto
fetchContact
(String email, String dto_dsc) fetch a contact based on an email addressprotected javax.ws.rs.core.Response
fetch ERUEKA result and return the JSON responseprotected javax.ws.rs.core.Response
fetchEurekaRecords
(PsaRstApiQue query, Class<? extends PsaRstApiObjBas> object_class) fetch records with the use of EUREKA and return the JSON responsede.pisa.psc.srv.dto.PscDto
fetchIAMContact
(String dto_dsc) fetch a contact based on the IAM email addressprotected de.pisa.psc.srv.dto.PscDto
fetch the record that is defined by the dataobject and GID in the event recordprotected javax.ws.rs.core.Response
fetchRecord
(Class<? extends PsaRstApiObjBas> object_class) fetch a record and return the JSON responseprotected javax.ws.rs.core.Response
fetchRecords
(Class<? extends PsaRstApiObjBas> object_class) fetch records and return the JSON responsefind a contact by the email addressstatic PsaRstApiEvtHdl
getActiveEventHandler
(de.pisa.psc.srv.glb.PscSsn ssn) get the active event handler from a sessionprotected String
get the continuation keygetData()
get the event dataprotected EurekaDtoQuery
get the EUREKA query conditions for the configured data objectprotected PsaRstApiEvtHdl.EurekaHighlighting
get the highlight configuration for the EUREKA searchprotected de.pisa.psa.dto.psa_idx.itf.DocFld
get the field to query with EUREKAprotected String
getExternalCommunicationLanguage
(de.pisa.psc.srv.glb.PscSsn ssn) get the communication language from an external loginprotected String
getFetchRecordKeyField
(de.pisa.psc.srv.dto.PscDto dto) get the key field to search on in fetchRecordprotected de.pisa.psc.srv.dto.PscFld
getField
(de.pisa.psc.srv.dto.PscDto dto, String field_name, List<PsaRstApiMapFld.MapEntry> field_mapping) get the data object field for a JSON field nameprotected String
get the session user from the IAM tokenboolean
are empty values included in the JSON?protected int
getMaxRecords
(de.pisa.psc.srv.dto.PscDto dto) get the maximum number of records to fetchgetMessage
(String descriptor, String... parameters) get a message in the language of the requestprotected PsaRstApiQue
getQuery()
get the query from the event datade.pisa.psc.srv.glb.PscSsn
getSsn()
get a sessionprotected String
get the user for the database sessionprotected de.pisa.psc.srv.glb.PscSsn
get a SYSTEM sessionget the value buffer of this event handlerabstract javax.ws.rs.core.Response
Handle the eventboolean
check if the session user is based on IAMprotected javax.ws.rs.core.Response
loadRecord
(de.pisa.psc.srv.dto.PscDto dto, int row, Class<? extends PsaRstApiObjBas> object_class) load a record into to a JSON responsemap a query string to a string that can be used by the data objectde.pisa.psc.srv.dto.PscDto
create a new data objectprotected PsaRstApiObjBas
newObject
(Class<? extends PsaRstApiObjBas> object_class) create a new JSON objectprotected <T> PsaRstApiObjLis
<T> create a new result list objectboolean
don't log the eventprotected EurekaResult
queryEureka
(String query, String[] dto_query, String key_001, String key_002, String key_003, PsaRstApiEvtHdl.EurekaHighlighting eureka_highlighting) query the EUREKA indexprotected void
queryEurekaRecords
(PsaRstApiQue query, de.pisa.psc.srv.dto.PscDto dto, de.pisa.psa.dto.PsaRecClo rec_clo, List<PsaRstApiMapFld.MapEntry> field_mapping) set queries for EUREKAprotected de.pisa.psc.srv.dto.PscDto
set the primary key query on a data objectprotected de.pisa.psc.srv.dto.PscDto
queryRecords
(PsaRstApiQue query, Class<?> object_class) set the query on a data object based on the request queryprotected void
queryRecordsAddSort
(PsaRstApiQue query, de.pisa.psc.srv.dto.PscDto dto, List<PsaRstApiMapFld.MapEntry> field_mapping) Add the sorting to a data objectprotected void
queryRecordsSetQuery
(PsaRstApiQue query, de.pisa.psc.srv.dto.PscDto dto, List<PsaRstApiMapFld.MapEntry> field_mapping) Set the queries on a data objectstatic void
setActiveEventHandler
(de.pisa.psc.srv.glb.PscSsn ssn, PsaRstApiEvtHdl handler) set the active event handler for a sessionprotected void
set the event language based on the IAM loginvoid
setJsonIncludeEmpty
(boolean include) include empty values in the JSON?convert an object to JSON
-
Felddetails
-
Max_Records
protected int Max_Recordsthe maximum number of records that are returned -
Default_User
default session user -
Default_External_Language
the default language for external logins -
Force_IAM_User
protected boolean Force_IAM_Userif IAM is used, the email should belong to an unique user
-
-
Konstruktordetails
-
PsaRstApiEvtHdl
Constructor- Parameter:
data
- event data
-
-
Methodendetails
-
handleEvent
Handle the event- Gibt zurück:
- response
- Löst aus:
Exception
-
setActiveEventHandler
set the active event handler for a session- Parameter:
ssn
- sessionhandler
-
-
getActiveEventHandler
get the active event handler from a session- Parameter:
ssn
- session- Gibt zurück:
- handler instance. null if currently no active event handler
-
noEventLogging
public boolean noEventLogging()don't log the event- Gibt zurück:
- if true the event and all logs will be deleted
-
getSsn
get a session- Gibt zurück:
- session
- Löst aus:
Exception
-
getSysSsn
get a SYSTEM session- Gibt zurück:
- session
- Löst aus:
Exception
-
getSsnUsr
get the user for the database session- Gibt zurück:
- user name
- Löst aus:
Exception
-
getIAMUser
get the session user from the IAM token- Gibt zurück:
- user name, null if no IAM token used
- Löst aus:
Exception
-
setExternalLanguage
set the event language based on the IAM login- Löst aus:
Exception
-
getExternalCommunicationLanguage
get the communication language from an external login- Parameter:
ssn
- session- Gibt zurück:
- language identifier
- Löst aus:
Exception
-
findEmail
find a contact by the email address- Parameter:
email
- email to search- Gibt zurück:
- set of contact gids that are associated to this email address
-
isIAMUser
public boolean isIAMUser()check if the session user is based on IAM- Gibt zurück:
- true if IAM user
-
fetchIAMContact
fetch a contact based on the IAM email address- Parameter:
dto_dsc
- descriptor of the contact data object- Gibt zurück:
- contact data abject with one row
- Löst aus:
Exception
- if the contact was not found or is ambiguous
-
fetchContact
fetch a contact based on an email address- Parameter:
email
- email address to searchdto_dsc
- descriptor of the contact data object- Gibt zurück:
- contact data abject with one row
- Löst aus:
Exception
- if the contact was not found or is ambiguous
-
cloneRecords
protected de.pisa.psc.srv.dto.PscDto cloneRecords(String dto_dsc, Set<String> gid_set, int max) throws Exception clone records into a data object- Parameter:
dto_dsc
- the descriptor of the data objectgid_set
- a set of PSC_GIDsmax
- maximum number of records to clone- Gibt zurück:
- the data object with the records
- Löst aus:
Exception
-
getData
get the event data- Gibt zurück:
- data
-
getMessage
get a message in the language of the request- Parameter:
descriptor
- message descriptorparameters
- parameters (placeholders) of the message- Gibt zurück:
- message text. may be empty if the message is not found
- Löst aus:
Exception
-
setJsonIncludeEmpty
public void setJsonIncludeEmpty(boolean include) include empty values in the JSON?- Parameter:
include
- true to include empty values (default=false)
-
getJsonIncludeEmpty
public boolean getJsonIncludeEmpty()are empty values included in the JSON?- Gibt zurück:
- true if empty values are included
-
addJsonMixin
Mix-in annotations to the JSON generation- Parameter:
target
- Class (or interface) whose annotations to effectively overridemixin
- Class (or interface) whose annotations are to be "added" to target's annotations, overriding as necessary
-
toJson
convert an object to JSON- Parameter:
object
- object to convert- Gibt zurück:
- JSON
- Löst aus:
Exception
-
getValueBuffer
get the value buffer of this event handler- Gibt zurück:
- buffer
-
close
- Angegeben von:
close
in SchnittstelleAutoCloseable
- Löst aus:
Exception
- Siehe auch:
-
newDto
create a new data object- Parameter:
dsc
- descriptor of the data object- Gibt zurück:
- data object
- Löst aus:
Exception
-
newObject
create a new JSON object- Parameter:
object_class
- class of the JSON object- Gibt zurück:
- object
- Löst aus:
Exception
-
fetchRecord
fetch the record that is defined by the dataobject and GID in the event record- Gibt zurück:
- dataobject with the record
- Löst aus:
Exception
javax.ws.rs.WebApplicationException
- is the record was not found or more than one record was found
-
getFetchRecordKeyField
get the key field to search on in fetchRecord- Parameter:
dto
- data object- Gibt zurück:
- field descriptor
-
fetchRecord
protected javax.ws.rs.core.Response fetchRecord(Class<? extends PsaRstApiObjBas> object_class) throws Exception fetch a record and return the JSON response- Parameter:
object_class
- class of the JSON object- Gibt zurück:
- response
- Löst aus:
Exception
-
loadRecord
protected javax.ws.rs.core.Response loadRecord(de.pisa.psc.srv.dto.PscDto dto, int row, Class<? extends PsaRstApiObjBas> object_class) throws Exception load a record into to a JSON response- Parameter:
dto
- data objectrow
- row to loadobject_class
- class of the JSON object- Gibt zurück:
- response
- Löst aus:
Exception
-
buildResponse
build the response- Parameter:
json
- entity data- Gibt zurück:
- a 200 OK status with an application/json entity
-
queryRecords
protected de.pisa.psc.srv.dto.PscDto queryRecords(PsaRstApiQue query, Class<?> object_class) throws Exception set the query on a data object based on the request query- Parameter:
query
- queryobject_class
- class of JSON object- Gibt zurück:
- data object with a query and an order
- Löst aus:
Exception
-
queryRecordsSetQuery
protected void queryRecordsSetQuery(PsaRstApiQue query, de.pisa.psc.srv.dto.PscDto dto, List<PsaRstApiMapFld.MapEntry> field_mapping) throws Exception Set the queries on a data object- Parameter:
query
- querydto
- data objectfield_mapping
- field mapping- Löst aus:
Exception
-
mapQuery
protected Optional<String> mapQuery(de.pisa.psc.srv.dto.PscDto dto, de.pisa.psc.srv.dto.PscFld field, String query) throws Exception map a query string to a string that can be used by the data object- Parameter:
dto
- data objectfield
- fieldquery
- query- Gibt zurück:
- mapped query
- Löst aus:
Exception
-
queryRecordsAddSort
protected void queryRecordsAddSort(PsaRstApiQue query, de.pisa.psc.srv.dto.PscDto dto, List<PsaRstApiMapFld.MapEntry> field_mapping) throws de.pisa.psc.srv.glb.PscExc Add the sorting to a data object- Parameter:
query
- querydto
- data objectfield_mapping
- field mapping- Löst aus:
de.pisa.psc.srv.glb.PscExc
-
queryRecord
set the primary key query on a data object- Gibt zurück:
- new data object with the query
- Löst aus:
Exception
-
getQuery
get the query from the event data- Gibt zurück:
- query
- Löst aus:
Exception
-
getContinuation
get the continuation key- Gibt zurück:
- key
- Löst aus:
Exception
-
fetchRecords
protected javax.ws.rs.core.Response fetchRecords(Class<? extends PsaRstApiObjBas> object_class) throws Exception fetch records and return the JSON response- Parameter:
object_class
- class of the JSON object- Gibt zurück:
- response
- Löst aus:
Exception
-
getMaxRecords
get the maximum number of records to fetch- Parameter:
dto
- data object to fetch- Gibt zurück:
- number of records
- Löst aus:
Exception
-
newPsaRstApiObjLis
create a new result list object- Typparameter:
T
- type of the objects in the list- Gibt zurück:
- list
-
fetchEurekaRecords
protected javax.ws.rs.core.Response fetchEurekaRecords(PsaRstApiQue query, Class<? extends PsaRstApiObjBas> object_class) throws Exception fetch records with the use of EUREKA and return the JSON response- Parameter:
query
- queryobject_class
- class of the JSON object- Gibt zurück:
- response
- Löst aus:
Exception
-
queryEurekaRecords
protected void queryEurekaRecords(PsaRstApiQue query, de.pisa.psc.srv.dto.PscDto dto, de.pisa.psa.dto.PsaRecClo rec_clo, List<PsaRstApiMapFld.MapEntry> field_mapping) throws Exception set queries for EUREKA- Parameter:
query
- querydto
- target data objectrec_clo
- record clonerfield_mapping
- field mapping- Löst aus:
Exception
-
getEurekaHighlighting
get the highlight configuration for the EUREKA search- Gibt zurück:
- configuration
- Löst aus:
Exception
-
fetchEureka
fetch ERUEKA result and return the JSON response- Gibt zurück:
- response
- Löst aus:
Exception
-
getEurekaDtoQuery
get the EUREKA query conditions for the configured data object- Gibt zurück:
- query
- Löst aus:
Exception
-
queryEureka
protected EurekaResult queryEureka(String query, String[] dto_query, String key_001, String key_002, String key_003, PsaRstApiEvtHdl.EurekaHighlighting eureka_highlighting) throws Exception query the EUREKA index- Parameter:
query
- query stringdto_query
- dataobject querykey_001
- KEY_001 querykey_002
- KEY_002 querykey_003
- KEY_003 queryeureka_highlighting
- highlighting configuration for the occurrences in the preview- Gibt zurück:
- search result
- Löst aus:
Exception
-
getEurekaQueryField
protected de.pisa.psa.dto.psa_idx.itf.DocFld getEurekaQueryField()get the field to query with EUREKA- Gibt zurück:
- document field
-
getField
protected de.pisa.psc.srv.dto.PscFld getField(de.pisa.psc.srv.dto.PscDto dto, String field_name, List<PsaRstApiMapFld.MapEntry> field_mapping) throws de.pisa.psc.srv.glb.PscExc get the data object field for a JSON field name- Parameter:
dto
- data objectfield_name
- JSON field namefield_mapping
- field mapping- Gibt zurück:
- field
- Löst aus:
de.pisa.psc.srv.glb.PscExc
javax.ws.rs.ClientErrorException
- if the field was not found
-