Ignore:
Timestamp:
Jun 11, 2010, 3:50:48 PM (13 years ago)
Author:
duh
Message:
  • fixed issues with templates not refreshing properly in the wizard after editting them in the templateEditor
  • tried to centralize some functionality
  • dev version of samples
File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/grails-app/domain/dbnp/data/Term.groovy

    r540 r557  
    3030                return name
    3131        }
     32
     33        /**
     34         * Return all terms for a string of comma separated ontology ncboId's.
     35         * @see Ontology.groovy
     36         * @param ontologies
     37         * @return
     38         */
     39        def giveAllByOntologies( ontologies ) {
     40                // this method does not seem to work (see taglibrary:termSelect)
     41                // i'll try to get it working later, or delete this altogether
     42                // - Jeroen
     43                def data = []
     44                def terms = []
     45
     46                // got a string?
     47                if (ontologies instanceof String) {
     48                        // split the ontologies string
     49                        ontologies.split(/\,/).each() { ncboId ->
     50                                // trim the id
     51                                ncboId.trim()
     52
     53                                // fetch all terms for this ontology
     54                                def ontology = Ontology.findAllByNcboId(ncboId)
     55
     56                                // does this ontology exist?
     57                                if (ontology) {
     58                                        ontology.each() {
     59                                                data[ data.size() ] = it
     60                                        }
     61                                }
     62                        }
     63
     64                        ontologies = data
     65                }
     66
     67                // iterate through ontologies
     68                ontologies.each() { ontology ->
     69                        Term.findAllByOntology( ontology ).each() { term ->
     70                                terms[ terms.size() ] = term
     71                        }
     72                }
     73
     74                // sort alphabetically
     75                terms.sort()
     76        }
    3277}
Note: See TracChangeset for help on using the changeset viewer.