Esempio n. 1
0
  /**
   * Cleans For MIE Transformation. The intent of this method is to house "cleansing" operations
   * that must occur on the BMS in order to transform to an assignment MIE. Ideally the cleansing
   * would occur in the transformation but it is MUM at the point in time of the creation of this
   * class... If an AssignmentAddRq exists in the provide CIECA Document then a cleansed version of
   * the CIECADocument is returned, otherwise a copy of the provided Document is returned as is. The
   * fields that are cleansed are based on the logic in the BMS to MIE transformation, not every
   * single field in the BMS.
   *
   * @param ciecaDoc A CIECADocument. Nothing really happens unless the AssignmentAddRq is
   *     populated.
   * @return Returns a copy of the input CIECADocument. In the case where the input does include an
   *     AssignmentAddRq, that portion of the Document is cleansed for "to MIE" transformation.
   */
  public CIECADocument cleansForMIETransformation(CIECADocument ciecaDoc) {
    CIECADocument cDoc = null;
    if (ciecaDoc != null) {

      // Make a copy of the document so that the input is not modified
      cDoc = (CIECADocument) ciecaDoc.copy();

      // If there is an assignment then cleanse it
      AssignmentAddRq asgAddRq = cDoc.getCIECA().getAssignmentAddRq();
      if (asgAddRq != null) {

        asgAddRq = cleanseAsgAddRqForMIE(asgAddRq);
      }
    }
    return cDoc;
  }
  //
  // --  New method for Jetta/SIP3.5 -
  //
  public void cancelAssignment(AssignmentServiceContext context)
      throws AssignmentDeliveryException {

    final String thisMethod = "cancelAssignment(AssignmentServiceContext context)";
    entering(thisMethod);

    // TODO is validation required for this ADS Cancel interface?

    // Validate the input param
    // context.validate();
    // mLogger.fine("Input AssignmentServiceContext is valid.");

    long arid = 0; // NOTE: no archive ID for Cancel interface, nothing to archive.
    String workItemId = context.getWorkItemId();

    String appLogTxType = ECLAIM_CANCELLATION_ALERT_SENT_SUCCESS_APPLOG_TRNS_TYPE_FILE;

    try {
      // Get CIECADocument from MitchellEnvelope
      CIECADocument ciecaDoc =
          handlerUtils.getCiecaDocFromMitchellEnv(context.getMitchellEnvDoc(), workItemId);

      // Get ClaimNumber from Cieca Doc
      String claimNumber = "";
      if (ciecaDoc != null) {
        claimNumber = ciecaDoc.getCIECA().getAssignmentAddRq().getClaimInfo().getClaimNum();
      }

      if (mLogger.isLoggable(Level.INFO)) {
        mLogger.info(
            "***** cancelAssignment: DEBUG - In ciecaDoc, claimNumber = [ " + claimNumber + " ]");
      }

      // If Not Original Or Supplement, reject delivery and throw fatal error
      rejectDeliveryIfNeitherOriginalNorSuppliment(thisMethod, workItemId, ciecaDoc);

      // Determine Assignment Type - Must be either Original or Supplement
      boolean isOriginal = false;

      isOriginal = handlerUtils.isOriginalAssignment(ciecaDoc);

      // Determine correct UserInfo to provide to EClaim Alert Service - UserInfo or DRPUserInfo
      //
      UserInfoDocument userInfoDoc = null;
      if (context.isDrp()) {
        userInfoDoc = context.getDrpUserInfo();
        if (mLogger.isLoggable(Level.INFO)) {
          mLogger.info("*******DRPUSER for Cancellation **************");
          mLogger.info("********Successfully found DRP UserInfo  = " + userInfoDoc);
        }
      } else {
        userInfoDoc = context.getUserInfo();
        if (mLogger.isLoggable(Level.INFO)) {
          mLogger.info("*******not a DRPUSER for Cancellation **************");
          mLogger.info("********Successfully found non-DRP UserInfo = " + userInfoDoc);
        }
      }

      // Design/Implementation Assumptions & Constraints (09.15.09) --
      //
      //  1a. CompanyCode and UserID will be obtained from the proper UserInfo doc provided in the
      // ADS Context.
      //  1b. workItemID will be obtained from the ADS Context.
      //  2.  The Message Content for "msg" sent to ECM AlertService
      //      will be provided in a SET File Param with a ciecaClaimNumber appended.
      //  3.  The Originator will be a constant defined as the calling service/app.
      //     (  see reference ECALIM_ALERT_ORIGIN - StateFarmMCFJava/WorkflowConstants.java )

      // Submit the Cancellation Global Alert to EClaim --
      //  Note: UserInfoDoc is a Required Input --
      if (userInfoDoc != null) {
        handlerUtils.sendCancellationECAlert(claimNumber, userInfoDoc, isOriginal, workItemId);

        // Write the log in App Log (call super class method)
        //       NOTE: no archive ID (arid) for Cancel interface, nothing to archive
        arid = 0;
        logEClaimSubmissionEvent(context, ciecaDoc, arid, workItemId, appLogTxType);
        if (mLogger.isLoggable(Level.INFO)) {
          mLogger.info("Successfully logged the EClaim Submission Event for Cancellation.");
        }

      } else {
        mLogger.severe(
            "cancelAssignment: Assignment Delivery Svc Cancellation unable to submit EClaim Alert - missing required Inputs..");

        errorLoggingService.logError(
            AssignmentDeliveryErrorCodes.INCOMPLETE_CONTEXT_INFO_FOR_ECM_ALERT_ERROR,
            null,
            getClassName(),
            thisMethod,
            ErrorLoggingService.SEVERITY.FATAL,
            workItemId,
            "Assignment Delivery Service Cancellation unable to submit EClaim Alert.",
            null,
            0,
            null);
        throw mLogger.createException(
            AssignmentDeliveryErrorCodes.INCOMPLETE_CONTEXT_INFO_FOR_ECM_ALERT_ERROR, workItemId);
      }

    } catch (AssignmentDeliveryException adse) {
      throw adse;
    } catch (Exception e) {
      logException(thisMethod, workItemId, e);
    } finally {
      try {
        if (mLogger.isLoggable(Level.INFO)) {
          mLogger.info("Successfully completed cancelAssignment.");
        }
      } catch (Exception e) {
        logException(thisMethod, workItemId, e);
      }
      mLogger.exiting(getClassName(), thisMethod);
    }
  }