Changeset 1487 for trunk/src/groovy


Ignore:
Timestamp:
Feb 3, 2011, 10:51:16 AM (10 years ago)
Author:
robert@…
Message:
  • Fixed StudySearch? unit tests (#303)
  • Changed css error message to class="errormessage" in order to avoid breaking the study wizard (see r1485)
Location:
trunk/src/groovy/dbnp/query
Files:
2 edited

Legend:

Unmodified
Added
Removed
  • trunk/src/groovy/dbnp/query/Search.groovy

    r1483 r1487  
    4949        public void setResultFields( Map r ) { resultFields = r; }
    5050
     51        public Search() {
     52                def ctx = ApplicationHolder.getApplication().getMainContext();
     53                def authenticationService = ctx.getBean("authenticationService");
     54                def sessionUser = authenticationService?.getLoggedInUser();
     55
     56                if( sessionUser )
     57                        this.user = sessionUser;
     58                else
     59                        this.user = null
     60        }
     61       
    5162        /**
    5263         * Returns the number of results found by this search
     
    215226                        return [];
    216227                       
    217                 // Determine the moduleCommunicationService
    218                 def ctx = (ApplicationContext)ApplicationHolder.getApplication().getMainContext();
     228                // Determine the moduleCommunicationService. Because this object
     229                // is mocked in the tests, it can't be converted to a ApplicationContext object
     230                def ctx = ApplicationHolder.getApplication().getMainContext();
    219231                def moduleCommunicationService = ctx.getBean("moduleCommunicationService");
    220232                       
  • trunk/src/groovy/dbnp/query/StudySearch.groovy

    r1482 r1487  
    6767
    6868                def studies = Study.list().findAll { it.canRead( this.user ) };
    69                
     69
    7070                // If no criteria are found, return all studies
    7171                if( !criteria || criteria.size() == 0 ) {
Note: See TracChangeset for help on using the changeset viewer.