/** * @see ProgramEditor#setAsText(String) */ @Test public void setAsText_shouldSetUsingProgramId() { ProgramEditor editor = new ProgramEditor(); editor.setAsText("1"); Assert.assertNotNull(editor.getValue()); }
wdb.registerCustomEditor(Person.class, new PersonEditor()); wdb.registerCustomEditor(Privilege.class, new PrivilegeEditor()); wdb.registerCustomEditor(Program.class, new ProgramEditor()); wdb.registerCustomEditor(ProgramWorkflow.class, new ProgramWorkflowEditor()); wdb.registerCustomEditor(ProgramWorkflowState.class, new ProgramWorkflowStateEditor());
@Override public String getAsText() { Program p = (Program) getValue(); if (p == null) { return ""; } else { return p.getProgramId().toString(); } }
Integer conceptId = Integer.valueOf(text.substring(text.indexOf('.') + 1)); Concept c = Context.getConceptService().getConcept(conceptId); setValue(Context.getProgramWorkflowService().getProgramByName(c.getName().getName())); } else { Integer programId = Integer.valueOf(text); setValue(Context.getProgramWorkflowService().getProgram(programId)); setValue(p); if (p == null) { log.error("Error setting text: " + text, ex); setValue(null);
/** * @see ProgramEditor#setAsText(String) */ @Test public void setAsText_shouldSetUsingConceptId() { ProgramEditor editor = new ProgramEditor(); editor.setAsText("concept.9"); Assert.assertNotNull(editor.getValue()); }
/** * @see ProgramEditor#setAsText(String) */ @Test public void setAsText_shouldSetUsingConceptUuid() { ProgramEditor editor = new ProgramEditor(); editor.setAsText("concept.0a9afe04-088b-44ca-9291-0a8c3b5c96fa"); Assert.assertNotNull(editor.getValue()); }
/** * @see ProgramEditor#setAsText(String) */ @Test public void setAsText_shouldSetUsingProgramUuid() { ProgramEditor editor = new ProgramEditor(); editor.setAsText("da4a0391-ba62-4fad-ad66-1e3722d16380"); Assert.assertNotNull(editor.getValue()); } }
return ed.getValue(); } else if (Program.class.equals(clazz)) { ProgramEditor ed = new ProgramEditor(); ed.setAsText(string); return ed.getValue(); } else if (ProgramWorkflowState.class.equals(clazz)) { ProgramWorkflowStateEditor ed = new ProgramWorkflowStateEditor();