Changeset 1981


Ignore:
Timestamp:
Aug 25, 2011, 1:52:01 PM (8 years ago)
Author:
robert@…
Message:

First "working" prototype of the visualization controller

Location:
trunk
Files:
2 added
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/controllers/dbnp/visualization/VisualizeController.groovy

    r1979 r1981  
    1515package dbnp.visualization
    1616
     17import dbnp.studycapturing.*;
     18import grails.converters.JSON
     19import org.dbnp.gdt.TemplateField
     20
    1721class VisualizeController {
     22        def authenticationService
     23       
    1824        /**
    1925         * Shows the visualization screen
    2026         */
    21     def index = { }
     27    def index = {
     28                [ studies: Study.giveReadableStudies( authenticationService.getLoggedInUser() )]
     29        }
    2230       
     31        def getStudies = {
     32                def studies = Study.giveReadableStudies( authenticationService.getLoggedInUser() );
     33               
     34                render studies as JSON
     35        }
     36       
     37        def getFields = {
     38                def entities = [ Study, Subject, Event, SamplingEvent, Sample, Assay ]
     39                def fields = [];
     40               
     41                entities.each { entity ->
     42                        def entityFields = TemplateField.findAll( "from TemplateField where entity = ?", [ entity ] );
     43                       
     44                        println "Entity " + entity + " -> " + entityFields
     45                       
     46                        def domainFields = entity.giveDomainFields();
     47                       
     48                        ( domainFields + entityFields ).each { field ->
     49                                fields << [ "id": field.name, "source": "GSCF", "category": entity.toString(), "name": field.name ]
     50                        }
     51                }
     52               
     53                render fields as JSON
     54        }
     55       
     56        def getVisualizationTypes = {
     57                def types = [ [ "id": "barchart", "name": "Barchart"] ];
     58                render types as JSON
     59        }
     60       
     61        def getData = {
     62                def data = [[3,7,9,1,4,6,8,2,5]];
     63               
     64                render data as JSON
     65        }
    2366       
    2467}
  • trunk/test/integration/RestControllerIntegrationTests.groovy

    r1588 r1981  
    4343                Date expiryDate = new Date( now + 24 * 60 * 60 * 1000 )
    4444                def user = new SessionAuthenticatedUser( consumer: consumer, token: token, secUser: SecUser.findByUsername( 'user' ), expiryDate: expiryDate )
    45                 user.save(flush: true)
     45                assert user.save(flush: true)
    4646
    4747                // Check whether the user is really logged in
Note: See TracChangeset for help on using the changeset viewer.