public void _jspService(HttpServletRequest request, HttpServletResponse response)
      throws java.io.IOException, ServletException {

    JspFactory _jspxFactory = null;
    PageContext pageContext = null;
    HttpSession session = null;
    ServletContext application = null;
    ServletConfig config = null;
    JspWriter out = null;
    Object page = this;
    JspWriter _jspx_out = null;
    PageContext _jspx_page_context = null;

    try {
      _jspxFactory = JspFactory.getDefaultFactory();
      response.setContentType("text/html; charset=ISO-8859-1");
      pageContext = _jspxFactory.getPageContext(this, request, response, null, true, 8192, true);
      _jspx_page_context = pageContext;
      application = pageContext.getServletContext();
      config = pageContext.getServletConfig();
      session = pageContext.getSession();
      out = pageContext.getOut();
      _jspx_out = out;

      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      out.write("\n");
      java.util.List resultList = null;
      synchronized (request) {
        resultList =
            (java.util.List)
                _jspx_page_context.getAttribute("resultList", PageContext.REQUEST_SCOPE);
        if (resultList == null) {
          throw new java.lang.InstantiationException("bean resultList not found within scope");
        }
      }
      out.write('\n');
      java.lang.String maxPages = null;
      synchronized (request) {
        maxPages =
            (java.lang.String)
                _jspx_page_context.getAttribute("maxPages", PageContext.REQUEST_SCOPE);
        if (maxPages == null) {
          throw new java.lang.InstantiationException("bean maxPages not found within scope");
        }
      }
      out.write('\n');
      java.lang.String currentPage = null;
      synchronized (request) {
        currentPage =
            (java.lang.String)
                _jspx_page_context.getAttribute("currentPage", PageContext.REQUEST_SCOPE);
        if (currentPage == null) {
          throw new java.lang.InstantiationException("bean currentPage not found within scope");
        }
      }
      out.write('\n');
      java.lang.String rowPerPage = null;
      synchronized (request) {
        rowPerPage =
            (java.lang.String)
                _jspx_page_context.getAttribute("rowPerPage", PageContext.REQUEST_SCOPE);
        if (rowPerPage == null) {
          throw new java.lang.InstantiationException("bean rowPerPage not found within scope");
        }
      }
      out.write("\n");
      out.write("\n");
      out.write("<!DOCTYPE HTML PUBLIC \"-//W3C//DTD HTML 4.01 Transitional//EN\">\n");
      out.write("\n");
      out.write("<html>\n");
      out.write("\n");
      out.write("<head>\n");
      out.write(
          "<link rel=\"stylesheet\" type=\"text/css\" href=\"/hss.web.console/style/fokus_ngni.css\">\n");
      out.write("<meta http-equiv=\"Content-Type\" content=\"text/html; charset=ISO-8859-1\">\n");
      out.write("<title>");
      if (_jspx_meth_bean_message_0(_jspx_page_context)) return;
      out.write("</title>\n");
      out.write("\n");
      out.write("<script type=\"text/javascript\" language=\"JavaScript\">\n");
      out.write("\n");
      out.write("function submitForm(pageId){\n");
      out.write("\tdocument.DSAI_SearchForm.crtPage.value = pageId;\n");
      out.write("\tdocument.DSAI_SearchForm.submit();\n");
      out.write("}\n");
      out.write("\n");
      out.write("function rowsPerPageChanged(){\n");
      out.write("\tdocument.DSAI_SearchForm.crtPage.value = 1;\r\n");
      out.write("\t//document.DSAI_SearchForm.rowsPerPageChanged=true;\n");
      out.write("\tdocument.DSAI_SearchForm.submit();\n");
      out.write("}\n");
      out.write("</script>\n");
      out.write("</head>\n");
      out.write("\n");
      out.write("<body>\n");
      out.write("\r\n");
      out.write("\t<table id=\"title-table\" align=\"center\" weight=\"100%\" >\r\n");
      out.write("\t<tr>\r\n");
      out.write("\t\t<td align=\"center\">\r\n");
      out.write("\t\t\t<h1> DSAI Search </h1>\r\n");
      out.write("\t\t\t<br/><br/>\r\n");
      out.write("\t\t</td>\r\n");
      out.write("\r\n");
      out.write("\t</table> <!-- title-table -->\r\n");
      out.write("\r\n");
      out.write("\t<table id=\"main-table\" align=\"center\" valign=\"middle\">\n");
      out.write("\t<tr>\n");
      out.write("\t\t<td>\n");
      out.write(
          "\t \t\t<table id=\"main-table\" class=\"as\" border=\"0\" cellspacing=\"1\" align=\"center\" style=\"border:2px solid #FF6600;\" width=\"400\">\n");
      out.write("\t\t\t\t<tr class=\"header\">\n");
      out.write("\t\t\t\t\t<td class=\"header\" width=\"50\"> ID </td>\n");
      out.write("\t\t\t\t\t<td class=\"header\"> DSAI-Tag </td>\n");
      out.write("\t\t\t\t</tr>\n");
      out.write("\n");
      out.write("\t\t\t\t");

      if (resultList != null && resultList.size() > 0) {
        DSAI dsai;
        int idx = 0;
        Iterator it = resultList.iterator();

        while (it.hasNext()) {
          dsai = (DSAI) it.next();

          out.write("\n");
          out.write("\t\t\t\t\t<tr class=\"");
          out.print(idx % 2 == 0 ? "even" : "odd");
          out.write("\">\n");
          out.write("\t\t\t\t\t\t<td>\n");
          out.write("\t\t\t\t\t\t\t");
          out.print(dsai.getId());
          out.write("\n");
          out.write("\t\t\t\t\t\t</td>\n");
          out.write("\t\t\t\t\t\t<td>\r\n");
          out.write("\t\t\t\t\t\t\t\t<a href=\"/hss.web.console/DSAI_Load.do?id=");
          out.print(dsai.getId());
          out.write("\">\n");
          out.write("\t\t\t\t\t\t\t\t");
          out.print(dsai.getDsai_tag());
          out.write("\n");
          out.write("\t\t\t\t\t\t\t</a>\n");
          out.write("\t\t\t\t\t\t</td>\n");
          out.write("\t\t\t\t\t</tr>\n");
          out.write("\t\t\t\t");

          idx++;
        } // while
      } // if
      else {

        out.write("\n");
        out.write("\t\t\t\t\t<tr>\n");
        out.write("\t\t\t\t\t\t<td>\n");
        out.write("\t\t\t\t\t\t\t");
        if (_jspx_meth_bean_message_1(_jspx_page_context)) return;
        out.write("\n");
        out.write("\t\t\t\t\t\t</td>\n");
        out.write("\t\t\t\t\t</tr>\n");
        out.write("\t\t\t\t");
      }

      out.write("\n");
      out.write("\t\t\t</table>\n");
      out.write("\t\t</td>\n");
      out.write("\t</tr>\n");
      out.write("\t<tr>\n");
      out.write("\t\t<td colspan=\"3\" class=\"header\">\n");
      out.write("\t\t\t");
      //  html:form
      org.apache.struts.taglib.html.FormTag _jspx_th_html_form_0 =
          (org.apache.struts.taglib.html.FormTag)
              _jspx_tagPool_html_form_action.get(org.apache.struts.taglib.html.FormTag.class);
      _jspx_th_html_form_0.setPageContext(_jspx_page_context);
      _jspx_th_html_form_0.setParent(null);
      _jspx_th_html_form_0.setAction("/DSAI_Search");
      int _jspx_eval_html_form_0 = _jspx_th_html_form_0.doStartTag();
      if (_jspx_eval_html_form_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
        do {
          out.write("\n");
          out.write("\t\t\t\t<table align=\"center\">\n");
          out.write("\t\t\t\t\t<tr>\n");
          out.write("\t\t\t\t\t\t<td>\n");
          out.write("\t\t\t\t\t\t");

          int length = Integer.parseInt(maxPages) + 1;
          int cPage = Integer.parseInt(currentPage) + 1;
          for (int iy = 1; iy < length; iy++) {
            if (cPage != iy) {

              out.write("\n");
              out.write("\t\t\t\t\t\t\t\t\t<a href=\"javascript:submitForm(");
              out.print(String.valueOf(iy));
              out.write(");\">");
              out.print(iy);
              out.write("</a>\n");
              out.write("\t\t\t\t\t\t");

            } else {

              out.write("\n");
              out.write("\t\t\t\t\t\t\t\t\t<font style=\"color:#FF0000;font-weight: 600;\">\n");
              out.write("\t\t\t\t\t\t\t\t\t\t");
              out.print(String.valueOf(iy));
              out.write("\n");
              out.write("\t\t\t\t\t\t\t\t\t</font>\n");
              out.write("\t\t\t\t\t\t\t\t");
            }
          }

          out.write("\n");
          out.write("\t\t\t\t\t\t</td>\n");
          out.write("\t\t\t\t\t\t<td>\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_bean_message_2(_jspx_th_html_form_0, _jspx_page_context)) return;
          out.write("<br>\n");
          out.write("\t\t\t\t\t\t\t");
          if (_jspx_meth_html_hidden_0(_jspx_th_html_form_0, _jspx_page_context)) return;
          out.write("\n");
          out.write("\t\t\t\t\t\t\t");
          //  html:select
          org.apache.struts.taglib.html.SelectTag _jspx_th_html_select_0 =
              (org.apache.struts.taglib.html.SelectTag)
                  _jspx_tagPool_html_select_property_onchange.get(
                      org.apache.struts.taglib.html.SelectTag.class);
          _jspx_th_html_select_0.setPageContext(_jspx_page_context);
          _jspx_th_html_select_0.setParent((javax.servlet.jsp.tagext.Tag) _jspx_th_html_form_0);
          _jspx_th_html_select_0.setProperty("rowsPerPage");
          _jspx_th_html_select_0.setOnchange("javascript:rowsPerPageChanged();");
          int _jspx_eval_html_select_0 = _jspx_th_html_select_0.doStartTag();
          if (_jspx_eval_html_select_0 != javax.servlet.jsp.tagext.Tag.SKIP_BODY) {
            if (_jspx_eval_html_select_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE) {
              out = _jspx_page_context.pushBody();
              _jspx_th_html_select_0.setBodyContent((javax.servlet.jsp.tagext.BodyContent) out);
              _jspx_th_html_select_0.doInitBody();
            }
            do {
              out.write("\n");
              out.write("\t\t\t\t\t\t\t\t<option value=\"20\"\n");
              out.write("\t\t\t\t\t\t\t\t\t");
              out.print(rowPerPage.equals("20") ? "selected" : "");
              out.write(" >20 </option>\n");
              out.write("\t\t\t\t\t\t\t\t<option value=\"30\"\n");
              out.write("\t\t\t\t\t\t\t\t\t");
              out.print(rowPerPage.equals("30") ? "selected" : "");
              out.write(" >30 </option>\n");
              out.write("\t\t\t\t\t\t\t\t<option value=\"50\"\n");
              out.write("\t\t\t\t\t\t\t\t\t");
              out.print(rowPerPage.equals("50") ? "selected" : "");
              out.write(" >50</option>\n");
              out.write("\t\t\t\t\t\t\t\t<option value=\"100\"\n");
              out.write("\t\t\t\t\t\t\t\t\t");
              out.print(rowPerPage.equals("100") ? "selected" : "");
              out.write(" >100</option>\n");
              out.write("\t\t\t\t\t\t\t");
              int evalDoAfterBody = _jspx_th_html_select_0.doAfterBody();
              if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break;
            } while (true);
            if (_jspx_eval_html_select_0 != javax.servlet.jsp.tagext.Tag.EVAL_BODY_INCLUDE)
              out = _jspx_page_context.popBody();
          }
          if (_jspx_th_html_select_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
          _jspx_tagPool_html_select_property_onchange.reuse(_jspx_th_html_select_0);
          out.write("\n");
          out.write("\t\t\t\t\t\t</td>\n");
          out.write("\t\t\t\t\t</tr>\n");
          out.write("\t\t\t\t</table>\n");
          out.write("\t\t\t");
          int evalDoAfterBody = _jspx_th_html_form_0.doAfterBody();
          if (evalDoAfterBody != javax.servlet.jsp.tagext.BodyTag.EVAL_BODY_AGAIN) break;
        } while (true);
      }
      if (_jspx_th_html_form_0.doEndTag() == javax.servlet.jsp.tagext.Tag.SKIP_PAGE) return;
      _jspx_tagPool_html_form_action.reuse(_jspx_th_html_form_0);
      out.write("\n");
      out.write("\t\t</td>\n");
      out.write("\t</tr>\n");
      out.write("\t</table>\n");
      out.write("</body>\n");
      out.write("</html>\n");
    } catch (Throwable t) {
      if (!(t instanceof SkipPageException)) {
        out = _jspx_out;
        if (out != null && out.getBufferSize() != 0) out.clearBuffer();
        if (_jspx_page_context != null) _jspx_page_context.handlePageException(t);
      }
    } finally {
      if (_jspxFactory != null) _jspxFactory.releasePageContext(_jspx_page_context);
    }
  }
Пример #2
0
  public static void addShData(
      ShDataElement shData,
      int crt_data_ref,
      IMPU impu,
      String crt_service_indication,
      String server_name,
      int identitySet,
      String dsai_tag) {

    Session session = HibernateUtil.getCurrentSession();
    ShIMSDataElement shIMSData = shData.getShIMSData();

    if (crt_data_ref == ShConstants.Data_Ref_Charging_Info
        || crt_data_ref == ShConstants.Data_Ref_DSAI
        || crt_data_ref == ShConstants.Data_Ref_iFC
        || crt_data_ref == ShConstants.Data_Ref_IMS_User_State
        || crt_data_ref == ShConstants.Data_Ref_PSI_Activation
        || crt_data_ref == ShConstants.Data_Ref_SCSCF_Name) {
      if (shIMSData == null) {
        shIMSData = new ShIMSDataElement();
        shData.setShIMSData(shIMSData);
      }
    }
    ShDataExtensionElement shDataExtension = shData.getShDataExtension();
    if (crt_data_ref == ShConstants.Data_Ref_Aliases_Repository_Data) {

      if (shDataExtension == null) {
        shDataExtension = new ShDataExtensionElement();
        shData.setShDataExtension(shDataExtension);
      }
    }

    switch (crt_data_ref) {
      case ShConstants.Data_Ref_Repository_Data:
        RepositoryData repData =
            RepositoryData_DAO.get_by_IMPU_and_ServiceIndication(
                session, impu.getId(), crt_service_indication);
        RepositoryDataElement repDataElement = new RepositoryDataElement();
        repDataElement.setServiceData(new String(repData.getRep_data()));
        repDataElement.setSqn(repData.getSqn());
        repDataElement.setServiceIndication(crt_service_indication);
        shData.addRepositoryData(repDataElement);
        break;

      case ShConstants.Data_Ref_Aliases_Repository_Data:
        AliasesRepositoryData aliasesRepData =
            AliasesRepositoryData_DAO.get_by_setID_and_ServiceIndication(
                session, impu.getId_implicit_set(), crt_service_indication);

        AliasesRepositoryDataElement aliasesRepDataElement = new AliasesRepositoryDataElement();
        aliasesRepDataElement.setServiceData(new String(aliasesRepData.getRep_data()));
        aliasesRepDataElement.setSqn(aliasesRepData.getSqn());
        aliasesRepDataElement.setServiceIndication(crt_service_indication);
        shDataExtension.addAliasesRepositoryData(aliasesRepDataElement);
        break;

      case ShConstants.Data_Ref_IMS_Public_Identity:
        PublicIdentityElement pIdentityElement = shData.getPublicIdentifiers();
        if (pIdentityElement == null) {
          pIdentityElement = new PublicIdentityElement();
          shData.setPublicIdentifiers(pIdentityElement);
        }

        List impuList = null;
        switch (identitySet) {
          case ShConstants.Identity_Set_All_Identities:
            impuList = IMPU_DAO.get_all_within_same_IMPI_Associations(session, impu.getId());
            break;

          case ShConstants.Identity_Set_Registered_Identities:
            impuList =
                IMPU_DAO.get_all_Registered_within_same_IMPI_Associations(session, impu.getId());
            break;

          case ShConstants.Identity_Set_Implicit_Identities:
          case ShConstants.Identity_Set_Alias_Identities:
            // for the moment Alias_Identities & Implicit_Identities are interpreted as beeing the
            // same thing
            impuList = IMPU_DAO.get_all_from_set(session, impu.getId_implicit_set());
            break;
        }

        // add the IMPUs to the response
        if (impuList == null) {
          logger.error("IMPU List is NULL. The list should contain at least one element!");
          return;
        }
        for (int i = 0; i < impuList.size(); i++) {
          IMPU crtIMPU = (IMPU) impuList.get(i);
          if (i == 0) {
            // add the identity type for all the IMPUs
            pIdentityElement.setIdentityType(crtIMPU.getType());
          }
          pIdentityElement.addPublicIdentity(crtIMPU.getIdentity());
        }

        break;

      case ShConstants.Data_Ref_IMS_User_State:
        shIMSData.setImsUserState(impu.getUser_state());
        break;

      case ShConstants.Data_Ref_SCSCF_Name:
        List impiList = IMPI_DAO.get_all_IMPI_for_IMPU_ID(session, impu.getId());
        if (impiList != null && impiList.size() > 0) {
          IMPI impi = (IMPI) impiList.get(0);
          String scscfName = IMSU_DAO.get_SCSCF_Name_by_IMSU_ID(session, impi.getId_imsu());
          shIMSData.setScscfName(scscfName);

          if (scscfName == null) {
            shIMSData.setAddEmptySCSCFName(true);
          }
        }
        break;

      case ShConstants.Data_Ref_iFC:
        ApplicationServer serviceAS =
            ApplicationServer_DAO.get_by_Server_Name(session, server_name);
        if (serviceAS == null) {
          logger.error(
              "The Server-Name AS was not found in the HSS!!! Aborting from addShData()...");
          return;
        }

        List ifcList = IFC_DAO.get_all_IFCs_by_IMPU_ID_and_DSAI_Value_Active(session, impu.getId());
        if (ifcList != null) {
          ApplicationServerElement asElement = new ApplicationServerElement();
          asElement.setDefaultHandling(serviceAS.getDefault_handling());
          asElement.setServerName(serviceAS.getServer_name());
          asElement.setServiceInfo(serviceAS.getService_info());

          Iterator it = ifcList.iterator();
          while (it.hasNext()) {
            IFC crt_ifc = (IFC) it.next();
            if (crt_ifc.getId_application_server() == serviceAS.getId()) {
              InitialFilterCriteriaElement ifcElement = new InitialFilterCriteriaElement();

              ifcElement.setApplicationServer(asElement);
              SP_IFC sp_ifc =
                  SP_IFC_DAO.get_by_SP_and_IFC_ID(session, impu.getId_sp(), crt_ifc.getId());
              ifcElement.setPriority(sp_ifc.getPriority());
              ifcElement.setProfilePartIndicator(crt_ifc.getProfile_part_ind());

              // set the trigger point
              TP tp = TP_DAO.get_by_ID(session, crt_ifc.getId_tp());
              if (tp != null) {
                TriggerPointElement tpElement = new TriggerPointElement();
                tpElement.setConditionTypeCNF(tp.getCondition_type_cnf());

                List sptList = SPT_DAO.get_all_by_TP_ID(session, tp.getId());
                if (sptList != null) {
                  Iterator it2 = sptList.iterator();
                  SPT crt_spt;
                  SPTElement sptElement;
                  while (it2.hasNext()) {
                    crt_spt = (SPT) it2.next();
                    sptElement = new SPTElement();
                    sptElement.setConditionNegated(crt_spt.getCondition_negated());
                    sptElement.setGroupID(crt_spt.getGrp());

                    sptElement.setMethod(crt_spt.getMethod());
                    sptElement.setRequestURI(crt_spt.getRequesturi());
                    if (crt_spt.getSession_case() != null) {
                      sptElement.setSessionCase(crt_spt.getSession_case());
                    }
                    sptElement.setSessionDescLine(crt_spt.getSdp_line());
                    sptElement.setSessionDescContent(crt_spt.getSdp_line_content());
                    sptElement.setSipHeader(crt_spt.getHeader());
                    sptElement.setSipHeaderContent(crt_spt.getHeader_content());

                    // extension
                    sptElement.addRegistrationType(crt_spt.getRegistration_type());
                    tpElement.addSPT(sptElement);
                  }
                }
                ifcElement.setTriggerPoint(tpElement);
              }
              shIMSData.addInitialFilterCriteria(ifcElement);
            }
          }
        }
        if (shIMSData.getIfcList() == null) {
          shIMSData.setAddEmptyIFCs(true);
        }
        break;

      case ShConstants.Data_Ref_Charging_Info:
        if (shIMSData == null) {
          shIMSData = new ShIMSDataElement();
          shData.setShIMSData(shIMSData);
        }
        ChargingInfo chgInfo = ChargingInfo_DAO.get_by_ID(session, impu.getId());

        ChargingInformationElement chgInfoElement = new ChargingInformationElement();
        chgInfoElement.setPriCCFName(chgInfo.getPri_ccf());
        chgInfoElement.setSecCCFName(chgInfo.getSec_ccf());
        chgInfoElement.setPriECFName(chgInfo.getPri_ecf());
        chgInfoElement.setSecECFName(chgInfo.getSec_ecf());
        shIMSData.setChgInformation(chgInfoElement);
        break;

      case ShConstants.Data_Ref_PSI_Activation:
        if (shIMSData == null) {
          shIMSData = new ShIMSDataElement();
          shData.setShIMSData(shIMSData);
        }
        shIMSData.setPsiActivation(impu.getPsi_activation());
        break;

      case ShConstants.Data_Ref_Location_Info:
        break;

      case ShConstants.Data_Ref_User_State:
        break;

        /** Added Jo?o Vitor Torres contribution for MSISDN */
      case ShConstants.Data_Ref_MSISDN:
        PublicIdentityElement msisdn = shData.getPublicIdentifiers();
        if (msisdn == null) {
          msisdn = new PublicIdentityElement();
          shData.setPublicIdentifiers(msisdn);
        }
        impuList = IMPU_DAO.get_all_within_same_IMPI_Associations(session, impu.getId());
        // add the IMPUs to the response
        if (impuList == null) {
          logger.error("IMPU List is NULL. The list should contain at least one element!");
          return;
        }

        for (int i = 0; i < impuList.size(); i++) {
          IMPU crtIMPU = (IMPU) impuList.get(i);
          if (crtIMPU.getIdentity().matches("(tel:)?[0-9]+")) {
            if (i == 0) {
              // add the identity type for all the IMPUs
              msisdn.setIdentityType(crtIMPU.getType());
            }
            msisdn.addMSISDN(
                crtIMPU.getIdentity().substring(crtIMPU.getIdentity().indexOf(":") + 1));
          }
        }
        break;

      case ShConstants.Data_Ref_DSAI:
        if (shIMSData == null) {
          shIMSData = new ShIMSDataElement();
          shData.setShIMSData(shIMSData);
        }

        DSAI dsai = DSAI_DAO.get_by_Dsai_tag(session, dsai_tag);
        if (dsai == null) {
          new ShExperimentalResultException(
              DiameterConstants.ResultCode.RC_IMS_DIAMETER_ERROR_DSAI_NOT_AVAILABLE);
        } else {
          int id_impu = impu.getId();
          int id_dsai = dsai.getId();
          DSAI_IMPU dsai_impu = DSAI_IMPU_DAO.get_by_DSAI_and_IMPU_ID(session, id_dsai, id_impu);
          if (dsai_impu == null) {
            new ShExperimentalResultException(
                DiameterConstants.ResultCode.RC_IMS_DIAMETER_ERROR_DSAI_NOT_AVAILABLE);
          }

          DSAIElement dsai_element = new DSAIElement();
          dsai_element.setTag(dsai_tag);
          // this dsai_value is associated only with the impu
          dsai_element.setValue(dsai_impu.getDsai_value());
          shIMSData.addDSAI(dsai_element);
        }
        break;
    }
  }