Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- @FacesConverter(forClass = Error1.class, value = "a")
- public static class Error1ControllerConverter implements Converter {
- public Object getAsObject(FacesContext facesContext, UIComponent component, String value) {
- if (value == null || value.length() == 0) {
- return null;
- }
- Error1Controller controller = (Error1Controller) facesContext.getApplication().getELResolver().
- getValue(facesContext.getELContext(), null, "error1Controller");
- try {
- return controller.ejbErrorAnulacion.find(getKey(value));
- } catch (EntidadException ex) {
- Logger.getLogger(Error1Controller.class.getName()).log(Level.SEVERE, null, ex);
- return null;
- }
- }
- java.lang.Integer getKey(String value) {
- java.lang.Integer key;
- key = Integer.valueOf(value);
- return key;
- }
- String getStringKey(java.lang.Integer value) {
- StringBuffer sb = new StringBuffer();
- sb.append(value);
- return sb.toString();
- }
- public String getAsString(FacesContext facesContext, UIComponent component, Object object) {
- if (object == null) {
- return null;
- }
- if (object instanceof Error1) {
- Error1 o = (Error1) object;
- return getStringKey(o.getId());
- } else {
- throw new IllegalArgumentException("object " + object + " is of type " + object.getClass().getName() + "; expected type: " + Error1.class.getName());
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement