@Override protected ProviderEditor getNewEditor() { return new ProviderEditor(); }
@Override public String getAsText() { Provider p = (Provider) getValue(); if (p == null) { return ""; } else { return p.getProviderId().toString(); } }
/** * @should set using id * @should set using uuid */ @Override public void setAsText(String text) throws IllegalArgumentException { ProviderService ps = Context.getProviderService(); if (StringUtils.hasText(text)) { try { setValue(ps.getProvider(Integer.valueOf(text))); } catch (Exception ex) { Provider p = ps.getProviderByUuid(text); setValue(p); if (p == null) { log.error("Error setting provider with id or uuid: " + text, ex); throw new IllegalArgumentException("Provider not found: " + ex.getMessage()); } } } else { setValue(null); } }
wdb.registerCustomEditor(ProgramWorkflow.class, new ProgramWorkflowEditor()); wdb.registerCustomEditor(ProgramWorkflowState.class, new ProgramWorkflowStateEditor()); wdb.registerCustomEditor(Provider.class, new ProviderEditor()); wdb.registerCustomEditor(Role.class, new RoleEditor()); wdb.registerCustomEditor(User.class, new UserEditor());