Taxonomy plugin, API question

classic Classic list List threaded Threaded
4 messages Options
Reply | Threaded
Open this post in threaded view
|

Taxonomy plugin, API question

Luis Muniz-2
Hi,

I don't know what is better form, creating a JIRA issue right away or discussing it here first.
If I chose the bad alternative, please forgive me, Marc.


Here's my issue. I need to be able to find a tagged object by a list of tags, with an or operator.

I have found in TaxonomyService a method that does just that, but it is protected:

protected getObjectsForTaxonIds(objClass, taxonList, params) 


So the first question would be why is it protected, and the second would be would it be such a bad idea to make it public?

Thanks

Luis
Reply | Threaded
Open this post in threaded view
|

Re: Taxonomy plugin, API question

Marc Palmer Local

On 15 Sep 2012, at 13:22, Luis Muniz <[hidden email]> wrote:

> Hi,
>
> I don't know what is better form, creating a JIRA issue right away or discussing it here first.
> If I chose the bad alternative, please forgive me, Marc.
>
>
> Here's my issue. I need to be able to find a tagged object by a list of tags, with an or operator.
>
> I have found in TaxonomyService a method that does just that, but it is protected:
>
> protected getObjectsForTaxonIds(objClass, taxonList, params)
>
>

Sounds like a very reasonable request, perfectly requested :)

If you can raise a feature request in JIRA that would help track this. http://jira.grails.org/browse/GPTAXONOMY

I think we need a <DomainClass>.findAllbyTaxonomyIn(taxonomyPathList)

The problem is that this path list would need to be nested lists, unless we introduced a path separator which could be a breaking change for existing users using the char chosen as a separator.

What do you think?

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5 


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|

Re: Taxonomy plugin, API question

Luis Muniz-2
Hi Marc,

The only thing I can come up with which would be a little readable is:

<DomainClass>.findAllByTaxonomyIn {
  a.b.c
  a.b.e
  g.h
}

implemented with a little builder:

class TaxonBuilder {
    List<PathBuilder> pathBuilders = []

    List<List<String>> build(Closure c) {
        c.delegate = this
        c()
        [hidden email] {it.@nodes}
    }

    def getProperty(String name) {
        def builder = new PathBuilder(name)
        this.@pathBuilders << builder
        return builder
    }
}

private class PathBuilder {
    List<String> nodes

    PathBuilder(String root) {
        this.@nodes = [root]
    }

    def getProperty(String name) {
        this.@nodes << name
        return this
    }
}

This may be too much for only this method, but maybe this could be used throughout the plugin... Not convinced

On Sun, Sep 16, 2012 at 3:50 PM, Marc Palmer <[hidden email]> wrote:

On 15 Sep 2012, at 13:22, Luis Muniz <[hidden email]> wrote:

> Hi,
>
> I don't know what is better form, creating a JIRA issue right away or discussing it here first.
> If I chose the bad alternative, please forgive me, Marc.
>
>
> Here's my issue. I need to be able to find a tagged object by a list of tags, with an or operator.
>
> I have found in TaxonomyService a method that does just that, but it is protected:
>
> protected getObjectsForTaxonIds(objClass, taxonList, params)
>
>

Sounds like a very reasonable request, perfectly requested :)

If you can raise a feature request in JIRA that would help track this. http://jira.grails.org/browse/GPTAXONOMY

I think we need a <DomainClass>.findAllbyTaxonomyIn(taxonomyPathList)

The problem is that this path list would need to be nested lists, unless we introduced a path separator which could be a breaking change for existing users using the char chosen as a separator.

What do you think?

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email



Reply | Threaded
Open this post in threaded view
|

Re: Taxonomy plugin, API question

Luis Muniz-2
Jira filed:



On Sun, Sep 16, 2012 at 10:33 PM, Luis Muniz <[hidden email]> wrote:
Hi Marc,

The only thing I can come up with which would be a little readable is:

<DomainClass>.findAllByTaxonomyIn {
  a.b.c
  a.b.e
  g.h
}

implemented with a little builder:

class TaxonBuilder {
    List<PathBuilder> pathBuilders = []

    List<List<String>> build(Closure c) {
        c.delegate = this
        c()
        [hidden email] {it.@nodes}
    }

    def getProperty(String name) {
        def builder = new PathBuilder(name)
        this.@pathBuilders << builder
        return builder
    }
}

private class PathBuilder {
    List<String> nodes

    PathBuilder(String root) {
        this.@nodes = [root]
    }

    def getProperty(String name) {
        this.@nodes << name
        return this
    }
}

This may be too much for only this method, but maybe this could be used throughout the plugin... Not convinced


On Sun, Sep 16, 2012 at 3:50 PM, Marc Palmer <[hidden email]> wrote:

On 15 Sep 2012, at 13:22, Luis Muniz <[hidden email]> wrote:

> Hi,
>
> I don't know what is better form, creating a JIRA issue right away or discussing it here first.
> If I chose the bad alternative, please forgive me, Marc.
>
>
> Here's my issue. I need to be able to find a tagged object by a list of tags, with an or operator.
>
> I have found in TaxonomyService a method that does just that, but it is protected:
>
> protected getObjectsForTaxonIds(objClass, taxonList, params)
>
>

Sounds like a very reasonable request, perfectly requested :)

If you can raise a feature request in JIRA that would help track this. http://jira.grails.org/browse/GPTAXONOMY

I think we need a <DomainClass>.findAllbyTaxonomyIn(taxonomyPathList)

The problem is that this path list would need to be nested lists, unless we introduced a path separator which could be a breaking change for existing users using the char chosen as a separator.

What do you think?

Marc

~ ~ ~
Marc Palmer
Freelancer (Grails/Groovy/Java/UX)

I offer commercial support for Grails plugins from as low as $50/mo.
For details see: http://grailsrocks.com

Blog: http://www.anyware.co.uk | Resumé: http://www.anyware.co.uk/marc
Contributor @ http://grails.org |  Founder @ http://noticelocal.com
Developer @ http://weceem.org | Member @ http://spottymushroom.com
Twitter: http://twitter.com/wangjammer5


---------------------------------------------------------------------
To unsubscribe from this list, please visit:

    http://xircles.codehaus.org/manage_email