Quantcast

Plugin Permissions

classic Classic list List threaded Threaded
8 messages Options
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Plugin Permissions

apaganobeleno
Hey Guys, 

Im trying to publish a simple plugin that add methods to Domain Classes, 
basically first(), last(), updateAttribute() and updateAttributes(), i would like you to give me 
permissions to publish it into the grailsCentral repository.

My username is :
antonio.pagano

You can see the source code at :

The name of the plugin will be domain-utils.

Thanks in Advance, 


-- 
Antonio Pagano
Sent with Sparrow

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Plugin Permissions

Nick Vaidyanathan
This is weird:

@Test
  public void updateAttributes(){
    def newDomain = new TestsDomain(name: "Juan");
    newDomain.save();

    newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free' )
    def lookupDomain = TestsDomain.get( newDomain.id )

    assert lookupDomain.name.equals( 'New Juan' )
    assert lookupDomain.otherDomainProperty.equals( 'free' )
  }

Code:
metaClass.overrideAttribute = { attributeName, value ->
        delegate."set${attributeName.capitalize()}"( value )
      }

      metaClass.updateAttribute = { String attributeName, value ->
        delegate.overrideAttribute( attributeName, value );
        delegate.save()
      }

      metaClass.updateAttributes = { LinkedHashMap attributes ->
        for( Map.Entry it in attributes.entrySet() ){
          delegate.overrideAttribute( it.key, it.value );
        }

        delegate.save();
      }
It looks like this is adding dynamic properties to the domain's metaclass. How would Hibernate resolve persisting such properties?

On Sat, Jul 7, 2012 at 10:23 PM, Antonio Pagano <[hidden email]> wrote:
Hey Guys, 

Im trying to publish a simple plugin that add methods to Domain Classes, 
basically first(), last(), updateAttribute() and updateAttributes(), i would like you to give me 
permissions to publish it into the grailsCentral repository.

My username is :
antonio.pagano

You can see the source code at :

The name of the plugin will be domain-utils.

Thanks in Advance, 


-- 
Antonio Pagano
Sent with Sparrow




--
Nick Vaidyanathan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Plugin Permissions

apaganobeleno
Actually, its allowing users to updateAttributes ( as the name of the method says ), and yes, it's adding this methods dynamically, It's adding functions rather than properties.

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 11:18 AM, Nick Vaidyanathan wrote:

This is weird:

@Test
  public void updateAttributes(){
    def newDomain = new TestsDomain(name: "Juan");
    newDomain.save();

    newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free' )
    def lookupDomain = TestsDomain.get( newDomain.id )

    assert lookupDomain.name.equals( 'New Juan' )
    assert lookupDomain.otherDomainProperty.equals( 'free' )
  }

Code:
metaClass.overrideAttribute = { attributeName, value ->
        delegate."set${attributeName.capitalize()}"( value )
      }

      metaClass.updateAttribute = { String attributeName, value ->
        delegate.overrideAttribute( attributeName, value );
        delegate.save()
      }

      metaClass.updateAttributes = { LinkedHashMap attributes ->
        for( Map.Entry it in attributes.entrySet() ){
          delegate.overrideAttribute( it.key, it.value );
        }

        delegate.save();
      }
It looks like this is adding dynamic properties to the domain's metaclass. How would Hibernate resolve persisting such properties?

On Sat, Jul 7, 2012 at 10:23 PM, Antonio Pagano <[hidden email]> wrote:
Hey Guys, 

Im trying to publish a simple plugin that add methods to Domain Classes, 
basically first(), last(), updateAttribute() and updateAttributes(), i would like you to give me 
permissions to publish it into the grailsCentral repository.

My username is :
antonio.pagano

You can see the source code at :

The name of the plugin will be domain-utils.

Thanks in Advance, 


-- 
Antonio Pagano
Sent with Sparrow




--
Nick Vaidyanathan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Plugin Permissions

Nick Vaidyanathan
What happens if:

newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free', 'baz' : 'boo' )

Or
newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free', 'baz' : 'boo' )
Or
newDomain.updateAttributes( 'name': null, 'otherDomainProperty': 'free' )

Also, if I remember properly, domains added by plugins are added to an end user application db.  I believe if you move TestDomain from domain/ to src/groovy and implement have it implement GrailsDomainClass, you would get the same semantics without adding an extra table to users' databases. I could be wrong, though. Might be worth investigation. 

