Esempio n. 1
0
 /**
  * updates the gui, which depends on the selected process
  *
  * @param event
  * @throws AbortProcessingException
  */
 public void selectProcess(AjaxBehaviorEvent event) throws AbortProcessingException {
   FacesContext fc = FacesContext.getCurrentInstance();
   if (wpsClient == null) {
     FacesMessage msg = getFacesMessage(FacesMessage.SEVERITY_ERROR, "ERROR.NO_URL");
     fc.addMessage("ClientBean.selectProcess.NO_WPS", msg);
     return;
   }
   if (process == null) {
     FacesMessage msg = getFacesMessage(FacesMessage.SEVERITY_ERROR, "ERROR.NO_PROCESS");
     fc.addMessage("ClientBean.selectProcess.NO_Process", msg);
     return;
   }
   selectedProcess = wpsClient.getProcess(process.getCode(), process.getCodeSpace());
   if (selectedProcess == null) {
     FacesMessage msg =
         getFacesMessage(FacesMessage.SEVERITY_WARN, "WARN.NO_PROCESS_WITH_ID", url, process);
     fc.addMessage("ClientBean.selectProcess.NO_PROCESS_FOR_ID", msg);
     return;
   }
   information =
       selectedProcess.getAbstract() != null ? selectedProcess.getAbstract().getString() : "";
   FacesMessage msg =
       getFacesMessage(FacesMessage.SEVERITY_INFO, "INFO.SELECT_PROCESS", selectedProcess.getId());
   fc.addMessage("ClientBean.selectProcess.SELECT_PROCESS", msg);
 }
Esempio n. 2
0
 /**
  * action methode to update the information text dependent on the given parameter
  *
  * @return null, to stay on the same page
  */
 public Object updateInfoText() {
   FacesContext fc = FacesContext.getCurrentInstance();
   Map<String, String> params = fc.getExternalContext().getRequestParameterMap();
   if (params.containsKey("type")) {
     String type = params.get("type");
     if (WPS_INFOKEY.equals(type) && wpsClient != null) {
       ServiceIdentification si = wpsClient.getMetadata().getServiceIdentification();
       information = getAsLocaleString(si.getAbstracts());
     } else if (PROCESS_INFOKEY.equals(type) && selectedProcess != null) {
       information =
           selectedProcess.getAbstract() != null ? selectedProcess.getAbstract().getString() : "";
     } else if (IN_INFOKEY.equals(type)
         && params.containsKey("dataId")
         && selectedProcess != null) {
       try {
         String id = params.get("dataId");
         InputType[] inputTypes = selectedProcess.getInputTypes();
         for (int i = 0; i < inputTypes.length; i++) {
           if (equalsCodeType(inputTypes[i].getId(), id)) {
             information =
                 inputTypes[i].getAbstract() != null
                     ? inputTypes[i].getAbstract().getString()
                     : "";
           }
         }
       } catch (Exception e) {
         information = null;
         FacesMessage msg = getFacesMessage(FacesMessage.SEVERITY_INFO, "INFO.UPDATE_INFO_FAILED");
         fc.addMessage("ClientBean.updateInfoText.FAILED", msg);
       }
     } else if (OUT_INFOKEY.equals(type)
         && params.containsKey("dataId")
         && selectedProcess != null) {
       try {
         String id = params.get("dataId");
         OutputType[] outputTypes = selectedProcess.getOutputTypes();
         for (int i = 0; i < outputTypes.length; i++) {
           if (equalsCodeType(outputTypes[i].getId(), id)) {
             information =
                 outputTypes[i].getAbstract() != null
                     ? outputTypes[i].getAbstract().getString()
                     : "";
           }
         }
       } catch (Exception e) {
         information = null;
         FacesMessage msg = getFacesMessage(FacesMessage.SEVERITY_INFO, "INFO.UPDATE_INFO_FAILED");
         fc.addMessage("ClientBean.updateInfoText.FAILED", msg);
       }
     }
   }
   return null;
 }