Re: [Dev] Some values are missing in governance registry property search

2017-11-23 Thread Danesh Kuruppu
Hi Megala,

+1. Thanks for the fix. reviewed and merged the PR.

Thanks
Danesh

On Wed, Nov 22, 2017 at 11:11 PM, Megala Uthayakumar 
wrote:

> Hi All,
>
> I am working on adding access control support to APIM 2.1.x,. For this
> feature, we are making use of the registry property-search for the getting
> relevant resources based on user roles. While doing the implementation, I
> came across following behaviour,
>
> Even though if we add multiple versions of an API, only one version of
> that particular API is visibile in the publisher. While analyzing this
> issue, I understood this issue is only happening if we are using
> PaginationContext init, with the sort property "overview_name" (i.e. API
> Name). This has happened because when finally sorting the merged attribute
> search result and property search result, we are using the TreeSet in [1]
> and in TreeSet if comparator [2] returns 0, it will be thought as duplicate
> and that value will be replaced TreeSet. Since in API Manager case, both
> the versions of API will have the same "overview_name" and the comparator
> will return the value as 0, so only one value will be given as result. In
> order to overcome this, we need to return some other value, whenever the
> comparison value is  0.
>
> I have created an github issue for this [3] and did a fix for this issue[
> 4]. I tested this fix locally and it seems to be working fine.
>
> Appreciate if someone from registry team can review and merge this.
>
> [1] https://github.com/wso2/carbon-governance/blob/master/
> components/governance/org.wso2.carbon.governance.api/
> src/main/java/org/wso2/carbon/governance/api/util/
> GovernanceUtils.java#L2055
> [2] https://github.com/wso2/carbon-governance/blob/master/
> components/governance/org.wso2.carbon.governance.api/
> src/main/java/org/wso2/carbon/governance/api/util/
> GovernanceUtils.java#L2056
> [3] https://github.com/wso2/carbon-governance/issues/297
> [4] https://github.com/wso2/carbon-governance/pull/298
>
> Thanks.
>
> Regards,
> Megala
> --
> Megala Uthayakumar
>
> Software Engineer
> Mobile : 0779967122
>



-- 

*Danesh Kuruppu*
Senior Software Engineer | WSO2

Email: dan...@wso2.com
Mobile: +94 (77) 1690552
Web: WSO2 Inc 
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Some values are missing in governance registry property search

2017-11-22 Thread Megala Uthayakumar
Hi Roshan,

None of the APIM released versions are affected by this issue. AFAIK, none
of the released versions make use of "property" search for retrieving API
list, rather it depend on "attribute" search. We are changing the way, we
are retrieving the API list for this feature and as per the design
discussions, we are using property search to achieve this requirement.

Thanks.


On Thu, Nov 23, 2017 at 6:50 AM, roshan wijesena 
wrote:

> "Even though if we add multiple versions of an API, only one version of
> that particular API is visibile in the publisher."
>
> Which version is this? I tested in 2.1.0 i can see all versioned apis in
> publisher, is this happening when you have more than 10 APIs?
>
> On Thu, Nov 23, 2017 at 4:41 AM, Megala Uthayakumar 
> wrote:
>
>> Hi All,
>>
>> I am working on adding access control support to APIM 2.1.x,. For this
>> feature, we are making use of the registry property-search for the getting
>> relevant resources based on user roles. While doing the implementation, I
>> came across following behaviour,
>>
>> Even though if we add multiple versions of an API, only one version of
>> that particular API is visibile in the publisher. While analyzing this
>> issue, I understood this issue is only happening if we are using
>> PaginationContext init, with the sort property "overview_name" (i.e. API
>> Name). This has happened because when finally sorting the merged attribute
>> search result and property search result, we are using the TreeSet in [1]
>> and in TreeSet if comparator [2] returns 0, it will be thought as duplicate
>> and that value will be replaced TreeSet. Since in API Manager case, both
>> the versions of API will have the same "overview_name" and the comparator
>> will return the value as 0, so only one value will be given as result. In
>> order to overcome this, we need to return some other value, whenever the
>> comparison value is  0.
>>
>> I have created an github issue for this [3] and did a fix for this issue[
>> 4]. I tested this fix locally and it seems to be working fine.
>>
>> Appreciate if someone from registry team can review and merge this.
>>
>> [1] https://github.com/wso2/carbon-governance/blob/master/co
>> mponents/governance/org.wso2.carbon.governance.api/src/
>> main/java/org/wso2/carbon/governance/api/util/GovernanceUtils.java#L2055
>> [2] https://github.com/wso2/carbon-governance/blob/master/co
>> mponents/governance/org.wso2.carbon.governance.api/src/
>> main/java/org/wso2/carbon/governance/api/util/GovernanceUtils.java#L2056
>> [3] https://github.com/wso2/carbon-governance/issues/297
>> [4] https://github.com/wso2/carbon-governance/pull/298
>>
>> Thanks.
>>
>> Regards,
>> Megala
>> --
>> Megala Uthayakumar
>>
>> Software Engineer
>> Mobile : 0779967122
>>
>> ___
>> Dev mailing list
>> Dev@wso2.org
>> http://wso2.org/cgi-bin/mailman/listinfo/dev
>>
>>
>


