Downloads Documentation Community Contribute Demo






Show Sidebar
Login | Register

Changeset 3512

Show
Ignore:
Timestamp:
02/28/08 23:32:42 (10 months ago)
Author:
bmamlin
Message:

groovy: added patientSet to context

Files:

Legend:

Unmodified
Added
Removed
Modified
Copied
Moved
  • openmrs-modules/groovy/build.xml

    r2886 r3512  
    33<!-- ** Basic Module                                        ** --> 
    44<!-- **                                                     ** --> 
    5 <!-- ** @version 1.0                                        ** --> 
     5<!-- ** @version 1.1                                        ** --> 
    66<!-- ********************************************************* --> 
    77<project name="Groovy" default="package-module"> 
     8 
     9        <property name="compile.target" value="1.5" /> 
     10        <echo message="Java compile target (javac -target): ${compile.target}" /> 
    811 
    912        <!-- *********************************************************** --> 
     
    5356 
    5457                <!--  Compile module java files --> 
    55                 <javac destdir="build" classpathref="classpath" debug="true" debuglevel="lines,source" target="1.5"> 
     58                <javac destdir="build" classpathref="classpath" debug="true" debuglevel="lines,source" target="${compile.target}"> 
    5659                        <src path="src/" /> 
    5760                        <include name="**/*.java" /> 
     
    5962 
    6063                <!--  Compile module web java files --> 
    61                 <javac destdir="build" classpathref="classpath" debug="true" debuglevel="lines,source" target="1.5"> 
     64                <javac destdir="build" classpathref="classpath" debug="true" debuglevel="lines,source" target="${compile.target}"> 
    6265                        <compilerarg line="-g" /> 
    6366                        <src path="web/src/" /> 
  • openmrs-modules/groovy/src/org/openmrs/module/groovy/GroovyActivator.java

    r2872 r3512  
    6363                binding.setVariable("order", Context.getOrderService()); 
    6464                binding.setVariable("patient", Context.getPatientService()); 
     65                binding.setVariable("patientSet", Context.getPatientSetService()); 
    6566                binding.setVariable("person", Context.getPersonService()); 
    6667                binding.setVariable("program", Context.getProgramWorkflowService()); 
  • openmrs-modules/groovy/web/src/org/openmrs/module/groovy/web/DWRGroovyService.java

    r2877 r3512  
    11package org.openmrs.module.groovy.web; 
     2 
     3import java.io.PrintWriter; 
     4import java.io.StringWriter; 
     5import java.io.Writer; 
    26 
    37import org.openmrs.module.ModuleFactory; 
     
    913 
    1014        public String eval(String script) { 
     15                 
     16                Object result = null; 
    1117 
    1218                getGMA().clearBuffer(); 
    1319                try { 
    14                         Object value = getGMA().getShell().evaluate(script); 
     20                        result = getGMA().getShell().evaluate(script); 
    1521                } catch (Exception e) { 
    16                         return "Exception: " + e.getMessage(); 
     22                    final Writer trace = new StringWriter(); 
     23                    final PrintWriter printWriter = new PrintWriter(trace); 
     24                    e.printStackTrace(printWriter); 
     25                        return "Exception: <b>" + e.getMessage() + "</b><br>" + trace.toString(); 
    1726                } 
    18                 return getGMA().getBuffer(); 
     27                 
     28                String output = getGMA().getBuffer(); 
     29                if (output != null && output.length() > 0) 
     30                        return output; 
     31                else 
     32                        return (result == null ? "" : result.toString()); 
    1933        } 
    2034