Guest User

Untitled

a guest
Feb 22nd, 2018
65
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.70 KB | None | 0 0
  1. // @Inject
  2. private Procedimentos procedimentos;
  3.  
  4. public IndicacaoConverter() {
  5. procedimentos = CDIServiceLocator.getBean(Procedimentos.class);
  6. }
  7.  
  8. @Override
  9. public Object getAsObject(FacesContext context, UIComponent component, String value) {
  10. Indicacao retorno = null;
  11.  
  12. if (value != null) {
  13. Long id = new Long(value);
  14. retorno = procedimentos.porId(id);
  15. }
  16.  
  17. return retorno;
  18. }
  19.  
  20. @Override
  21. public String getAsString(FacesContext context, UIComponent component, Object value) {
  22. if (value != null) {
  23. Indicacao indicacao = (Indicacao) value;
  24. return indicacao.getId() == null ? null : indicacao.getId().toString();
  25. }
  26.  
  27. return "";
  28. }
  29.  
  30. Long id = new Long(value);
Add Comment
Please, Sign In to add comment