/**
   * @param processAgentInfo
   * @return ProcessAgentInfo
   */
  private ProcessAgentInfo Parse(ProcessAgentInfo processAgentInfo) {
    final String methodName = "Parse";
    Logfile.WriteCalled(logLevel, STR_ClassName, methodName);

    try {
      /*
       * Check if ProcessAgentInfo has been provided
       */
      if (processAgentInfo == null) {
        /*
         * Create instance of ProcessAgentInfo ready to fill in
         */
        processAgentInfo = new ProcessAgentInfo();
        processAgentInfo.setOutCoupon(new Coupon());

        /*
         * Check that WebService Url has been entered
         */
        this.hitServiceUrl = this.hitServiceUrl.trim();
        if (this.hitServiceUrl.isEmpty() == true) {
          throw new Exception(String.format(STRERR_NotSpecified_arg, STRERR_ServiceUrl));
        }
        processAgentInfo.setServiceUrl(this.hitServiceUrl);

        /*
         * Check that Service Passkey has been entered
         */
        this.hitServicePasskey = this.hitServicePasskey.trim();
        if (this.hitServicePasskey.isEmpty() == true) {
          throw new Exception(String.format(STRERR_NotSpecified_arg, STRERR_ServicePasskey));
        }
        processAgentInfo.getOutCoupon().setPasskey(this.hitServicePasskey);
      } else {
        /*
         * Optional Information
         */
        SystemSupportInfo systemSupportInfo = processAgentInfo.getSystemSupportInfo();
        this.htaDescription = this.htaDescription.trim();
        systemSupportInfo.setDescription(
            this.htaDescription.isEmpty() ? null : this.htaDescription);
        this.hitLocation = this.hitLocation.trim();
        systemSupportInfo.setLocation(this.hitLocation.isEmpty() ? null : this.hitLocation);
        this.hitInfoUrl = this.hitInfoUrl.trim();
        systemSupportInfo.setInfoUrl(this.hitInfoUrl.isEmpty() ? null : this.hitInfoUrl);
        this.hitContactName = this.hitContactName.trim();
        systemSupportInfo.setContactName(
            this.hitContactName.isEmpty() ? null : this.hitContactName);
        this.hitContactEmail = this.hitContactEmail.trim();
        systemSupportInfo.setContactEmail(
            this.hitContactEmail.isEmpty() ? null : this.hitContactEmail);
      }
    } catch (Exception ex) {
      this.ShowMessageError(ex.getMessage());
      processAgentInfo = null;
    }

    Logfile.WriteCompleted(logLevel, STR_ClassName, methodName);

    return processAgentInfo;
  }
  private void PopulateServiceInfo() {
    final String methodName = "PopulateServiceInfo";
    Logfile.WriteCalled(logLevel, STR_ClassName, methodName);

    try {
      /*
       * Retrieve the ProcessAgentInfo for the specified service
       */
      ProcessAgents processAgents =
          this.serviceBrokerSession.getServiceManagement().getProcessAgents();
      ProcessAgentInfo processAgentInfo = processAgents.RetrieveByName(this.hsomService);
      if (processAgentInfo == null) {
        throw new Exception(String.format(STRERR_RetrieveFailed_arg, this.hsomService));
      }

      /*
       * Update information
       */
      this.hitServiceName = processAgentInfo.getAgentName();
      this.hitServiceGuid = processAgentInfo.getAgentGuid();
      this.hitServiceUrl = processAgentInfo.getServiceUrl();
      this.hitClientUrl = processAgentInfo.getClientUrl();
      this.hitServiceType = processAgentInfo.getAgentType().toString();

      SystemSupportInfo systemSupportInfo = processAgentInfo.getSystemSupportInfo();
      this.htaDescription = systemSupportInfo.getDescription();
      this.hitLocation = systemSupportInfo.getLocation();
      this.hitInfoUrl = systemSupportInfo.getInfoUrl();
      this.hitContactName = systemSupportInfo.getContactName();
      this.hitContactEmail = systemSupportInfo.getContactEmail();

      /*
       * Update controls
       */
      this.registered = true;
    } catch (Exception ex) {
      ShowMessageError(ex.getMessage());
      Logfile.WriteError(ex.toString());
    }

    Logfile.WriteCompleted(logLevel, STR_ClassName, methodName);
  }