Package ek.iams

Examples of ek.iams.CrewStatusDetails


      data.clear();
     
      // set urno of irmtab
      irmtabUrno = irmtabRef;
    try {
      CrewStatusDetails _input = (CrewStatusDetails) _um.unmarshal(new StreamSource(new StringReader(message)));
     
      if(HpUfisUtils.isNullOrEmptyStr(_input.getArrOrDep())
          || HpUfisUtils.isNullOrEmptyStr(_input.getOriginator())){
        LOG.error("Input Crew Status details mandatory info are missing. Message dropped.");
        addExptInfo(EnumExceptionCodes.EMAND.name(), "");
        return false;
      }else{
        if(!"D".equals(_input.getArrOrDep())){
          LOG.error("Processing performs only for Departure. Message dropped.");
          //clsBlIrmtabFacade.updateIRMStatus("NotDepFlt");
          addExptInfo(EnumExceptionCodes.ENDEP.name(), _input.getArrOrDep());
          return false;
        }
        if(!"IAM".equals(_input.getOriginator())){
          LOG.error("Processing performs only for IAM Originator. Message dropped.");
          //clsBlIrmtabFacade.updateIRMStatus("UnknownSrc");
          addExptInfo(EnumExceptionCodes.EWSRC.name(), _input.getOriginator());
          return false;
        }       
      }
      if(HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getCxCd())
          || _input.getFlightID().getFltDate() == null
          || HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getFltNum())
          || HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getArrStn())
          || HpUfisUtils.isNullOrEmptyStr(_input.getFlightID().getDepStn())
          || HpUfisUtils.isNullOrEmptyStr(String.valueOf(_input.getFlightID().getDepNum()))){
        LOG.error("Input Flight ID info are missing. Message dropped.");
        addExptInfo(EnumExceptionCodes.EMAND.name(), "");
        return false;
      }
      if(!_input.getFlightID().getCxCd().contains("EK")){
        LOG.error("Processing performs only for EK flight. Message dropped.");
        addExptInfo(EnumExceptionCodes.EWALC.name(), _input.getFlightID().getCxCd());
        return false;
      }
      if(HpUfisUtils.isNullOrEmptyStr(_input.getCrewDetails().getStaffNo())
          || HpUfisUtils.isNullOrEmptyStr(_input.getCrewDetails().getCrewType())){
        LOG.error("Input Crew detail mandatory info are missing. Message dropped.");
        addExptInfo(EnumExceptionCodes.EMAND.name(), "");
        return false;
      }
      if(!"C".equals(_input.getCrewDetails().getCrewType())
          && !"F".equals(_input.getCrewDetails().getCrewType())){
        LOG.error("Crew type must be F(Flight Crew) or C(Cabin Crew). Message dropped.");
        addExptInfo(EnumExceptionCodes.EENUM.name(), _input.getCrewDetails().getCrewType());
        return false;
      }
      if(HpUfisUtils.isNullOrEmptyStr(_input.getCrewStatusInfo().getStatus())
          || _input.getCrewStatusInfo().getStatusChageDTM() == null
          || HpUfisUtils.isNullOrEmptyStr(_input.getCrewStatusInfo().getGateDetails().getGateType())){
        LOG.error("Input Crew status mandatory info are missing. Message dropped.");
        addExptInfo(EnumExceptionCodes.EMAND.name(), "");
        return false;
      }
     
      if(!"EGATE".equals(_input.getCrewStatusInfo().getGateDetails().getGateType().trim())
          && !"EXIT_GATE".equals(_input.getCrewStatusInfo().getGateDetails().getGateType().trim())){
        LOG.error("Gate Type is not either EGATE or EXIT_GATE. Message dropped.");
        addExptInfo(EnumExceptionCodes.EENUM.name(), _input.getCrewStatusInfo().getGateDetails().getGateType());
        return false;
      }
     
      String flNum = null;
      Date flDate = null;
      BigDecimal urno = null;
      EntDbAfttab entFlight = null;
      String idGateType = "0";
      String idFltJobAssign = "0";
      Date statusChangeDtm = null;
      String crewActivityFlag = "";
      String fltSuffix = null;
      //List<EntDbMdGateType> gateTypeList = new ArrayList<>();
      EntDbFltJobAssign entFltJobAssign = null;
      String cmd = UfisASCommands.IRT.name();
      //sfDate.setTimeZone(HpEKConstants.utcTz);
     
      if(_input.getCrewStatusInfo().getStatus().contains("FAILURE"))
        crewActivityFlag = "F";
      else if(_input.getCrewStatusInfo().getStatus().contains("SUCCESS"))
          crewActivityFlag = "P";
      else{
        LOG.error("Input Crew status Enumeration value is incorrect. Message dropped.");
        addExptInfo(EnumExceptionCodes.EENUM.name(), _input.getCrewStatusInfo().getStatus());
        return false;
      }
      fltSuffix = (_input.getFlightID().getFltSfx() == null)? "": _input.getFlightID().getFltSfx();
     
      //format ceda flight string
      /*flNum = _input.getFlightID().getCxCd() +" "+
            HpUfisUtils.formatCedaFltn(_input.getFlightID().getFltNum()) + fltSuffix;*/
      flNum = HpUfisUtils.formatCedaFlno(_input.getFlightID().getCxCd(), _input.getFlightID().getFltNum(), fltSuffix);
     
      //convert to ceda flight time to UTC
      flDate = _input.getFlightID().getFltDate().toGregorianCalendar().getTime();
      /*LOG.info("Flight Date:"+flDate);
      LOG.info("Formatted Flight Date:"+sfDate.format(flDate));*/
      //perform only for deptStn = DXB
      if (HpEKConstants.EK_HOPO.equals(_input.getFlightID().getDepStn()))
        entFlight = clsAfttabBeanLocal.findFlightByFlut(flNum, sfDate.format(flDate), _input.getFlightID().getArrStn());
      else{
        LOG.error("Processing performs only for departure station = DXB. Message dropped.");
        addExptInfo(EnumExceptionCodes.ENDEP.name(), _input.getFlightID().getDepStn());
        return false;
      }
     
      if(entFlight == null){
        //urno = new BigDecimal(0);
        LOG.error("Flight flno <{}> is not found. Message dropped.", flNum);
        addExptInfo(EnumExceptionCodes.ENOFL.name(), flNum);
        return false;
      }
      else{
        urno = entFlight.getUrno();
        //get the flt_job_assign by staff_number and id_flight
        entFltJobAssign = clsIDlFltJobAssignLocal.getAssignedCrewIdByFlight(urno, _input.getCrewDetails().getStaffNo(), _input.getCrewDetails().getCrewType());
        idFltJobAssign = (entFltJobAssign == null)? "0" : entFltJobAssign.getId();
      }
     
      /*boolean isFound = false;
      //get MD gate type
      gateTypeList = clsEntStartUpInitSingleton.getGateTypeList();
      for (int i = 0; i < gateTypeList.size(); i++) {
        if(_input.getCrewStatusInfo().getGateDetails().getGateType().equals(gateTypeList.get(i).getGateType())){
          idGateType = gateTypeList.get(i).getId();
          isFound = true; break;
        }
      }
      if(!isFound){
        LOG.warn("Input Gate type is not in MD_GATE_TYPE table.");
        addExptInfo(EnumExceptionCodes.WNOMD.name(), _input.getCrewStatusInfo().getGateDetails().getGateType());
      }*/
      statusChangeDtm = df.parse(convertFlDateToUTC(_input.getCrewStatusInfo().getStatusChageDTM()));
     
      EntDbCrewImmigration entCrew = null, oldEntCrew = new EntDbCrewImmigration();
      //find out existing crew immigration record
      entCrew = clsDlCrewImmigration.getExistingCrewImmigration(flNum, flDate, String.valueOf(_input.getFlightID().getDepNum()),
          String.valueOf(_input.getFlightID().getLegNum()), _input.getCrewDetails().getStaffNo(), _input.getCrewStatusInfo().getGateDetails().getGateType());
     
      if(entCrew == null){
        entCrew = new EntDbCrewImmigration();
        entCrew.setCreatedUser(HpEKConstants.IAMS_SOURCE);
        entCrew.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
        //entCrew.setCreatedDate(statusChangeDtm);
        entCrew.setDepNum(String.valueOf(_input.getFlightID().getDepNum()));
        entCrew.setLegNum(String.valueOf(_input.getFlightID().getLegNum()));
        entCrew.setStaffNumber(_input.getCrewDetails().getStaffNo());
        entCrew.setGateType(_input.getCrewStatusInfo().getGateDetails().getGateType());
        entCrew.setIdMdGateType(idGateType);
        entCrew.setFlightNumber(flNum);
      }
      else{
        oldEntCrew = new EntDbCrewImmigration(entCrew); //deep copy
        cmd = UfisASCommands.URT.name();
        entCrew.setUpdatedUser(HpEKConstants.IAMS_SOURCE);
        entCrew.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
      }
     
      entCrew.setIdFltJobAssign(idFltJobAssign);
      if(_input.getTmStmp() != null
        entCrew.setMsgSendDate(df.parse(convertFlDateToUTC(_input.getTmStmp())));
      entCrew.setStatusChangeDate(statusChangeDtm);
      entCrew.setCrewTypeCode(_input.getCrewDetails().getCrewType());
      entCrew.setCrewActivityStat(_input.getCrewStatusInfo().getStatus());
      entCrew.setCrewActivityFlag(crewActivityFlag);
      entCrew.setStatusRemarks(_input.getCrewStatusInfo().getReason());
      entCrew.setGateNumber(_input.getCrewStatusInfo().getGateDetails().getGateNo());
      entCrew.setGateLocation(_input.getCrewStatusInfo().getGateDetails().getWing());
     
      entCrew.setIdFlight(urno);
      entCrew.setFltDate(flDate);
      entCrew.setFltOrigin3(_input.getFlightID().getDepStn());
      entCrew.setFltDest3(_input.getFlightID().getArrStn());
      entCrew.setDataSource(HpEKConstants.IAMS_SOURCE);
      entCrew.setRecStatus(" ");
     
      EntDbCrewImmigration resultEntCrew = clsDlCrewImmigration.merge(entCrew);
      if(resultEntCrew != null){
View Full Code Here

TOP

Related Classes of ek.iams.CrewStatusDetails

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.