On Mon, Jul 9, 2012 at 9:29 AM, Antonio Pagano <[hidden email]> wrote:
Actually, its allowing users to updateAttributes ( as the name of the method says ), and yes, it's adding this methods dynamically, It's adding functions rather than properties.

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 11:18 AM, Nick Vaidyanathan wrote:

This is weird:

@Test
  public void updateAttributes(){
    def newDomain = new TestsDomain(name: "Juan");
    newDomain.save();

    newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free' )
    def lookupDomain = TestsDomain.get( newDomain.id )

    assert lookupDomain.name.equals( 'New Juan' )
    assert lookupDomain.otherDomainProperty.equals( 'free' )
  }

Code:
metaClass.overrideAttribute = { attributeName, value ->
        delegate."set${attributeName.capitalize()}"( value )
      }

      metaClass.updateAttribute = { String attributeName, value ->
        delegate.overrideAttribute( attributeName, value );
        delegate.save()
      }

      metaClass.updateAttributes = { LinkedHashMap attributes ->
        for( Map.Entry it in attributes.entrySet() ){
          delegate.overrideAttribute( it.key, it.value );
        }

        delegate.save();
      }
It looks like this is adding dynamic properties to the domain's metaclass. How would Hibernate resolve persisting such properties?

On Sat, Jul 7, 2012 at 10:23 PM, Antonio Pagano <[hidden email]> wrote:
Hey Guys, 

Im trying to publish a simple plugin that add methods to Domain Classes, 
basically first(), last(), updateAttribute() and updateAttributes(), i would like you to give me 
permissions to publish it into the grailsCentral repository.

My username is :
antonio.pagano

You can see the source code at :

The name of the plugin will be domain-utils.

Thanks in Advance, 


-- 
Antonio Pagano
Sent with Sparrow




--
Nick Vaidyanathan




--
Nick Vaidyanathan
Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Plugin Permissions

apaganobeleno
Yes, you are right about TestsDomain, i should add it to my exclude files, about that cases i will implement it on my tests.

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 11:43 AM, Nick Vaidyanathan wrote:

What happens if:

newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free', 'baz' : 'boo' )

Or
newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free', 'baz' : 'boo' )
Or
newDomain.updateAttributes( 'name': null, 'otherDomainProperty': 'free' )

Also, if I remember properly, domains added by plugins are added to an end user application db.  I believe if you move TestDomain from domain/ to src/groovy and implement have it implement GrailsDomainClass, you would get the same semantics without adding an extra table to users' databases. I could be wrong, though. Might be worth investigation. 

On Mon, Jul 9, 2012 at 9:29 AM, Antonio Pagano <[hidden email]> wrote:
Actually, its allowing users to updateAttributes ( as the name of the method says ), and yes, it's adding this methods dynamically, It's adding functions rather than properties.

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 11:18 AM, Nick Vaidyanathan wrote:

This is weird:

@Test
  public void updateAttributes(){
    def newDomain = new TestsDomain(name: "Juan");
    newDomain.save();

    newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free' )
    def lookupDomain = TestsDomain.get( newDomain.id )

    assert lookupDomain.name.equals( 'New Juan' )
    assert lookupDomain.otherDomainProperty.equals( 'free' )
  }

Code:
metaClass.overrideAttribute = { attributeName, value ->
        delegate."set${attributeName.capitalize()}"( value )
      }

      metaClass.updateAttribute = { String attributeName, value ->
        delegate.overrideAttribute( attributeName, value );
        delegate.save()
      }

      metaClass.updateAttributes = { LinkedHashMap attributes ->
        for( Map.Entry it in attributes.entrySet() ){
          delegate.overrideAttribute( it.key, it.value );
        }

        delegate.save();
      }
It looks like this is adding dynamic properties to the domain's metaclass. How would Hibernate resolve persisting such properties?

On Sat, Jul 7, 2012 at 10:23 PM, Antonio Pagano <[hidden email]> wrote:
Hey Guys, 

Im trying to publish a simple plugin that add methods to Domain Classes, 
basically first(), last(), updateAttribute() and updateAttributes(), i would like you to give me 
permissions to publish it into the grailsCentral repository.

My username is :
antonio.pagano

You can see the source code at :

The name of the plugin will be domain-utils.

Thanks in Advance, 


-- 
Antonio Pagano
Sent with Sparrow




--
Nick Vaidyanathan




--
Nick Vaidyanathan

Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Plugin Permissions

apaganobeleno
BTW, Thanks Nick and Jean !!

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 11:46 AM, Antonio Pagano wrote:

Yes, you are right about TestsDomain, i should add it to my exclude files, about that cases i will implement it on my tests.

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 11:43 AM, Nick Vaidyanathan wrote:

What happens if:

newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free', 'baz' : 'boo' )

Or
newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free', 'baz' : 'boo' )
Or
newDomain.updateAttributes( 'name': null, 'otherDomainProperty': 'free' )

Also, if I remember properly, domains added by plugins are added to an end user application db.  I believe if you move TestDomain from domain/ to src/groovy and implement have it implement GrailsDomainClass, you would get the same semantics without adding an extra table to users' databases. I could be wrong, though. Might be worth investigation. 

On Mon, Jul 9, 2012 at 9:29 AM, Antonio Pagano <[hidden email]> wrote:
Actually, its allowing users to updateAttributes ( as the name of the method says ), and yes, it's adding this methods dynamically, It's adding functions rather than properties.

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 11:18 AM, Nick Vaidyanathan wrote:

This is weird:

@Test
  public void updateAttributes(){
    def newDomain = new TestsDomain(name: "Juan");
    newDomain.save();

    newDomain.updateAttributes( 'name': 'New Juan', 'otherDomainProperty': 'free' )
    def lookupDomain = TestsDomain.get( newDomain.id )

    assert lookupDomain.name.equals( 'New Juan' )
    assert lookupDomain.otherDomainProperty.equals( 'free' )
  }

Code:
metaClass.overrideAttribute = { attributeName, value ->
        delegate."set${attributeName.capitalize()}"( value )
      }

      metaClass.updateAttribute = { String attributeName, value ->
        delegate.overrideAttribute( attributeName, value );
        delegate.save()
      }

      metaClass.updateAttributes = { LinkedHashMap attributes ->
        for( Map.Entry it in attributes.entrySet() ){
          delegate.overrideAttribute( it.key, it.value );
        }

        delegate.save();
      }
It looks like this is adding dynamic properties to the domain's metaclass. How would Hibernate resolve persisting such properties?

On Sat, Jul 7, 2012 at 10:23 PM, Antonio Pagano <[hidden email]> wrote:
Hey Guys, 

Im trying to publish a simple plugin that add methods to Domain Classes, 
basically first(), last(), updateAttribute() and updateAttributes(), i would like you to give me 
permissions to publish it into the grailsCentral repository.

My username is :
antonio.pagano

You can see the source code at :

The name of the plugin will be domain-utils.

Thanks in Advance, 


-- 
Antonio Pagano
Sent with Sparrow




--
Nick Vaidyanathan




--
Nick Vaidyanathan


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Plugin Permissions

pledbrook
In reply to this post by apaganobeleno
Hi Antonio,

First, thanks for offering your plugin to the community. Further
comments inline.

> Im trying to publish a simple plugin that add methods to Domain Classes,
> basically first(), last(), updateAttribute() and updateAttributes(), i would
> like you to give me
> permissions to publish it into the grailsCentral repository.

How do updateAttribute() and updateAttributes() differ from the
dynamic properties plugin?

    http://grails.org/plugin/dynamic-domain-properties

first() and last() may be worth implementing in GORM, particularly as
methods that you can call on detached criteria.

> You can see the source code at :
> https://github.com/apaganobeleno/grails-domain-utils
>
> The name of the plugin will be domain-utils.

Without some form of documentation explaining what the plugin does and
how to use it, I'm afraid we can't accept it. This is a recent
initiative to ensure a minimum standard for public plugins.

Regards,

Peter

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

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

    http://xircles.codehaus.org/manage_email


Reply | Threaded
Open this post in threaded view
|  
Report Content as Inappropriate
star

Re: Plugin Permissions

apaganobeleno
ok, Thanks, would be next time :)

-- 
Antonio Pagano
Sent with Sparrow

On Monday, July 9, 2012 at 12:30 PM, Peter Ledbrook wrote:

Hi Antonio,

First, thanks for offering your plugin to the community. Further
comments inline.

Im trying to publish a simple plugin that add methods to Domain Classes,
basically first(), last(), updateAttribute() and updateAttributes(), i would
like you to give me
permissions to publish it into the grailsCentral repository.

How do updateAttribute() and updateAttributes() differ from the
dynamic properties plugin?


first() and last() may be worth implementing in GORM, particularly as
methods that you can call on detached criteria.

You can see the source code at :

The name of the plugin will be domain-utils.

Without some form of documentation explaining what the plugin does and
how to use it, I'm afraid we can't accept it. This is a recent
initiative to ensure a minimum standard for public plugins.

Regards,

Peter

--
Peter Ledbrook
Grails Advocate
SpringSource - A Division of VMware

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


Loading...