Package com.ufis_as.ek_if.linedena.entities

Examples of com.ufis_as.ek_if.linedena.entities.EntDbAircraftOpsMsg


    protected EntityManager getEntityManager() {
        return em;
    }
   
    public EntDbAircraftOpsMsg getExsitRecord(EntDbAircraftOpsMsg entDbAircraftOpsMsg, BigDecimal sequenceNumber){
      EntDbAircraftOpsMsg existRecord = null;
     
      Query query = em.createNamedQuery("EntDbAircraftOpsMsg.findRecord");
    query.setParameter("idFlight", entDbAircraftOpsMsg.getIdFlight());
    query.setParameter("msgSeqnNum", sequenceNumber);
//    query.setParameter("closeMsgFlag", closeMsgFlag);
View Full Code Here


      query.setParameter("fltRegn", entDbAircraftOpsMsg.getFltRegn());
      List<EntDbAircraftOpsMsg> opsMsgList = query.getResultList();
      if (opsMsgList != null && opsMsgList.size() >0){
        Iterator<EntDbAircraftOpsMsg> it = opsMsgList.iterator();
        while (it.hasNext()){
          EntDbAircraftOpsMsg existOpsMsg = it.next();
          existOpsMsg.setAtot(atot);
          existOpsMsg.setAldt(aldt);
          if (adid.equalsIgnoreCase(existOpsMsg.getArrDepFlag())){
            existOpsMsg.setIdFlight(idFlight);
          }else{
            existOpsMsg.setIdRflight(idFlight);
          }
//          try {
          existOpsMsg.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
//        } catch (ParseException e) {
//          LOG.error("ERROR when getting current UTC time : {}", e.toString());
//        }
          existOpsMsg.setUpdatedUser(HpEKConstants.DeNA_DATA_SOURCE);
          em.merge(existOpsMsg);  
        }
      }
    }
