You are viewing a plain text version of this content. The canonical link for it is here.
Posted to user@syncope.apache.org by Colm O hEigeartaigh <co...@apache.org> on 2016/07/14 16:48:30 UTC

User/count?

Hi,

Is it possible to obtain a count of the total users in Syncope 2.0.0?
Previously you could do GET /users/count, but it doesn't seem to be working
in Syncope 2.0.0 unless I'm mistaken.

Thanks,

Colm.


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: User/count?

Posted by Colm O hEigeartaigh <co...@apache.org>.
Ah I see thanks. So to get the total count using the REST API you can do
something like get the first user with:

http://localhost:9080/syncope/rest/users?page=1&size=1

+ parse the totalCount field.

Colm.

On Tue, Jul 19, 2016 at 3:42 PM, Francesco Chicchiriccò <ilgrosso@apache.org
> wrote:

> On 19/07/2016 16:41, Colm O hEigeartaigh wrote:
>
> Thanks Francesco. Unless I'm mistaken though, you're calling
> "getTotalCount" on the total list of users that is returned
> (PagedResult<UserTO> )? What if you wanted to just find out the total count
> of users, without having to actually download all the user attributes etc.
> (so if you have a very large number of users).
>
>
> As you can see I am asking for page 1 / size 1, so actually only the very
> first user is returned.
> Regards.
>
>
> On Fri, Jul 15, 2016 at 3:12 PM, Francesco Chicchiriccò <
> ilgrosso@apache.org> wrote:
>
>> On 14/07/2016 18:51, Francesco Chicchiriccò wrote:
>>
>>> Il 14 luglio 2016 18:48:30 CEST, Colm O hEigeartaigh <
>>> coheigea@apache.org> ha scritto:
>>>
>>>> Hi,
>>>>
>>>> Is it possible to obtain a count of the total users in Syncope 2.0.0?
>>>> Previously you could do GET /users/count, but it doesn't seem to be
>>>> working
>>>> in Syncope 2.0.0 unless I'm mistaken.
>>>>
>>> Hi,
>>> look at UserITCase and SearchITCase (can't access the source code right
>>> now).
>>>
>>
>> It's something like as
>>
>> syncopeClient.getService(UserService.class).
>>                 search(new
>> AnyQuery.Builder().realm(realm).page(1).size(1).build()).
>>                 getTotalCount()
>>
>> HTH
>>
>> Regards.
>>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellencehttp://www.tirasa.net/
>
> Involved at The Apache Software Foundation:
> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
> CXF Committer, OpenJPA Committer, PonyMail PPMChttp://home.apache.org/~ilgrosso/
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: User/count?

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 19/07/2016 16:41, Colm O hEigeartaigh wrote:
> Thanks Francesco. Unless I'm mistaken though, you're calling 
> "getTotalCount" on the total list of users that is returned 
> (PagedResult<UserTO> )? What if you wanted to just find out the total 
> count of users, without having to actually download all the user 
> attributes etc. (so if you have a very large number of users).

As you can see I am asking for page 1 / size 1, so actually only the 
very first user is returned.
Regards.

>
> On Fri, Jul 15, 2016 at 3:12 PM, Francesco Chicchiricc� 
> <ilgrosso@apache.org <ma...@apache.org>> wrote:
>
>     On 14/07/2016 18:51, Francesco Chicchiricc� wrote:
>
>         Il 14 luglio 2016 18:48:30 CEST, Colm O hEigeartaigh
>         <coheigea@apache.org <ma...@apache.org>> ha scritto:
>
>             Hi,
>
>             Is it possible to obtain a count of the total users in
>             Syncope 2.0.0?
>             Previously you could do GET /users/count, but it doesn't
>             seem to be
>             working
>             in Syncope 2.0.0 unless I'm mistaken.
>
>         Hi,
>         look at UserITCase and SearchITCase (can't access the source
>         code right now).
>
>
>     It's something like as
>
>     syncopeClient.getService(UserService.class).
>                     search(new
>     AnyQuery.Builder().realm(realm).page(1).size(1).build()).
>                     getTotalCount()
>
>     HTH
>
>     Regards.
>
-- 
Francesco Chicchiricc�

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/


Re: User/count?

Posted by Colm O hEigeartaigh <co...@apache.org>.
Thanks Francesco. Unless I'm mistaken though, you're calling
"getTotalCount" on the total list of users that is returned
(PagedResult<UserTO> )? What if you wanted to just find out the total count
of users, without having to actually download all the user attributes etc.
(so if you have a very large number of users).

Colm.

On Fri, Jul 15, 2016 at 3:12 PM, Francesco Chicchiriccò <ilgrosso@apache.org
> wrote:

> On 14/07/2016 18:51, Francesco Chicchiriccò wrote:
>
>> Il 14 luglio 2016 18:48:30 CEST, Colm O hEigeartaigh <co...@apache.org>
>> ha scritto:
>>
>>> Hi,
>>>
>>> Is it possible to obtain a count of the total users in Syncope 2.0.0?
>>> Previously you could do GET /users/count, but it doesn't seem to be
>>> working
>>> in Syncope 2.0.0 unless I'm mistaken.
>>>
>> Hi,
>> look at UserITCase and SearchITCase (can't access the source code right
>> now).
>>
>
> It's something like as
>
> syncopeClient.getService(UserService.class).
>                 search(new
> AnyQuery.Builder().realm(realm).page(1).size(1).build()).
>                 getTotalCount()
>
> HTH
>
> Regards.
>
> --
> Francesco Chicchiriccò
>
> Tirasa - Open Source Excellence
> http://www.tirasa.net/
>
> Involved at The Apache Software Foundation:
> member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
> CXF Committer, OpenJPA Committer, PonyMail PPMC
> http://home.apache.org/~ilgrosso/
>
>


-- 
Colm O hEigeartaigh

Talend Community Coder
http://coders.talend.com

Re: User/count?

Posted by Francesco Chicchiriccò <il...@apache.org>.
On 14/07/2016 18:51, Francesco Chicchiricc� wrote:
> Il 14 luglio 2016 18:48:30 CEST, Colm O hEigeartaigh <co...@apache.org> ha scritto:
>> Hi,
>>
>> Is it possible to obtain a count of the total users in Syncope 2.0.0?
>> Previously you could do GET /users/count, but it doesn't seem to be
>> working
>> in Syncope 2.0.0 unless I'm mistaken.
> Hi,
> look at UserITCase and SearchITCase (can't access the source code right now).

It's something like as

syncopeClient.getService(UserService.class).
                 search(new 
AnyQuery.Builder().realm(realm).page(1).size(1).build()).
                 getTotalCount()

HTH

Regards.

-- 
Francesco Chicchiricc�

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer, PonyMail PPMC
http://home.apache.org/~ilgrosso/


Re: User/count?

Posted by Francesco Chicchiriccò <il...@apache.org>.
Il 14 luglio 2016 18:48:30 CEST, Colm O hEigeartaigh <co...@apache.org> ha scritto:
>Hi,
>
>Is it possible to obtain a count of the total users in Syncope 2.0.0?
>Previously you could do GET /users/count, but it doesn't seem to be
>working
>in Syncope 2.0.0 unless I'm mistaken.

Hi,
look at UserITCase and SearchITCase (can't access the source code right now).

Regards.

-- 
Francesco Chicchiricc�

Tirasa - Open Source Excellence
http://www.tirasa.net/

Involved at The Apache Software Foundation:
member, Syncope PMC chair, Cocoon PMC, Olingo PMC,
CXF Committer, OpenJPA Committer
http://home.apache.org/~ilgrosso/