-- 
Megala Uthayakumar

Software Engineer
Mobile : 0779967122
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Some values are missing in governance registry property search

2017-11-22 Thread Megala Uthayakumar
Hi Danesh,

Thanks for the prompt action.

Regards,
Megala

On Thu, Nov 23, 2017 at 8:54 AM, Danesh Kuruppu  wrote:

> Hi Megala,
>
> +1. Thanks for the fix. reviewed and merged the PR.
>
> Thanks
> Danesh
>
> On Wed, Nov 22, 2017 at 11:11 PM, Megala Uthayakumar 
> wrote:
>
>> Hi All,
>>
>> I am working on adding access control support to APIM 2.1.x,. For this
>> feature, we are making use of the registry property-search for the getting
>> relevant resources based on user roles. While doing the implementation, I
>> came across following behaviour,
>>
>> Even though if we add multiple versions of an API, only one version of
>> that particular API is visibile in the publisher. While analyzing this
>> issue, I understood this issue is only happening if we are using
>> PaginationContext init, with the sort property "overview_name" (i.e. API
>> Name). This has happened because when finally sorting the merged attribute
>> search result and property search result, we are using the TreeSet in [1]
>> and in TreeSet if comparator [2] returns 0, it will be thought as duplicate
>> and that value will be replaced TreeSet. Since in API Manager case, both
>> the versions of API will have the same "overview_name" and the comparator
>> will return the value as 0, so only one value will be given as result. In
>> order to overcome this, we need to return some other value, whenever the
>> comparison value is  0.
>>
>> I have created an github issue for this [3] and did a fix for this issue[
>> 4]. I tested this fix locally and it seems to be working fine.
>>
>> Appreciate if someone from registry team can review and merge this.
>>
>> [1] https://github.com/wso2/carbon-governance/blob/master/co
>> mponents/governance/org.wso2.carbon.governance.api/src/
>> main/java/org/wso2/carbon/governance/api/util/GovernanceUtils.java#L2055
>> [2] https://github.com/wso2/carbon-governance/blob/master/co
>> mponents/governance/org.wso2.carbon.governance.api/src/
>> main/java/org/wso2/carbon/governance/api/util/GovernanceUtils.java#L2056
>> [3] https://github.com/wso2/carbon-governance/issues/297
>> [4] https://github.com/wso2/carbon-governance/pull/298
>>
>> Thanks.
>>
>> Regards,
>> Megala
>> --
>> Megala Uthayakumar
>>
>> Software Engineer
>> Mobile : 0779967122
>>
>
>
>
> --
>
> *Danesh Kuruppu*
> Senior Software Engineer | WSO2
>
> Email: dan...@wso2.com
> Mobile: +94 (77) 1690552 <+94%2077%20169%200552>
> Web: WSO2 Inc 
>
>


-- 
Megala Uthayakumar

Software Engineer
Mobile : 0779967122
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


Re: [Dev] Some values are missing in governance registry property search

2017-11-22 Thread roshan wijesena
"Even though if we add multiple versions of an API, only one version of
that particular API is visibile in the publisher."

