Git Product home page Git Product logo

grails-core's Introduction

Revved up by Develocity

Build Status

  • Java CI
  • Grails Joint Validation Build

Slack Signup

Grails

Grails is a framework used to build web applications with the Groovy programming language. The core framework is very extensible and there are numerous plugins available that provide easy integration of add-on features.

Grails development is led by the Grails Foundation and is sponsored by Object Computing Inc. in St. Louis Missouri. Please contact [email protected] for support inquiries.

Getting Started

You need a Java Development Kit (JDK) installed, but it is not necessary to install Groovy because it's bundled with the Grails distribution.

To install Grails, visit https://grails.org/download.html and download the version you would like to use. Set a GRAILS_HOME environment variable to point to the root of the extracted download and add GRAILS_HOME/bin to your executable PATH. Then in a shell, type the following:

grails create-app sampleapp
cd sampleapp
grails run-app

To build Grails, clone this GitHub repository and execute the install Gradle target:

git clone https://github.com/grails/grails-core.git
cd grails-core
./gradlew install

If you encounter out of memory errors when trying to run the install target, try adjusting Gradle build settings. For example:

export GRADLE_OPTS="-Xmx2G -Xms2G -XX:NewSize=512m -XX:MaxNewSize=512m"

Performing a Release

See RELEASE.md.

License

Grails and Groovy are licensed under the terms of the Apache License, Version 2.0.


YourKit is kindly supporting Grails open source projects with its full-featured Java Profiler. YourKit, LLC is the creator of innovative and intelligent tools for profiling Java and .NET applications. Take a look at YourKit's leading software products: YourKit Java Profiler and YourKit .NET Profiler.

Dependencies

Gradle Plugins

  • Gradle Nexus Staging Plugin Github

grails-core's People

Contributors

bobbywarner avatar burtbeckwith avatar candrews avatar colinharrington avatar davydotcom avatar dependabot-preview[bot] avatar dependabot[bot] avatar erichelgeson avatar graemerocher avatar ilopmar avatar jameskleeh avatar jasonrudolph avatar ldaley avatar lhotari avatar longwa avatar marcpalmer avatar matrei avatar paulk-asert avatar pledbrook avatar puneetbehl avatar renovate-bot avatar renovate[bot] avatar rlovtangen avatar robfletcher avatar sarmbruster avatar sdelamo avatar smaldini avatar uurien avatar yamkazu avatar zacharyklein avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

grails-core's Issues

GRAILS-24: Support the concept of Flash scope

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-24

Rails supports the concept of flash scope, which retains request attributes for the next request and the next request only and then automatically clears them out…

This is highly useful when doing things like redirection and chaining taking the burden of managing the session off the programmer. We need a similar mechanism in Grails

GRAILS-50: nested taglib tags lose 'it' reference

Original Reporter: codevise
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-50

in a gsp
{code}

foo/g:link
/g:each
{code}
works fine but
{code}

${it.someProperty}/g:link
/g:each
{code}
throws
Cannot get property: someProperty on null object

GRAILS-30: Improve the render method to accept different types of builders

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-30

The render method in controllers is very useful in that it allows you to render a closure as markup to the response:

render {
div(“hello world!”)
}

but it should support parameters to change the builder used and content type of the response:

render(builder:“rico”) {
object(id:“myUpdater”) {
div(“hello world”)
}
}

and

render(contentType:“text/xml”) {
// etc.
}

GRAILS-11: Add the ability to apply patterns on a SiteMesh decorator

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-11

At the moment you have to explicity set the layout for each page using:

But it would be great to be able to add URL patterns to the layout decorator itself:

GRAILS-10: Add support for Controller Interceptors

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-10

Add support for controller action interceptors. An interceptor will intercept a call to a controller action and execute before and after. For example to intercept the “list” closure of the “UserController” class you would create the following interceptor:

