SIF 3 Service Paths QBE Service Paths Query
SIF 3 Service Paths & QBE Service Paths & Query By Example (QBE): Query Mechanism Presented by: Joerg Huber
2 Service Paths ¡ ¡ ¡ What is a Service Path? Base URL Format & Components Other URL Components Limitations How do the Frameworks work with Service Paths? l l Consumer Provider Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
3 What is a Service Path ¡ ¡ It is a Query Mechanism! Allows retrieval of ‘Associated’ Objects (i. e. All Students at a School) Standard REST paradigm Optimises data retrieval l ¡ ¡ One query vs. many queries Standard notation, easy to read Query condition is part of the URL. Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
4 Base URL Format & Components Example: Get Students at School <base. URL>/x. Schools/<ref. Id>/x. Students Association Object Ref. Id of the School Object to be returned Query Condition: ‘where School. Ref. Id = <refid>’ Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
5 Other URL Components etc. Service Paths support all standard URL components of any Object Service: ¡ Can be ‘nested’ l l ¡ ¡ ¡ Above will return daily attendances for a given student at a given school. Matrix Parameters (zone. Id, contex. Id) Query Parameters (navigation. Page, navigation. Page. Size) HTTP Headers (request. Id) l ¡ …/x. Schools/<ref. Id>/x. Students/<ref. Id>/x. Daily. Attendances Exception: service. Type = SERVICEPATH No Payload l Not valid for HTTP GET! Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
6 Limitations: Query Only ¡ ¡ Can only Query Data (HTTP GET). No create, update or delete No Events are sent to a Service Path Only available right in ACL will be “QUERY” HTTP Header ‘service. Type’ must be set to ‘SERVICEPATH’ l Not to worry about if frameworks are used. Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
7 Frameworks & Service Paths ¡ ¡ Available in Java &. Net version Consumer: Part of Abstract Consumer l ¡ consumer. retrieve. By. Service. Path(…) Provider: Implement Query. Provider Interface l Direct Environment Template Entry <service name=“x. Schools/{}/x. Students" type="SERVICEPATH"> <rights> <right type="QUERY">APPROVED</right> </rights> </service> l Implemented by class of “Object to be Returned” Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
8 What is Query By Example ¡ ¡ It is a Query Mechanism! Allows retrieval of Objects based on a ‘Sample Object’. Service of “Sample Object” serves the query. Query Condition is given by a standard SIF Object: <x. Student> <name> <type>Legal. Name</type> <family. Name>Jones</family. Name> <name> </x. Student> => Give me all students with legal family name of Jones. Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
9 What is Query By Example cont. Payload and Query Condition Interpretation: ¡ ¡ Each element in the payload forms a specific query condition. The conjunction between the conditions is 'AND‘. Comparator for all types except strings is EQUAL. Strings have a LIKE with the only supported wildcard of '%': l 'ABC': No wildcards in the value is equivalent to an 'EQUAL'. l '%ABC': Wildcard at the start of the value means 'ENDS IN'. In this case anything that ENDS IN 'ABC'. l 'ABC%': Wildcard at the end of the value means 'STARTS WITH'. In this case anything that STARTS WITH 'ABC'. l '%ABC%': Wildcard at the start and end of the value means 'CONTAINS'. In this case anything that CONTAINS 'ABC'. l 'AB%C': Wildcard anywhere in the value means 'STARTS WITH' and 'ENDS IN'. In this case anything that STARTS WITH 'AB' followed by any number of characters and ENDS IN 'C' Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
1 0 URL Components, GET vs. POST. QBE supports all standard URL components of any Object Service: ¡ ¡ Matrix Parameters (zone. Id, contex. Id) Query Parameters (navigation. Page, navigation. Page. Size) HTTP Headers (request. Id, generator. ID etc. ) BUT it has a Payload!! l l Not valid for HTTP GET! It uses a HTTP POST with HTTP Header of method. Override=GET => Abstracted with SIF 3 Frameworks. Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
1 1 Frameworks & Service Paths ¡ ¡ Available in Java &. Net version Consumer: Part of Abstract Consumer l ¡ consumer. retrieve. By. QBE(…) Provider: Implement Query. Provider Interface If not supported then throw Unsupported. Query. Exception. ¡ ACL: Direct Environment Template Entry l l l Part of standard Object Service (no changes) “QUERY” right must be “APPROVED”. <rights> <right type="QUERY">APPROVED</right> </rights> Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
1 2 Question Time… Questions? Exercise 6: Service Path (Consumer & Provider) Training Course SIF 3: Service Paths November 20 © Systemic Pty Ltd
- Slides: 12