Which version is this? I tested in 2.1.0 i can see all versioned apis in
publisher, is this happening when you have more than 10 APIs?

On Thu, Nov 23, 2017 at 4:41 AM, Megala Uthayakumar  wrote:

> Hi All,
>
> I am working on adding access control support to APIM 2.1.x,. For this
> feature, we are making use of the registry property-search for the getting
> relevant resources based on user roles. While doing the implementation, I
> came across following behaviour,
>
> Even though if we add multiple versions of an API, only one version of
> that particular API is visibile in the publisher. While analyzing this
> issue, I understood this issue is only happening if we are using
> PaginationContext init, with the sort property "overview_name" (i.e. API
> Name). This has happened because when finally sorting the merged attribute
> search result and property search result, we are using the TreeSet in [1]
> and in TreeSet if comparator [2] returns 0, it will be thought as duplicate
> and that value will be replaced TreeSet. Since in API Manager case, both
> the versions of API will have the same "overview_name" and the comparator
> will return the value as 0, so only one value will be given as result. In
> order to overcome this, we need to return some other value, whenever the
> comparison value is  0.
>
> I have created an github issue for this [3] and did a fix for this issue[
> 4]. I tested this fix locally and it seems to be working fine.
>
> Appreciate if someone from registry team can review and merge this.
>
> [1] https://github.com/wso2/carbon-governance/blob/master/
> components/governance/org.wso2.carbon.governance.api/
> src/main/java/org/wso2/carbon/governance/api/util/
> GovernanceUtils.java#L2055
> [2] https://github.com/wso2/carbon-governance/blob/master/
> components/governance/org.wso2.carbon.governance.api/
> src/main/java/org/wso2/carbon/governance/api/util/
> GovernanceUtils.java#L2056
> [3] https://github.com/wso2/carbon-governance/issues/297
> [4] https://github.com/wso2/carbon-governance/pull/298
>
> Thanks.
>
> Regards,
> Megala
> --
> Megala Uthayakumar
>
> Software Engineer
> Mobile : 0779967122
>
> ___
> Dev mailing list
> Dev@wso2.org
> http://wso2.org/cgi-bin/mailman/listinfo/dev
>
>
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev


[Dev] Some values are missing in governance registry property search

2017-11-22 Thread Megala Uthayakumar
Hi All,

I am working on adding access control support to APIM 2.1.x,. For this
feature, we are making use of the registry property-search for the getting
relevant resources based on user roles. While doing the implementation, I
came across following behaviour,

Even though if we add multiple versions of an API, only one version of that
particular API is visibile in the publisher. While analyzing this issue, I
understood this issue is only happening if we are using PaginationContext
init, with the sort property "overview_name" (i.e. API Name). This has
happened because when finally sorting the merged attribute search result
and property search result, we are using the TreeSet in [1] and in TreeSet
if comparator [2] returns 0, it will be thought as duplicate and that value
will be replaced TreeSet. Since in API Manager case, both the versions of
API will have the same "overview_name" and the comparator will return the
value as 0, so only one value will be given as result. In order to overcome
this, we need to return some other value, whenever the comparison value is
 0.

I have created an github issue for this [3] and did a fix for this issue[
4]. I tested this fix locally and it seems to be working fine.

Appreciate if someone from registry team can review and merge this.

[1]
https://github.com/wso2/carbon-governance/blob/master/components/governance/org.wso2.carbon.governance.api/src/main/java/org/wso2/carbon/governance/api/util/GovernanceUtils.java#L2055
[2]
https://github.com/wso2/carbon-governance/blob/master/components/governance/org.wso2.carbon.governance.api/src/main/java/org/wso2/carbon/governance/api/util/GovernanceUtils.java#L2056
[3] https://github.com/wso2/carbon-governance/issues/297
[4] https://github.com/wso2/carbon-governance/pull/298

Thanks.

Regards,
Megala
-- 
Megala Uthayakumar

Software Engineer
Mobile : 0779967122
___
Dev mailing list
Dev@wso2.org
http://wso2.org/cgi-bin/mailman/listinfo/dev