syncope-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Sergey Beryozkin <sberyoz...@gmail.com>
Subject Re: AnyObjects query
Date Wed, 28 Jun 2017 08:59:32 GMT
Hi Francesco

Thanks for the explanation.

I see why the example I pointed to won't be applicable to Syncope.
In that case when the linked beans are available, CXF 
AbstractSearchParser will prepare a bean tree which would be initialized 
with the values from the expression like "a.b.c" and the OOB visitor 
like JPA2 one takes care of dealing with these linked beans.

In the SearchBean case it is up to the custom visitor whether to react 
to the '.'s or not where a '.' indicates that for ex 'a' needs to have 
'b' with a property 'c'.

Do you reckon Syncope custom visitors can be updated to support such 
queries ? Not sure about ElasticSearch but for SQL it should probably be 
possible...

Thanks, Sergey

On 28/06/17 09:46, Francesco Chicchiriccò wrote:
> On 28/06/2017 10:41, Sergey Beryozkin wrote:
>> Hi
>>
>> I think something similar works for a CXF FIQL JPA2 visitor, for example:
>>
>> https://github.com/apache/cxf/blob/master/rt/rs/extensions/search/src/test/java/org/apache/cxf/jaxrs/ext/search/jpa/JPATypedQueryVisitorFiqlTest.java#L65

>>
>>
>> (find the books which have been revied done by Ted)
> 
> Hi Sergey,
> that would work if we had straight beans as in the linked sample.
> 
> Syncope data model is instead much more involved as new schema for 
> attributes can be defined at runtime: this is the reason why we have 
> SearchCondVisitor [1] translating FIQL into our internal search 
> conditions, which serve as input to one of available implementations of 
> AnySearchDAO like as the default one based on SQL views [2] and another 
> relying on Elasticsearch-based [3].
> 
> Regards.
> 
> [1] 
> https://github.com/apache/syncope/blob/2_0_X/core/persistence-api/src/main/java/org/apache/syncope/core/persistence/api/search/SearchCondVisitor.java

> 
> [2] 
> https://github.com/apache/syncope/blob/2_0_X/core/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/JPAAnySearchDAO.java

> 
> [3] 
> https://github.com/apache/syncope/blob/2_0_X/ext/elasticsearch/persistence-jpa/src/main/java/org/apache/syncope/core/persistence/jpa/dao/ElasticsearchAnySearchDAO.java

> 
> 
>> On 28/06/17 08:54, Francesco Chicchiriccò wrote:
>>> On 27/06/2017 18:18, Colm O hEigeartaigh wrote:
>>>> Thanks Francesco! On a related note, let's say I have some AnyObjects
>>>> (Printer) with a relationship to other AnyObjects (Cartridge). Now I 
>>>> want
>>>> to search for a Printer which has a relationship with a Cartridge 
>>>> with a
>>>> "colour" attribute of "blue". Is there a way to do this via a FIQL
>>>> expression?
>>>
>>> No, you cannot express such condition ATM; you could do for example:
>>>
>>> SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").
>>> inRelationships("ce75249b-76e4-44b6-88ae-0841846faceb").
>>>                  and().is("colour").equalTo("blue").query();
>>>
>>> which translates to FIQL
>>>
>>> $type==PRINTER;$relationships==ce75249b-76e4-44b6-88ae-0841846faceb;colour==blue

>>>
>>>
>>> but this would rather search for blue printers having a relationship 
>>> with an any object with key 'ce75249b-76e4-44b6-88ae-0841846faceb'.
>>>
>>> or alternatively
>>>
>>> SyncopeClient.getAnyObjectSearchConditionBuilder("PRINTER").
>>>                  inRelationshipTypes("WITH_CARTDRIGE").
>>>                  and().is("color").equalTo("blue").query();
>>>
>>> which translates to FIQL
>>>
>>> $type==PRINTER;$relationshipTypes==WITH_CARTDRIGE;color==blue
>>>
>>> but this would rather search for blue printers having a relationship 
>>> on type  WITH_CARTDRIGE.
>>>
>>> Regards.
>>>
>>>> On Tue, Jun 27, 2017 at 4:29 PM, Francesco Chicchiriccò 
>>>> <ilgrosso@apache.org> wrote:
>>>>
>>>>> On 27/06/2017 17:24, Colm O hEigeartaigh wrote:
>>>>>
>>>>>> Hi all,
>>>>>>
>>>>>> How can I retrieve a list of AnyObjects? The following returns a
400:
>>>>>>
>>>>>> curl -I -X GET -u admin:password
>>>>>> http://localhost:9080/syncope/rest/anyObjects
>>>>>>
>>>>> You must at least provide the AnyType, e.g.
>>>>>
>>>>> http://localhost:9080/syncope/rest/anyObjects;fiql=%24type%3D%3DPRINTER

>>>>>
>>>>>
>>>>> Regards.
>>>
>>
>>
> 

Mime
View raw message