/**
   * Builds alert file with all required information - type of event, attachments and sends to
   * ConnectEMC
   */
  protected void buildAlertFile(EmaApiConnectHome alertFile, EmaApiLogType log) throws Exception {
    _log.info("Start SendEvent::buildEventType");
    alertFile.eventAdd(getEventType(), log);

    // Create event file to attach
    String eventFilename = CONNECT_EMC_HOME + EmaApiUtils.emaGenerateFilename(_fileId);
    _log.info("Event filename: {}", eventFilename);
    ArrayList<String> fileList = genAttachFiles();
    BadRequestException badRequestException = null;

    if (fileList != null && !fileList.isEmpty()) {
      boolean attachLogs = true;
      try {
        validateAttachmentSize(fileList);
      } catch (BadRequestException e) {
        if (forceAttachLogs) {
          throw e;
        }
        badRequestException = e;
        attachLogs = false;
      }

      ArrayList<EmaApiFilenameType> attachFiles = new ArrayList<EmaApiFilenameType>();

      if (attachLogs) {
        for (String file : fileList) {
          EmaApiFilenameType filename = new EmaApiFilenameType();
          filename.setQualifiedFileName(file);
          filename.setTargetFileName(getTargetFileName(file));
          attachFiles.add(filename);
        }
      } else { // log size too big, not to attach logs
        for (String file : fileList) {
          if (file.equals(SYSTEM_LOGS_FILE_PATH) || file.equals(SYSTEM_EVENT_FILE_PATH)) {
            continue;
          }
          EmaApiFilenameType filename = new EmaApiFilenameType();
          filename.setQualifiedFileName(file);
          filename.setTargetFileName(getTargetFileName(file));
          attachFiles.add(filename);
        }
        AlertsLogger.getAlertsLogger()
            .warn(
                "ConnectEMC alert will be sent without logs attached due to logs have exceeded max allowed size ("
                    + this.getAttachmentsMaxSizeMB()
                    + " MB)");
      }
      alertFile.addFileRawData(eventFilename, attachFiles, log);
    }
    alertFile.write(eventFilename, log);
    alertFile.emaCreateDotEndFile(eventFilename, log);
    _log.info("Finish SendEvent::buildEventType");
    if (badRequestException != null) {
      throw badRequestException;
    }
  }
 /**
  * Builds the Connection element of ConnectHome
  *
  * @param alertFile
  */
 private void buildConnectionSection(EmaApiConnectHome alertFile) throws EmaException {
   ConnectionType connectionType = alertFile.getNode().getConnection();
   connectionType.setConnectType(CONNECTION_TYPE_ESRS);
   connectionType.setAppName(PRODUCT_NAME);
   connectionType.setPort(SECURED_CONNECTION_PORT);
   connectionType.setIPAddress(_networkIpAddress);
 }
 /** Builds the Identifier element of ConnectHome */
 private void buildIdentifierSection(EmaApiConnectHome alertFile) throws EmaException {
   EmaApiIdentifierType identifier = new EmaApiIdentifierType();
   EmaApiNode node = alertFile.getNode();
   identifier.setClarifyID(licenseInfo.getProductId());
   identifier.setDeviceType(_identifierManager.findDeviceType());
   identifier.setDeviceState(_identifierManager.findDeviceState());
   identifier.setModel(licenseInfo.getModelId());
   identifier.setOS(_identifierManager.findOS());
   identifier.setOSVER(_identifierManager.findOSVersion());
   identifier.setVendor("EMC");
   identifier.setSiteName("");
   identifier.setSerialNumber(licenseInfo.getProductId());
   identifier.setUcodeVer(_identifierManager.findPlatform());
   identifier.setWWN(licenseInfo.getLicenseTypeIndicator());
   node.setIdentifier(identifier);
   overrideIdentifierData(identifier);
 }