Esempio n. 1
0
  // (callStartTime, callEndTime, callDurationInPulses, endOfUsagePromptCount, callStatus,
  // callDisconnectReason)
  private String validateCallDetailsCommonElements(
      CallDetailRecordRequest callDetailRecordRequest) {
    StringBuilder failureReasons = new StringBuilder();

    if (null == callDetailRecordRequest.getCallStartTime()) {
      failureReasons.append(String.format(NOT_PRESENT, "callStartTime"));
    }

    if (null == callDetailRecordRequest.getCallEndTime()) {
      failureReasons.append(String.format(NOT_PRESENT, "callEndTime"));
    }

    if (null == callDetailRecordRequest.getCallDurationInPulses()) {
      failureReasons.append(String.format(NOT_PRESENT, "callDurationInPulses"));
    }

    if (null == callDetailRecordRequest.getEndOfUsagePromptCounter()) {
      failureReasons.append(String.format(NOT_PRESENT, "endOfUsagePromptCount"));
    }

    if (null == callDetailRecordRequest.getCallStatus()) {
      failureReasons.append(String.format(NOT_PRESENT, "callStatus"));
    }

    if (null == callDetailRecordRequest.getCallDisconnectReason()) {
      failureReasons.append(String.format(NOT_PRESENT, "callDisconnectReason"));
    }

    return failureReasons.toString();
  }
Esempio n. 2
0
  private void createCallDetailRecord(
      FrontLineWorker flw, CallDetailRecordRequest callDetailRecordRequest, Service service) {
    CallDetailRecord cdr = new CallDetailRecord();
    cdr.setFrontLineWorker(flw);
    cdr.setCallingNumber(callDetailRecordRequest.getCallingNumber());
    cdr.setCallId(callDetailRecordRequest.getCallId());
    cdr.setOperator(callDetailRecordRequest.getOperator());
    cdr.setCircle(callDetailRecordRequest.getCircle());
    cdr.setCallStartTime(
        new DateTime(callDetailRecordRequest.getCallStartTime() * MILLISECONDS_PER_SECOND));
    cdr.setCallEndTime(
        new DateTime(callDetailRecordRequest.getCallEndTime() * MILLISECONDS_PER_SECOND));
    cdr.setCallDurationInPulses(callDetailRecordRequest.getCallDurationInPulses());
    cdr.setEndOfUsagePromptCounter(callDetailRecordRequest.getEndOfUsagePromptCounter());
    cdr.setCallStatus(callDetailRecordRequest.getCallStatus());
    cdr.setCallDisconnectReason(callDetailRecordRequest.getCallDisconnectReason());

    if (service == Service.MOBILE_KUNJI) {
      cdr.setWelcomePrompt(callDetailRecordRequest.getWelcomeMessagePromptFlag());
    }

    callDetailRecordService.add(cdr);

    for (CallContentRequest callContentRequest : callDetailRecordRequest.getContent()) {
      CallContent content = new CallContent();

      content.setContentName(callContentRequest.getContentName());
      content.setContentFile(callContentRequest.getContentFileName());
      content.setStartTime(
          new DateTime(callContentRequest.getStartTime() * MILLISECONDS_PER_SECOND));
      content.setEndTime(new DateTime(callContentRequest.getEndTime() * MILLISECONDS_PER_SECOND));

      if (service == Service.MOBILE_KUNJI) {
        content.setMobileKunjiCardCode(callContentRequest.getMkCardCode());
      }

      if (service == Service.MOBILE_ACADEMY) {
        content.setType(callContentRequest.getType());
        content.setCompletionFlag(callContentRequest.getCompletionFlag());
      }

      content.setCallDetailRecord(cdr);

      callContentService.add(content);
    }
  }