class UserInterceptor {
// for all actions
@Property beforeAll = {

```
}
@Property doCallAll {
return true
}
@Property afterAll = {

}

```

// for a specifc action @Property beforeList = { } @Property doCallList = { return true } @Property afterList = { }

}

If “doCall” returns false the target action will not be called. If “doCall” is not defined the target is called by default

GRAILS-3: ClassNotFoundExceptionTests fails in Eclipse

Original Reporter: devijvers
Environment: Eclipse 3.1, java 1.5.0_02, Mac OS X 10.4.2
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-3

test/commons/groovy/lang/ClassNotFoundExceptionTests.java (in Grails repos) works in “ant test” but fails when run as a test case in Eclipse. This is the stack trace:

General error during class generation: No such class: Order Must be a valid field class for field: otherOrder for class: groovy.lang.OrderService. At [5:18] test/commons/groovy/lang/OrderService.groovy

1 Error

```
at org.codehaus.groovy.control.ErrorCollector.failIfErrors(ErrorCollector.java:325)
at org.codehaus.groovy.control.CompilationUnit.applyToPrimaryClassNodes(CompilationUnit.java:871)
at org.codehaus.groovy.control.CompilationUnit.classgen(CompilationUnit.java:556)
at org.codehaus.groovy.control.CompilationUnit.compile(CompilationUnit.java:461)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:258)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:221)
at groovy.lang.GroovyClassLoader.parseClass(GroovyClassLoader.java:171)
at groovy.lang.ClassNotFoundExceptionTests.testClassNotFoundException(ClassNotFoundExceptionTests.java:36)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
at java.lang.reflect.Method.invoke(Method.java:585)
at junit.framework.TestCase.runTest(TestCase.java:154)
at junit.framework.TestCase.runBare(TestCase.java:127)
at junit.framework.TestResult$1.protect(TestResult.java:106)
at junit.framework.TestResult.runProtected(TestResult.java:124)
at junit.framework.TestResult.run(TestResult.java:109)
at junit.framework.TestCase.run(TestCase.java:118)
at junit.framework.TestSuite.runTest(TestSuite.java:208)
at junit.framework.TestSuite.run(TestSuite.java:203)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTests(RemoteTestRunner.java:474)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(RemoteTestRunner.java:342)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.main(RemoteTestRunner.java:194)
```

Make sure to get the latests Grails.

GRAILS-47: provide an option where scaffolding overwrites old artifacts

Original Reporter: codevise
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-47

after changes to domain classes in an RAD cycle, all scaffolds need to be regenerated.
currently this only works when deleting all outdated artifacts before.

we could either have a ‘clean’ target for artifacts or ask for overwriting permission.

GRAILS-44: webtest: make simple scaffolding based on domain class

Original Reporter: codevise
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-44

Adapt test-generation such that

{code}
groovy SampleGenerator
{code}
runs the tests cleanly and touches all pages (for the default Mydomain class).

This means:
{code}
grails create-webtest
{code}
creates a suite and a test for the home page only → HomeTest.groovy

Tests for a domain class is scaffolded via
{code}
grails generate-webtest
{code}
This generates a {{MydomainTest.groovy}} with basic List(empty)/Create(1)/List(1)/Edit(1)/List(1)/Delete(1)/List(empty) cycle.

Initially the test is scaffolded as if the domain class has no properties and no dependencies.

GRAILS-19: grails script does not work if GRAILS_HOME has spaces in it

Original Reporter: sethladd
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-19

If your GRAILS_HOME has a space in it, the grails and grails.bat fail to work.

C:\Documents and Settings\Seth\workspace\grails-demo>set GRAILS_HOME=“c:\Documen
ts and Settings\Seth\workspace\grails”

C:\Documents and Settings\Seth\workspace\grails-demo>set PATH=%GRAILS_HOME%\bin;
PATH

C:\Documents and Settings\Seth\workspace\grails-demo>grails create-app
‘c:\documents’ is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Seth\workspace\grails-demo>set PATH="%GRAILS_HOME%\bin
“;%PATH%

C:\Documents and Settings\Seth\workspace\grails-demo>grails create-app
‘c:\documents’ is not recognized as an internal or external command,
operable program or batch file.
C:\Documents and Settings\Seth\workspace\grails-demo>echo GRAILS_HOME
“c:\Documents and Settings\Seth\workspace\grails”

GRAILS-42: provide means to facilitate functional testing of the web application

Original Reporter: codevise
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-42

include special suppor t for testing a grails-app with Canoo WebTest.

From the app directory:
{code}
grails create-webtest
{code}
- downloads WebTest if needed and installs under {{grails.home/downloads/webtest}}.
- creates the test directory structure for the current app
- creates standard properties and standard suite
- creates an initial app-specific test for giving the user a jump-start.

{code}
grails run-webtest
{code}
Runs the tests and puts reports in the {{reports}} dir. When on Windows, the browser is automatically opened on the HTML report. WebTests can even be started if the server is not running. In this case a report is created with a lot of failures.

GRAILS-6: Add BootStrap artifact to allow configuration on application load

Original Reporter: graemerocher
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-6

At the moment there is no way to execute code when the application loads. We need to add a new artifact that handles this eg.

grails-app/conf/ExampleBootStrap.groovy

class ExampleBootStrap {

```
@Property Closure init = {
servletContext →
}

@Property Closure destroy = { }

```

}

GRAILS-39: Allow configuration of GORM mapping so that the "owner" and "child" of relationships can be defined

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-39

At the moment Grails has cascading set to “all” all the time this means that if you delete a child it will delete the parent to (obviously not the desired effect)

We need to add settings to GORM to control the owning side of a relationship, something along the lines of ActiveRecord would be appropriate:

class Book {
@Property belongsTo = Author.class
// or for multiple parents
@Property belongsTo = [ Author.class, Publish.class ]

```
@Property Author author
```

}

GRAILS-35: Create tags necessary to support scaffolding

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-35

There are a number of tags needed to support scaffolding including:
- link
- form tags (checkboxes, forms, selects etc.)
- error handling

And possibly more

GRAILS-31: Support Scripting of the Spring App Context

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-31

Support scripting of the Spring application context using Groovy meta programming. At the moment all current implementations of this don’t take advantage of the groovy meta facility, hence end up with a robust syntax rather than somethingl ike this:

import org.apache.commons.dbcp.*
import org.springframework.orm.hibernate3.*

class ApplicationContext {
@Property beans = {
def ds = dataSource(‘destroy-method’:‘close’,BasicDataSource.class) {
driverClassName(“com.mysql.jdbc.Drive”)
url(“jdbc:mysql://localhost/testDb”)
username(“root”)
password(“admin”)
}
def sf = sessionFactory(LocalSessionFactoryBean.class) {
configurationClass(“org.hibernate.cfg.AnnotationConfiguration”)
hibernateProperties [‘hibernate.dialect’ : ‘org.hibernate.dialect.MySQLDialect’]
dataSource(ds)
}
}
}

This is the equivalent of the Spring xml:

com.mysql.jdbc.Driver jdbc:mysql://localhost/testDb root admin org.hibernate.cfg.AnnotationConfiguration org.hibernate.dialect.MySQLDialect update

GRAILS-13: Add a new SiteMap artifact for mapping urls to controllers

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-13

We should support an artifact ending with “Sitemap” that allows for mapping urls to controllers:

class ExampleSitemap {
@Property default = [ “/aurl/path” : “/controller/action” ]
@Property another = [ “/aurl/path” : “/controller/action” ]
}

The first property is the default sitemap the next one would have urls prefixed with “/another/”

GRAILS-49: visualize domain objects and their relations

Original Reporter: codevise
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-49

leverage the meta-info about the domain classes to create a graph of
domain classes and their properties and relations.
→ visualize the owner of a relation!

Make use of JGraph, or SnipGraph, or any other free graphing library.

GRAILS-40: Create JSP equivalents of GSP tags

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-40

Need to create JSP tags that call the GSP tag libraries so that they can be used in JSP using the technique described here (at the bottom):

http://grails.codehaus.org/Dynamic+Tag+Libraries

GRAILS-46: Add the ability to expose Grails service classes in a pluggable way

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.4
Migrated From: http://jira.grails.org/browse/GRAILS-46

It would be great to be able to expose Grails services classes in different ways by creating a pluggable mechanism. A Grails service class could have an “expose” property which defined how it would be exposed for example:

@Propery expose = [ ‘dwr’, ‘soap’ ]

Would expose the service class to Direct Web Remoting and Soap (via XFire or some SOAP implementation). This should be pluggable to allow exposing the service via other mechanisms such as xml-rpc.

GRAILS-51: Character Encoding problems with gsps

Original Reporter: kusako
Environment: Mozilla Firefox 1.5.0.1 / Windows XP; included Jetty
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-51

When I try to enter any non 7-bit character in a form it gets displayed as a ‘?’ character.
From how it looks it gets stored with Latin-1 encoding in the database, without being converted to Unicode first.
This happens with the built in Jetty server and the hsqldb that comes with grails as well as with mysql.

It works when the resulting war is deployed on tomcat.

GRAILS-7: Automatic assignment of parameters to class properties

Original Reporter: graemerocher
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-7

Add an interceptor that intercepts calls to a method on domain class instances called:

setProperties(Map properties)

This method takes a map of keys and values for properties of the domain class, if the value is a string automatic string to type conversion is attempted.

This will allow the following code in controllers to set the properties of a class from request parameters:

myDomainObject.properties = this.params

GRAILS-25: Refactor Chain and Redirect Methods to use true servlet redirection

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-25

The redirect and chain methods currently don’t truely redirect the request it does a simulated internal redirection, which can be a little confusing as this is usually the expected behaviour in web development as request redirection has other effects (like clearing request attributes etc.)

These need to be updated to support true request dispatching and use flash scope to pass parameters and chain models

GRAILS-8: Add support for Action redirection and Chaining

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-8

We need to support action redirection and chaining as its not always appropriate (or desirable) to resort to a web flow.

The proposed way to do this is to return a map with a “redirect” key from the controller closure:

return [ “redirect” : anotherAction ]

or

return [“redirect” : new AnotherController().someAction ]

Alternatively you can specify:

return [ “chain” : anotherClosure ]

Which does the same thing, but retains the model map from the previous closure if one existed. We may need to add a new dynamic property that allows the “chainModel” to be retrieved from the previous closure in the chain

GRAILS-36: Allow scaffolding of a specified class

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-36

At the moment you can set a controller to start scaffolding with the scaffold property (a boolean) like this:

@Property scaffold = true

This assumes the domain class follows the naming convention of the controller, we should be able to set scaffolding on any domain class like this:

@Property scaffold = User.class

GRAILS-43: 'grails' command on Windows not working when current path contains blanks

Original Reporter: codevise
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-43

transcript on the standard windows prompt:
{code}
C:\Documents and Settings\dierk>grails
Buildfile: C:\cygwin\home\dierk\groovy\modules\grails\src\grails\build.xml

BUILD FAILED
C:\cygwin\home\dierk\groovy\modules\grails\src\grails\build.xml:1: Basedir C:\Documents does not exist

Total time: 0 seconds
C:\Documents and Settings\dierk>cd \temp
{code}

GRAILS-9: Add default error view for internal errors

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-9

There should be a more elegant default error page that displays the stack trace and line numbers of the error rather than users having to trawl through the console logs.

This should be overidable by the user who wants their own error page.

GRAILS-28: Support application reloading

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-28

At the moment GSPs can be reloaded and with a very minor change taglibs and controllers (to a limited extend) too, however to support true reloading we need to implement a filter that manages the changes

The filter will read in all the URLs of the loaded groovy files and detect lastChanged times … when a URL changes reload it and then take appropriate action depending the artifact type:
- for controllers, it will reload recalculate the url mappings, scaffolding settings etc and potentially change the urlMappings within the Spring controller
- for domain classes it will reload the whole application context, re-mapping all domain classes via hibernate to ensure integrity of class relationships
- taglibs, services, etc. will simply be reloaded.

We also have to deal with the case when a new groovy class is added:
- if it is a controller, add the controller, re-generate web.xml, url mappings etc.
- if domain class same action as for a domain class change
- taglibs, services etc. just add them

GRAILS-41: 'create app' target fails due to grails.home being undefined

Original Reporter: eeustace
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-41

Just downloaded grails to try it out, the create app goal failed.

I fixed it locally by adding the grails.home def to that target – see attached patch.

Grails is a great idea by the way!

GRAILS-32: Support setting a default message on validation constraints

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-32

At the moment constraints are defined in the constraints closure like this:

@Property constraints = { login(length:5..15,blank:false,unique:true) password(length:5..15,blank:false) email(email:true,blank:false) age(range:18..65,nullable:false) }

The user is then forced to add the necessary message into the i18n message bundle otherwise they get a nasty default message. We should support adding a default message in the constraint itself as a fallback. Example:

@Property constraints = {
login(length:5..15,blank:false,unique:true, message:“The login does not fall within the valid length range of 5 to 15”)
}

GRAILS-37: Support scaffolding of class relationships

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-37

At the moment basic scaffolding is implemented but we should support scaffolding of relationships like in Rife and Trails (but not rails funnily enough). This is more complex as it requires controll of the navigation through the object model and the potential problem of linking to an artifact that doesn’t exist or is not scaffolded…

GRAILS-27: Improve GSP error reportining

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-27

At the moment the GSP engine throws and exception when a syntax, compilation or runtime error occurs with a GSP, the user has to hunt through the console to find the problem (in fact JSP is no better at this)

We need to add line number detection and catch the exception, forward it the grails error handling view and show the code snippet where the error occured in the GSP in the same way we do with grails controllers

GRAILS-22: Compilation errors on AbstractPersistentMethods and DefaultGrailsControllerClassTests

Original Reporter: pdel
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-22

Got the source code on 11/03.

Compilation fails on line 38 of AbstractPersistentMethods.
Added “implements DynamicMethods” which allowed the compilation of the class to succeed.

Also get this error on build-test:

D:\grails\test\commons\org\codehaus\groovy\grails\commons\DefaultGrailsControllerClassTests.java:50: cannot find symbol
symbol : method getViewName(java.lang.String)
location: interface org.codehaus.groovy.grails.commons.GrailsControllerClass
assertEquals(“listPage”, grailsClass.getViewName(“/overview/list”));

GRAILS-20: grails script does not work with spaces in base dir name

Original Reporter: sethladd
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-20

The grails script does not work if the basedir’s name has spaces in it, either:

C:\Documents and Settings\Seth\workspace\grails-demo>set GRAILS_HOME=c:\grails

C:\Documents and Settings\Seth\workspace\grails-demo>set PATH=%GRAILS_HOME%\bin;
PATH

C:\Documents and Settings\Seth\workspace\grails-demo>grails create-app

C:\Documents and Settings\Seth\workspace\grails-demo>if “c:\Program Files\Java\j
dk1.5.0_03” == "" goto javaHomeNotSet

C:\Documents and Settings\Seth\workspace\grails-demo>if “c:\documents and settin
gs\seth\Development\apache-ant-1.6.2” == "" goto antHomeNotSet

C:\Documents and Settings\Seth\workspace\grails-demo>if “GRAILS_HOME” == "" goto
grailsHomeNotSet

C:\Documents and Settings\Seth\workspace\grails-demo>goto getArguments

C:\Documents and Settings\Seth\workspace\grails-demo>set GRAILS_ARGUMENTS=create
-app

C:\Documents and Settings\Seth\workspace\grails-demo>if ""create-app"" == """" g
oto getClasspath

C:\Documents and Settings\Seth\workspace\grails-demo>shift

C:\Documents and Settings\Seth\workspace\grails-demo>if """" == """" goto getCla
sspath

C:\Documents and Settings\Seth\workspace\grails-demo>set GRAILS_ANT_CLASSPATH=“c
:\grails\lib\bsf.jar;c:\grails\lib\groovy-all-1.0-jsr-04-SNAPSHOT.jar;c:\grails\
lib\org.mortbay.jetty.jar;c:\grails\lib\commons-logging.jar;c:\grails\lib\common
s-el.jar;c:\grails\lib\javax.servlet.jar;c:\grails\lib\log4j-1.2.8.jar;c:\grails
\lib\jasper-compiler.jar;c:\grails\lib\jasper-runtime.jar”

C:\Documents and Settings\Seth\workspace\grails-demo>goto startGrails

C:\Documents and Settings\Seth\workspace\grails-demo>call “c:\documents and sett
ings\seth\Development\apache-ant-1.6.2\bin\ant.bat” -lib “c:\grails\lib\bsf.jar;
c:\grails\lib\groovy-all-1.0-jsr-04-SNAPSHOT.jar;c:\grails\lib\org.mortbay.jetty
.jar;c:\grails\lib\commons-logging.jar;c:\grails\lib\commons-el.jar;c:\grails\li
b\javax.servlet.jar;c:\grails\lib\log4j-1.2.8.jar;c:\grails\lib\jasper-compiler.
jar;c:\grails\lib\jasper-runtime.jar” -f “c:\grails\src\grails\build.xml” -Dbase
dir=C:\Documents and Settings\Seth\workspace\grails-demo create-app
Buildfile: c:\grails\src\grails\build.xml

BUILD FAILED
Basedir C:\Documents does not exist

GRAILS-17: Provide flexible multi-channel Scaffolding

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-17

Scaffolding means to auto-generate a whole application for a given domain class:
- a master/detail view
- controllers for create/read/update/delete (CRUD) operations
These artifacts are generated from a standard template but can be customized.

Scaffolding in Grails should be flexible and support multiple response types and be pluggable into other applications. This will be achieved by implementing a ScaffoldingApplication interface that provides the business logic:

interface ScaffoldingApplication {
List list();
List list(int max);
List list(int max, int offset);
Object create();
Object edit(Object id);
Object save(Map properties);
Object update(Object id,Map properties);
Object delete(Object id)
List find(String by, Object value);
// etc. etc.
}

An implementation instance of this interface will be configured by Spring for each Grails domain class that has

@Property scaffold = true

The response logic will be handled by a class implementing the following interface that uses the a ScaffoldApplication instance to handle the logic:

interface ScaffoldRequestHandler {

```
void setScaffoldApplication(ScaffoldApplication application);

ScaffoldResponse handleList(HttpServletRequest, HttpServletResponse response); // etc.

```

}

The implementor will optionally return a ScaffoldResponse instance that defines the model and view to use for the scaffold response. Alternatively it can write directly to the response instance.

If multiple scaffolding types are defined:

@Property scaffold = [ “web”, “rico”, “xml” ] // etc.

A ScaffoldRequestHandlerFactory class configured by Spring will return the correct ScaffoldRequestHandler instance that knows how to scaffold the different response types.

GRAILS-23: Create a Scaffolding Artifact to Configure scaffolding

Original Reporter: graemerocher
Environment: Not Specified
Version: Not Specified
Migrated From: http://jira.grails.org/browse/GRAILS-23

We need some way of configuring the Scaffolding view otherwise scaffolding loses its usefulness, to do this we will support a Scaffold artifact for each controller. If one exists the settings will be used within this class otherwise default settings will be used. Example:

// domain class
class User {
@Property String login
@Property String password
@Property String email
}

// controller
class UserScaffold {
@Property scaffoldList = {
login(order:1)
password(order:2,fieldType:"password)
}
}

GRAILS-15: Implement Controller & Domain Validation

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-15

We need to implement validation for the model, view and controller components of Grails. For the domain classes (ie the model) a dynamic validate method will be provided that returns a boolean. This method will be called automatically by the “save” method:

def user = new User()
user.properties = … // set the properties from some source

```
if( user.save() ) {
return [ “user” : user ]
}
else {
user.errors.each {
println it
}
}
```

By default the behaviour will validate that all required properies have been set and that the id is unique. If further validation is required, a “constraints” closure can be specified and an implemention provided. The validate closure uses the constraints as part of validation:

class User {
@Property String login
@Property String pass
@Property constraints = {
this.login.maxLength = 16
this.login.minLength = 5
this.login.nullable = false
this.pass.maxLength = 10
this.pass.nullable = false
}
}

If any errors occur, the error messages will be searched for in a “user.properties” bundle ( or"user.fr.properties" depending on the locale) like this that contains GStrings:

domain.login.min.length=Your login only contains ${user.login.length} but it needs to be 10 characters long

Otherwise the key “domain.login.min.length” will be returned. If i18ln is not an issue you can programmatically populate the validation errors in a controller like this before the response returns the client:

class UserController {
@Property validationMessages = [“domain.login.min.length”, “Your login only contains ${user.login.length} but it needs to be 10 characters long”]

```
…..
```

}

Controller actions also have access to a dynamic validator instance property that works with the request/session objects:

class UserController {
@Property login = {
def errors = this.validator {
notBlank(param:“login”, message:“Login not specified”)
isNull(session:“user”, message:“User already in session”)
maxLength(param:“login”, length:10)
}
}
}

If the “message” is not specified it will look for properties in the bundle that follow a similar convention:

user.login.param.login.not.blank=The login id was not specified
user.login.session.user.null=A user already exist in the session

All validator builders also contain generic builder nodes like:

notNull(value:someValue)

GRAILS-18: Typo in assertion in DefaultGrailsControllerClassTests

Original Reporter: milkchaser
Environment: n/a
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-18

Line 51:
assertEquals(“listPage”, grailsClass.getViewName(“/overview/list”));
should be:
assertEquals(“listPage”, grailsClass.getViewByName(“/overview/list”));

GRAILS-4: NoClassDefFoundError when running test case

Original Reporter: devijvers
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-4

When I’m running the tests cases (‘grails test-app’) in the orders sample application I get a NoClassDefFoundError when a method is executed on the OrderService object.

This object has been created and is configured in the Spring application context so up until that point class loading worked ok.

The javadoc for NoClassDefFoundError says:

“The searched-for class definition existed when the currently executing class was compiled, but the definition can no longer be found.”

I’m not sure what this means in terms of which class loader is being used. I tried to the set GroovyClassLoader as the context class loader but to no avail.

This is the error I get:

```
[java] 1) testLoadAllOrders(test.OrderServiceTests)java.lang.NoClassDefFoundError: OrderEntry
[java] at test.OrderService.class$(/Users/stevendevijver/download/groovy/modules/grails/samples/orders/tmp/tests/classpath/test/OrderService.groovy)
[java] at test.OrderService.findAllOrders(/Users/stevendevijver/download/groovy/modules/grails/samples/orders/tmp/tests/classpath/test/OrderService.groovy:7)
[java] at test.OrderService$$FastClassByCGLIB$$d23c5b83.invoke()
[java] at net.sf.cglib.proxy.MethodProxy.invoke(MethodProxy.java:149)
[java] at org.springframework.aop.framework.Cglib2AopProxy$CglibMethodInvocation.invokeJoinpoint(Cglib2AopProxy.java:661)
[java] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:122)
[java] at org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
[java] at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:144)
[java] at org.springframework.aop.framework.Cglib2AopProxy$DynamicAdvisedInterceptor.intercept(Cglib2AopProxy.java:606)
[java] at test.OrderService$$EnhancerByCGLIB$$bcb5cd6a.findAllOrders()
[java] at gjdk.test.OrderService_GroovyReflector.invoke(Unknown Source)
[java] at groovy.lang.MetaMethod.invoke(MetaMethod.java:110)
[java] at groovy.lang.MetaClass.doMethodInvoke(MetaClass.java:1565)
[java] at groovy.lang.MetaClass.invokeMethod(MetaClass.java:378)
[java] at org.codehaus.groovy.runtime.Invoker.invokeMethod(Invoker.java:157)
[java] at org.codehaus.groovy.runtime.InvokerHelper.invokeMethod(InvokerHelper.java:104)
[java] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeMethod(ScriptBytecodeAdapter.java:85)
[java] at org.codehaus.groovy.runtime.ScriptBytecodeAdapter.invokeNoArgumentsMethod(ScriptBytecodeAdapter.java:154)
[java] at test.OrderServiceTests.testLoadAllOrders(/Users/stevendevijver/download/groovy/modules/grails/samples/orders/tmp/tests/classpath/test/OrderServiceTests.groovy:8)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
[java] at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:39)
[java] at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:25)
[java] at org.codehaus.groovy.grails.support.GrailsTestSuite.runTest(GrailsTestSuite.java:47)
[java] at grails.util.RunTests.main(RunTests.java:69)

[java] FAILURES!!! [java] Tests run: 1, Failures: 0, Errors: 1

```

GRAILS-26: Support manual creation of database schema with GSQL

Original Reporter: graemerocher
Environment: Not Specified
Version: 0.1
Migrated From: http://jira.grails.org/browse/GRAILS-26

At the moment the database is either automatically created with Hibernates ddl auto facility or you have to create it yourself using your databases sql scripts or management interface etc.

We need a new artifact that allows you to manually create the database but support auto-install on a number of different target database using GSQL (http://groovy.codehaus.org/GSQL)

the artifact would reside in the “grails-app/db” directory and be something like this and support a “generate” method and “populate” method. The generate method would use GSQL’s relational builder to output ddl injected in by the MetaClass, the populate method will pass a implicit “db” variable created from the grails data source:

class ApplicationDatabase {

```
@Property generate = {
database(name:‘genealogy’) {
table(name:‘event’) {
column(name:‘event_id’, type:‘integer’, size:10, primaryKey:true, required:true)
column(name:‘description’, type:‘varchar’, size:30)
}
}
}

@Property populate = {
db.executeUpdate(“INSERT INTO SOME_TABLE …….”)
}
```

}

The user could then install the database by running the grails command:

grails install-db

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.