View Full Code Here

      // }

    } else if ("UPD".equals(subtype)) {
      // search from entDbAircraftOpsMsg table

      EntDbAircraftOpsMsg existRecord = _dlLineDeNABean.getExsitRecord(
          entDbAircraftOpsMsg, entDbAircraftOpsMsg.getMsgSeqnNum());
      if (existRecord != null) {

        EntDbAircraftOpsMsg OldEntDbAircraftOpsMsg = (EntDbAircraftOpsMsg) SerializationUtils
            .clone(existRecord);

        // // entDbAircraftOpsMsg.setId(existRecord.getId());
        // //
        // entDbAircraftOpsMsg.setCreatedDate(existRecord.getCreatedDate());
        // //
        // existRecord.setActionReqd(entDbAircraftOpsMsg.getActionReqd());
        // //
        // existRecord.setAddTimeMins(entDbAircraftOpsMsg.getAddTimeMins());
        // //
        // existRecord.setAddTimeReqd(entDbAircraftOpsMsg.getAddTimeReqd());
        // //
        // existRecord.setArrDepFlag(entDbAircraftOpsMsg.getArrDepFlag());
        // //
        // existRecord.setAssistReqd(entDbAircraftOpsMsg.getAssistReqd());
        // existRecord.setCloseMsgFlag(entDbAircraftOpsMsg.getCloseMsgFlag());
        // //
        // existRecord.setDefectDetails(entDbAircraftOpsMsg.getDefectDetails());
        // //
        // existRecord.setDeptName(entDbAircraftOpsMsg.getDeptName());
        // //
        // existRecord.setFlightNumber(entDbAircraftOpsMsg.getFlightNumber());
        // // existRecord.setFltDate(entDbAircraftOpsMsg.getFltDate());
        // // existRecord.setFltRegn(entDbAircraftOpsMsg.getFltRegn());
        // //
        // existRecord.setMsgPostDate(entDbAircraftOpsMsg.getMsgPostDate());
        // //
        // existRecord.setMsgSendDate(entDbAircraftOpsMsg.getMsgSendDate());
        // //
        // existRecord.setMsgSeqnNum(entDbAircraftOpsMsg.getMsgSeqnNum());
        // //
        // existRecord.setMsgSubject(entDbAircraftOpsMsg.getMsgSubject());
        // //
        // existRecord.setNextUpdDate(entDbAircraftOpsMsg.getNextUpdDate());
        // // existRecord.setOptLock(entDbAircraftOpsMsg.getOptLock());
        // //
        // existRecord.setPublishTo(entDbAircraftOpsMsg.getPublishTo());
        // existRecord.setIdFlight(entDbAircraftOpsMsg.getIdFlight());

        _dlLineDeNABean.UpdateSameRegnRecords(existRecord);
        _dlLineDeNABean.Update(existRecord);

        // send change notification
        ufisTopicProducer.sendNotification(true, UfisASCommands.URT,
            String.valueOf(existRecord.getIdFlight()),
            OldEntDbAircraftOpsMsg, existRecord);

      } else if (existRecord == null) {
        LOG.debug("Record not found, Msg will not be updated");
        entDbAircraftOpsMsg.setUpdatedUser("");
        _dlLineDeNABean.UpdateSameRegnRecords(entDbAircraftOpsMsg);
        _dlLineDeNABean.Persist(entDbAircraftOpsMsg);

        // send change notification
        ufisTopicProducer.sendNotification(true, UfisASCommands.IRT,
            String.valueOf(entDbAircraftOpsMsg.getIdFlight()),
            null, entDbAircraftOpsMsg);

      }
    } else if ("DEL".equalsIgnoreCase(subtype)) {

      EntDbAircraftOpsMsg existRecord = _dlLineDeNABean.getExsitRecord(
          entDbAircraftOpsMsg, entDbAircraftOpsMsg.getMsgSeqnNum());

      EntDbAircraftOpsMsg OldEntDbAircraftOpsMsg = (EntDbAircraftOpsMsg) SerializationUtils
          .clone(existRecord);

      if (existRecord != null) {
        existRecord.setRecStatus("X");
        _dlLineDeNABean.Update(existRecord);
View Full Code Here

    // e);
    // return;
    // }

    if (entUfisMsgDTOReceive != null) {
      EntDbAircraftOpsMsg entDbAircraftOpsMsg = new EntDbAircraftOpsMsg();

      List<EntUfisMsgACT> entUfisMsgACTList = entUfisMsgDTOReceive
          .getBody().getActs();
      Iterator<EntUfisMsgACT> entUfisMsgACTIt = entUfisMsgACTList
          .iterator();
      while (entUfisMsgACTIt.hasNext()) {
        EntUfisMsgACT entUfisMsgACT = entUfisMsgACTIt.next();
        List<String> flds = entUfisMsgACT.getFld();
        List<Object> values = entUfisMsgACT.getData();
        BigDecimal idFlight = new BigDecimal(entUfisMsgACT.getId().get(
            0));

        // aldt, alot , fltId, regn need to be set
        Date aldt = null;
        Date atot = null;
        String flitRegn = null;

        for (int i = 0; i < flds.size(); i++) {
          switch (flds.get(i).toUpperCase()) {
          // case "ID_FLIGHT":
          // idFlight = new BigDecimal(values.get(i));
          // break;
          case "ALDT":
            try {
              aldt = HpEKConstants.DENA_DATE_FORMAT
                  .parse((String) values.get(i));
            } catch (ParseException e) {
              LOG.error(
                  "aldt Date convertion erro from String {} while handling msg from AMQ, erro: {}",
                  values.get(i), e);
            }
            break;
          case "ATOT":
            try {
              atot = HpEKConstants.DENA_DATE_FORMAT
                  .parse((String) values.get(i));
            } catch (ParseException e) {
              LOG.error(
                  "atot Date convertion erro from String {} while handling msg from AMQ, erro: {}",
                  values.get(i), e);
            }
            break;
          case "REGN":
            flitRegn = (String) values.get(i);
            break;
          }

        }

        entDbAircraftOpsMsg.setAldt(aldt);
        entDbAircraftOpsMsg.setAtot(atot);
        entDbAircraftOpsMsg.setIdFlight(idFlight);
        entDbAircraftOpsMsg.setFltRegn(flitRegn);

        long startTime = System.currentTimeMillis();
        _dlLineDeNABean.UpdateSameRegnRecords(entDbAircraftOpsMsg);
        LOG.info(
            "update same regn records by receiving msg from AMQ, takes {} ms",
View Full Code Here

  public boolean readStoreLineDeNa(OpsFlashMsg opsFlashMsg) {
    if (opsFlashMsg != null) {
     
         logLevel = entStartupInitSingleton.getIrmLogLev();
     
      EntDbAircraftOpsMsg edpiod = new EntDbAircraftOpsMsg();

      /* Meta */
      if (opsFlashMsg.getMeta() != null) {
        // set MsgSendDate
        if (opsFlashMsg.getMeta().getMessageTime() != null) {
          edpiod.setMsgSendDate(convertXMLGregorianCalendarToDate(opsFlashMsg
              .getMeta().getMessageTime()));
        } else {
          LOG.info("Mandatory field Message Time is null, Line DeNA message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // set ID
        edpiod.setId((UUID.randomUUID()).toString());

        // // set messageId
        // edpiod.setMsgId(new
        // BigDecimal(opsFlashMsg.getMeta().getMessageID()));

        // check Type
        if (opsFlashMsg.getMeta().getType() == null) {
          LOG.info("Mandatory field Message Type is null, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }
        if (!"OpsFlash".equalsIgnoreCase(opsFlashMsg.getMeta()
            .getType())) {
          LOG.info("Mandatory field Message Type is not OpsFlash, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // set subtype
        if (opsFlashMsg.getMeta().getSubtype() != null) {
          subtype = opsFlashMsg.getMeta().getSubtype();
        } else {
          LOG.info("Mandatory field subtype is null, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }
        if (!("UPD"
            .equalsIgnoreCase(opsFlashMsg.getMeta().getSubtype())
            || "INS".equalsIgnoreCase(opsFlashMsg.getMeta()
                .getSubtype()) || "DEL"
              .equalsIgnoreCase(opsFlashMsg.getMeta()
                  .getSubtype()))) {
          LOG.info("Mandatory field subtype is nither UPD, INS or DEL, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // check source
        if (opsFlashMsg.getMeta().getSource() == null) {
          LOG.info("Mandatory field Message Source is null, Line DeNA message is rejected");
          return false;
        }
        if (!"DeNA".equalsIgnoreCase(opsFlashMsg.getMeta().getSource())) {
          LOG.info("Mandatory field Message Source is not DeNA, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

      } else {
        LOG.info("Mandatory field Meta is null, Line DeNA message is rejected");
        sendErroNotification(EnumExceptionCodes.EMAND);
        return false;
      }

      /* FlightId */
      if (opsFlashMsg.getFlightId() != null) {
        if (opsFlashMsg.getFlightId().getCxCd() != null
            && opsFlashMsg.getFlightId().getFltNo() != null
            && !opsFlashMsg.getFlightId().getCxCd().isEmpty()
            && !opsFlashMsg.getFlightId().getFltNo().isEmpty()) {
          // set flight number
          edpiod.setFlightNumber(opsFlashMsg.getFlightId().getCxCd()
              .trim()
              + HpUfisUtils.formatCedaFltn(opsFlashMsg
                  .getFlightId().getFltNo().trim()));
        }

        // set flt date, need to convert local time to UTC time
        // haven't convert the time to UTC yet !!!!!! later
        edpiod.setFltDate(convertXMLGregorianCalendarToDate(opsFlashMsg
            .getFlightId().getFltDate()));

        // set arr dep flag
        if (opsFlashMsg.getFlightId().getArrDepFlag() != null
            && ("A".equals(opsFlashMsg.getFlightId()
                .getArrDepFlag()) || "D".equals(opsFlashMsg
                .getFlightId().getArrDepFlag()))) {
          edpiod.setArrDepFlag(opsFlashMsg.getFlightId()
              .getArrDepFlag());
        } else {
          edpiod.setArrDepFlag("");
        }

        // set flt regn
        if (opsFlashMsg.getFlightId().getACRegNo() != null
            && !opsFlashMsg.getFlightId().getACRegNo().isEmpty()) {
          edpiod.setFltRegn(opsFlashMsg.getFlightId().getACRegNo());
        } else {
          LOG.info("Mandatory field Aircraftreg is null or empty, Line DeNA message opsFlashMsg.getFlightId().getACRegNo() is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

      }

      /* OpFlashDetails */
      if (opsFlashMsg.getOpsFlashDetails() != null) {

        // set depaartment
        if (opsFlashMsg.getOpsFlashDetails().getDepartment() != null) {
          // edpiod.setCreatedUser(opsFlashMsg.getOpsFlashDetails().getDepartment());
          // edpiod.setUpdatedUser(opsFlashMsg.getOpsFlashDetails().getDepartment());
          edpiod.setDeptName(opsFlashMsg.getOpsFlashDetails()
              .getDepartment());
        } else {
          LOG.info("Mandatory field Department is null or empty, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // // set create/update user
        // edpiod.setCreatedUser("DeNA");
        // edpiod.setUpdatedUser("DeNA");

        // set subject
        if (opsFlashMsg.getOpsFlashDetails().getSubject() != null) {
          edpiod.setMsgSubject(opsFlashMsg.getOpsFlashDetails()
              .getSubject());
        } else {
          LOG.info("Mandatory field Subject is null or empty, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // set reason
        if (opsFlashMsg.getOpsFlashDetails().getReason() != null
            && !opsFlashMsg.getOpsFlashDetails().getReason()
                .isEmpty()) {
          edpiod.setOpsReason(opsFlashMsg.getOpsFlashDetails()
              .getReason());
        } else {
          LOG.info("Mandatory field Reason is null or empty, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // set defect details
        if (opsFlashMsg.getOpsFlashDetails().getDefectDetails() != null
            && !opsFlashMsg.getOpsFlashDetails().getDefectDetails()
                .isEmpty()) {
          edpiod.setDefectDetails(opsFlashMsg.getOpsFlashDetails()
              .getDefectDetails());
        } else {
          edpiod.setDefectDetails("");
        }

        // set add time reqd
        if (opsFlashMsg.getOpsFlashDetails().getAddTimeFromStd() != null
            && !opsFlashMsg.getOpsFlashDetails()
                .getAddTimeFromStd().isEmpty()) {
          edpiod.setAddTimeReqd(opsFlashMsg.getOpsFlashDetails()
              .getAddTimeFromStd());
        } else {
          edpiod.setAddTimeReqd("");
        }

        // set next upd date
        if (opsFlashMsg.getOpsFlashDetails().getNextUpdate() != null) {
          edpiod.setNextUpdDate(convertXMLGregorianCalendarToDate(opsFlashMsg
              .getOpsFlashDetails().getNextUpdate()));
        }
        // }else{
        // LOG.info("Mandatory field next upd date is null, Line DeNA message is rejected");
        // return false;
        // }

        // set assist reqd
        if (opsFlashMsg.getOpsFlashDetails().getAssistRequired() != null) {
          edpiod.setAssistReqd(opsFlashMsg.getOpsFlashDetails()
              .getAssistRequired());
        } else {
          edpiod.setAssistReqd("");
        }

        // set action reqd
        if (opsFlashMsg.getOpsFlashDetails().getActionRequired() != null) {
          edpiod.setActionReqd(opsFlashMsg.getOpsFlashDetails()
              .getActionRequired());
        } else {
          edpiod.setActionReqd("");
        }

        // set publishto
        if (opsFlashMsg.getOpsFlashDetails().getPublishTo() != null
            && !opsFlashMsg.getOpsFlashDetails().getPublishTo()
                .isEmpty()) {
          edpiod.setPublishTo(opsFlashMsg.getOpsFlashDetails()
              .getPublishTo());
        } else {
          LOG.info("Mandatory field publish to is null, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // set msg seqn num
        if (opsFlashMsg.getOpsFlashDetails().getOpsSeq() != 0) {
          edpiod.setMsgSeqnNum(new BigDecimal(opsFlashMsg
              .getOpsFlashDetails().getOpsSeq()));
        } else {
          LOG.info("Mandatory field msg seqn num is null, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
        }

        // set final msg flag
        if (opsFlashMsg.getOpsFlashDetails().getCloseMsgSeq() != null) {
          edpiod.setCloseMsgFlag(opsFlashMsg.getOpsFlashDetails()
              .getCloseMsgSeq());
        } else {
          edpiod.setCloseMsgFlag("");
        }

        // set msg post date
        // need to convert local to UTC later
        if (opsFlashMsg.getOpsFlashDetails().getMsgPostedTime() != null) {
          edpiod.setMsgPostDate(convertXMLGregorianCalendarToDate(opsFlashMsg
              .getOpsFlashDetails().getMsgPostedTime()));
        } else {
          LOG.info("Mandatory fieldmsg post date is null, Line DeNA message is rejected");
          sendErroNotification(EnumExceptionCodes.EMAND);
          return false;
View Full Code Here

TOP

Related Classes of com.ufis_as.ek_if.linedena.entities.EntDbAircraftOpsMsg

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.