Beispiel #1
0
  /**
   * execute a script entered as string with the given interpreter
   *
   * @param objects optional Objects to replace in Variables like [Fall.Grund] in the script
   * @param params optional parameters. These can be of the form <i>name=value</i> or <i>value</i>.
   *     if no name is given, the variables will be inserted for $1, $2 ... in the script. If a name
   *     is given, $names in the script will be replaced with the respective values.
   * @return The result of the script interpreter
   * @throws ElexisException
   */
  public static Object execute(
      Interpreter scripter, String script, String params, PersistentObject... objects)
      throws ElexisException {
    if (!StringTool.isNothing(script)) {
      if (params != null) {
        String var = "\\$";
        String[] parameters = params.split("\\s*,\\s*");
        for (int i = 0; i < parameters.length; i++) {
          String parm = parameters[i].trim();
          String[] p = parm.split("=");
          if (p.length == 2) {
            script = script.replaceAll("\\" + p[0], p[1]);
          } else {
            script = script.replaceAll(var + i, p[0]);
          }
        }
      }
      String parsed = parse(script, objects);
      scripter.setValue("actPatient", ElexisEventDispatcher.getSelectedPatient());
      scripter.setValue("actFall", ElexisEventDispatcher.getSelected(Fall.class));
      scripter.setValue("actKons", ElexisEventDispatcher.getSelected(Konsultation.class));
      scripter.setValue("actMandant", CoreHub.actMandant);
      scripter.setValue("actUser", CoreHub.actUser);

      scripter.setValue("Elexis", CoreHub.plugin);
      return scripter.run(parsed, true);
    }
    return null;
  }
 public WhichPatientDialog(Shell parentShell, Patient sysmexPat) {
   super(parentShell);
   this.sysmexPat = sysmexPat;
   // only add selected pat if he/she is not null and not equal the sysmex patient
   Patient tmpPat = ElexisEventDispatcher.getSelectedPatient();
   if (tmpPat != null && !tmpPat.equals(sysmexPat)) {
     selectedPat = tmpPat;
   }
 }
 public boolean accept(PersistentObject o) {
   if (ElexisEventDispatcher.getSelectedPatient() != null) {
     if (o instanceof Artikel) {
       return !((Artikel) o).isProduct();
     }
     if (o instanceof IVerrechenbar) {
       return true;
     }
     if (o instanceof Leistungsblock) {
       return true;
     }
     if (o instanceof Prescription) {
       Prescription p = ((Prescription) o);
       return (p.getArtikel() != null && !p.getArtikel().isProduct());
     }
   }
   return false;
 }
Beispiel #4
0
 @Override
 public void visible(boolean mode) {
   if (mode == true) {
     Problem problem = IatrixEventHelper.getSelectedProblem();
     if (problem != null) {
       // check whether Problem matches the currently selected patient
       Patient selectedPatient = ElexisEventDispatcher.getSelectedPatient();
       if (selectedPatient != null
           && problem.getPatient().getId().equals(selectedPatient.getId())) {
         setProblem(problem);
       } else {
         setProblem(null);
       }
     } else {
       setProblem(null);
     }
     ElexisEventDispatcher.getInstance().addListeners(eeli_problem, eeli_patient);
   } else {
     ElexisEventDispatcher.getInstance().removeListeners(eeli_problem, eeli_patient);
   }
 }