Guest User

Untitled

a guest
Jul 19th, 2018
62
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.24 KB | None | 0 0
  1. <h:outputText value="Add a Source System:"> </h:outputText><h:outputText value="*"
  2. styleClass="errors"></h:outputText>
  3. <h:inputText label="New Source System" id="NewSource"
  4. value="#{intakeParametersMBean.newSourceSystemName}"
  5. required="true">
  6. <f:validateLength minimum="1" maximum="50" />
  7.  
  8. </h:inputText> <h:outputText value="&#160;" />
  9. <h:outputText value="&#160;" /> <h:outputText value="&#160;" /></td>
  10.  
  11.  
  12. <a4j:commandButton id="save"
  13. value="Submit"
  14. action="#{intakeParametersMBean.addNewSourceSystem}"
  15. oncomplete="if (!ajaxRequestContainsErrors()) #{rich:component('addpopup')}.hide(); return false;">
  16.  
  17. </a4j:commandButton> <h:outputText value="&#160;" /> <h:outputText value="&#160;" />
  18. <h:commandButton value="Cancel"
  19. onclick="#{rich:component('addpopup')}.hide(); return false;">
  20. </h:commandButton></td>
  21.  
  22. ConfigType config = new ConfigType();
  23. config.setConfigDescription(newSourceSystemDesc);
  24. config.setConfigName(newSourceSystemName);
  25. config.setConfigType(ConfigTypeEnum.DATA_SRC.getType());
  26. config.setConfigStatus(true);
  27.  
  28. FacesContext context = FacesContext.getCurrentInstance();
  29. String viewId = context.getViewRoot().getViewId();
  30. ViewHandler handler = context.getApplication().getViewHandler();
  31. UIViewRoot root = handler.createView(context, viewId);
  32.  
  33. try {
  34. ipService.addNewConfigType(config);
  35. // Set the list to null so it can be reloaded
  36. errormessages = "";
  37. this.setConfigTypeList(null);
  38. } catch (Exception e1) {
  39. if (e1 instanceof ConstraintViolationException){
  40. context.addMessage(null,
  41. new FacesMessage(FacesMessage.SEVERITY_ERROR,
  42. "Source System Name Exists", "This will not allow to add new souce system"));
  43. errormessages = "Source System Name Exists";
  44. }
  45. }
  46.  
  47. function ajaxRequestContainsErrors() {
  48. return document.getElementById("maximumSeverity").value >= 2;
  49.  
  50. }
Add Comment
Please, Sign In to add comment