⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 converter.java

📁 用Java实现的TCAP协议
💻 JAVA
📖 第 1 页 / 共 2 页
字号:
  * Converts an RejectReqEvent to an RejectIndEvent component with the specified Object
  * acting as the new Event source
  * @param <var>eventSource</var> the EventSource of the new Component indication
  * @param <var>lastComponent</var> indicates whether this is the last component being sent
  */
  private static RejectIndEvent rejectReqToInd(RejectReqEvent rejectReq,
                                               Object eventSource,
                                               boolean lastComponent) {
    RejectIndEvent rejectInd = null;
    int did = 0;
    int problemType = 0;
    int problem = 0;

    try {
      did = rejectReq.getDialogueId();
    } catch (ParameterNotSetException ex) {}

    try {
      problemType = rejectReq.getProblemType();
    } catch (ParameterNotSetException ex) {}

    try {
      problem = rejectReq.getProblem();
    } catch (ParameterNotSetException ex) {}

    rejectInd = new RejectIndEvent(eventSource,
                                   did,
                                   problemType,
                                   problem,
                                   lastComponent);

    try {
      rejectInd.setInvokeId(rejectReq.getInvokeId());
    } catch (ParameterNotSetException ex) {}

    try {
      rejectInd.setParameters(rejectReq.getParameters());
    } catch (ParameterNotSetException ex) {}

    return (rejectInd);
  }

  /**
  * Converts a ResultReqEvent to a ResultIndEvent component with the specified Object
  * acting as the new Event source
  * @param <var>eventSource</var> the EventSource of the new Component indication
  * @param <var>lastComponent</var> indicates whether this is the last component being sent
  */
  private static ResultIndEvent resultReqToInd(ResultReqEvent resultRequest,
                                               Object eventSource,
                                               boolean lastComponent) {
    ResultIndEvent resultIndication = null;
    int did = 0;

    try {
      did = resultRequest.getDialogueId();
    } catch (ParameterNotSetException ex) {}

    resultIndication = new ResultIndEvent(eventSource,
                                          did,
                                          lastComponent,
                                          resultRequest.isLastResultEvent());

    try {
      resultIndication.setInvokeId(resultRequest.getInvokeId());
    } catch (ParameterNotSetException ex) {}

    try {
      resultIndication.setParameters(resultRequest.getParameters());
    } catch (ParameterNotSetException ex) {}

    try {
      resultIndication.setOperation(resultRequest.getOperation());
    } catch (ParameterNotSetException ex) {}

    return (resultIndication);
  }

  /**
  * Converts a UnidirectionalReqEvent to a UnidirectionalIndEvent dialogue with the specified Object
  * acting as the new Event source
  * @param <var>eventSource</var> the EventSource of the new Dialogue indication
  * @param <var>componentsPresent</var> indicates whether there are any components
  * accompanying this Dialogue primitive
  */
  private static UnidirectionalIndEvent uniReqToInd(UnidirectionalReqEvent uniRequest,
                                                    Object eventSource,
                                                    boolean componentsPresent) {
    UnidirectionalIndEvent uniIndication = null;
    SccpUserAddress origAddress = null;
    SccpUserAddress destAddress = null;

    try {
      origAddress = uniRequest.getOriginatingAddress();
    } catch (ParameterNotSetException ex) {}

    try {
      destAddress = uniRequest.getDestinationAddress();
    } catch (ParameterNotSetException ex) {}

    uniIndication = new UnidirectionalIndEvent(eventSource,
                                               origAddress,
                                               destAddress,
                                               componentsPresent);

    /*try {
      uniIndication.setDialogueId(uniRequest.getDialogueId());
    } catch (ParameterNotSetException e) {}*/

    try {
      uniIndication.setQualityOfService(uniRequest.getQualityOfService());
    } catch (ParameterNotSetException ex) {}

    try {
      uniIndication.setDialoguePortion(uniRequest.getDialoguePortion());
    } catch (ParameterNotSetException ex) {}

    return (uniIndication);
  }

  /**
  * Converts a BeginReqEvent to a BeginIndEvent dialogue with the specified Object
  * acting as the new Event source
  * @param <var>eventSource</var> the EventSource of the new Dialogue indication
  * @param <var>componentsPresent</var> indicates whether there are any components
  * accompanying this Dialogue primitive
  */
  private static BeginIndEvent beginReqToInd(BeginReqEvent beginReq,
                                             Object eventSource,
                                             boolean componentsPresent) {
    BeginIndEvent beginInd = null;
    SccpUserAddress origAddress = null;
    SccpUserAddress destAddress = null;

    int did = 0;

    try {
      origAddress = beginReq.getOriginatingAddress();
    } catch (ParameterNotSetException ex) {}

    try {
      destAddress = beginReq.getDestinationAddress();
    } catch (ParameterNotSetException ex) {}


    try {
      did = beginReq.getDialogueId();
    } catch (ParameterNotSetException e) {}

    beginInd = new BeginIndEvent(eventSource,
                                 did,
                                 origAddress,
                                 destAddress,
                                 componentsPresent);

    try {
      beginInd.setDialoguePortion(beginReq.getDialoguePortion());
    } catch (ParameterNotSetException ex) {}

    try {
      beginInd.setQualityOfService(beginReq.getQualityOfService());
    } catch (ParameterNotSetException ex) {}
    return (beginInd);
  }

  /**
  * Converts a ContinueReqEvent to a ContinueIndEvent dialogue with the specified Object
  * acting as the new Event source
  * @param <var>eventSource</var> the EventSource of the new Dialogue indication
  * @param <var>componentsPresent</var> indicates whether there are any components
  * accompanying this Dialogue primitive
  */
  private static ContinueIndEvent continueReqToInd(ContinueReqEvent continueRequest,
                                                    Object eventSource,
                                                    boolean componentsPresent) {
    ContinueIndEvent continueIndication = null;
    int did = 0;

    try {
      did = continueRequest.getDialogueId();
    } catch (ParameterNotSetException e) {}

    continueIndication = new ContinueIndEvent(eventSource,
                                              did,
                                              componentsPresent);

    try {
      continueIndication.setDialoguePortion(continueRequest.getDialoguePortion());
    } catch (ParameterNotSetException ex) {}

    try {
      continueIndication.setQualityOfService(continueRequest.getQualityOfService());
    } catch (ParameterNotSetException ex) {}

    return (continueIndication);
  }

  /**
  * Converts a EndReqEvent to a EndIndEvent dialogue with the specified Object
  * acting as the new Event source
  * @param <var>eventSource</var> the EventSource of the new Dialogue indication
  * @param <var>componentsPresent</var> indicates whether there are any components
  * accompanying this Dialogue primitive
  */
  private static EndIndEvent endReqToInd(EndReqEvent endReq,
                                         Object eventSource,
                                         boolean componentsPresent) {
    EndIndEvent endInd = null;
    int did = 0;

    try {
      did = endReq.getDialogueId();
    } catch (ParameterNotSetException e) {}

    endInd = new EndIndEvent(eventSource,
                             did,
                             componentsPresent);

    try {
      endInd.setDialoguePortion(endReq.getDialoguePortion());
    } catch (ParameterNotSetException ex) {}

    try {
      endInd.setQualityOfService(endReq.getQualityOfService());
    } catch (ParameterNotSetException ex) {}

    return (endInd);
  }

  /**
  * Converts a UserAbortReqEvent to a UserAbortIndEvent dialogue with the specified Object
  * acting as the new Event source
  * @param <var>eventSource</var> the EventSource of the new Dialogue indication
  * @param <var>componentsPresent</var> indicates whether there are any components
  * accompanying this Dialogue primitive (never used)
  */
  private static UserAbortIndEvent userAbortReqToInd(UserAbortReqEvent userAbortReq,
                                                     Object eventSource,
                                                     boolean componentsPresent) {
    UserAbortIndEvent userAbortInd = null;
    int did = 0;

    try {
      did = userAbortReq.getDialogueId();
    } catch (ParameterNotSetException e) {}

    userAbortInd = new UserAbortIndEvent(eventSource, did);

    try {
      userAbortInd.setDialoguePortion(userAbortReq.getDialoguePortion());
    } catch (ParameterNotSetException ex) {}

    try {
        userAbortInd.setQualityOfService(userAbortReq.getQualityOfService());
    } catch (ParameterNotSetException ex) {}

    try {
      userAbortInd.setUserAbortInformation(userAbortReq.getUserAbortInformation());
    } catch (ParameterNotSetException ex) {}

    try {
      userAbortInd.setAbortReason(userAbortReq.getAbortReason());
    } catch (ParameterNotSetException ex) {}

    return (userAbortInd);
  }
}

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -