Package com.ufis_as.ek_if.rms.entities

Examples of com.ufis_as.ek_if.rms.entities.EntDbFltJobAssign


      return existRecord;
    }
   
   
    public EntDbFltJobAssign getExsitRecord(String idFltJobTask, BigDecimal shiftId){
      EntDbFltJobAssign existRecord = null;
     
      Query query = em.createNamedQuery("EntDbFltJobAssign.findRecordByIdFltJobTaskAndShiftId");
    query.setParameter("idFltJobTask", idFltJobTask);
    query.setParameter("shiftId", shiftId);
   
View Full Code Here


      throws ParseException {
    Date msgSendDate = convertDateToUTC(_input.getMeta().getMessageTime());
    EntDbStaffShift shift = insertShift(idJobTask, urno, _inputStaffDetail, msgSendDate, recStatus);
   
    //INSERT STAFF
    EntDbFltJobAssign jobAssign = new EntDbFltJobAssign();
    if(_inputStaffDetail.getID() != null)//Conditional case
      jobAssign.setStaffNumber(_inputStaffDetail.getID());
    if(_inputStaffDetail.getName() != null)
      jobAssign.setStaffName(_inputStaffDetail.getName());

    EquipmentType equipType = _input.getTaskDetails().getResources().getEquipment();
    EquipmentDetailsType equip = new EquipmentDetailsType();
    if(equipType != null &&  !equipType.getEquipmentDetails().isEmpty()){//Conditional case
      equip = equipType.getEquipmentDetails().get(0);//get the first equip ONLY

      if(equip.getID() != null)//Conditional case
        jobAssign.setEquipId(equip.getID());
      if(equip.getDescription() != null)
        jobAssign.setEquipDesc(equip.getDescription());
    }else{
      jobAssign.setEquipId(null);
      jobAssign.setEquipDesc(null);
    }
   
    jobAssign.setMsgSendDate(msgSendDate);
    jobAssign.setIdStaffShift((shift == null)? null : shift.getId());
    jobAssign.setIdFltJobTask(idJobTask);
    jobAssign.setIdFlight(urno);
    jobAssign.setRecStatus(recStatus);
    jobAssign.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
    jobAssign.setCreatedUser(HpEKConstants.RMS_RTC_SOURCE);
    jobAssign.setStaffType(HpEKConstants.RMS_STAFF_TYPE_ROP);
    jobAssign.setDataSource(HpEKConstants.RMS_RTC_SOURCE);
    jobAssign.setTransactUser(_input.getAudit().getChangeUser());
    jobAssign.setTransactDate(convertDateToUTC(_input.getAudit().getChangeTime()));
   
    /* Test to check if the task is updated successfully, when JOB/SHIFT failed to insert...
     String chargeNote = "Job assign has been processed for Staff ";
    jobAssign.setChargeNote(chargeNote);*/
   
    EntDbFltJobAssign resultJobAssign = clsDlFltJobAssignLocal.merge(jobAssign);
    if(resultJobAssign != null)
      LOG.debug("Job assign has been processed for Staff <{}>.", resultJobAssign.getStaffNumber());
  }
View Full Code Here

        LOG.debug("Input Staff detail are not existing. Will insert as new.");
        // insert new input staff/shift..
        insertJobAndShift(_input, idJobTask, urno, _inputStaffDetail, status);
      }else{
        for (int i = 0; i < dbAssignedJobList.size(); i++) {
          EntDbFltJobAssign dbAssignedJob = dbAssignedJobList.get(i);
          if (dbAssignedJob.getStaffNumber().equalsIgnoreCase(_inputStaffDetail.getID()))
            break;
          if (i == dbAssignedJobList.size() - 1) {
            // reach max of existing record
            // new input record is not found in db
            // insert input record
View Full Code Here

      _inputStaffDetailList = staff.getStaffDetails();

    //will not remove 'X', if the record is not found..
    for (StaffDetailsType _inputStaffDetail : _inputStaffDetailList) {
      for (int i = 0; i < dbAssignedJobList.size(); i++) {
        EntDbFltJobAssign dbAssignedJob = dbAssignedJobList.get(i);
 
        if (dbAssignedJob.getStaffNumber().equalsIgnoreCase(_inputStaffDetail.getID())) {
          updateJobAndShift("X", dbAssignedJob, _inputStaffDetail, _input);
          break;
        }else if(i == dbAssignedJobList.size()-1){
          LOG.debug("Input Staff <{}> is not found to Delete.", dbAssignedJob.getStaffNumber());
        }
      }
    }
  }
View Full Code Here

      }
      EntDbStaffShift resultShift = clsDlStaffShiftLocal.merge(dbStaffShift);
      if(resultShift != null)
        LOG.debug("Removed assign shift for Staff <{}>.", resultShift.getStaffNumber());
      //merge to DB
      EntDbFltJobAssign resultJob = clsDlFltJobAssignLocal.merge(jobAssign);
      if(resultJob != null)
        LOG.debug("Removed assigned job for Staff <{}>.", resultJob.getStaffNumber());

     
    }else if(" ".equals(rec_status)){
         
      /** UPDATE JOB_ASSIGN **/
      if(_inputStaffDetail.getID() != null)//Conditional case
        jobAssign.setStaffNumber(_inputStaffDetail.getID());
      if(_inputStaffDetail.getName() != null)
        jobAssign.setStaffName(_inputStaffDetail.getName());

      EquipmentType equipType = _input.getTaskDetails().getResources().getEquipment();
      EquipmentDetailsType equip = new EquipmentDetailsType();
      if(equipType != null &&  !equipType.getEquipmentDetails().isEmpty()){//Conditional case
        equip = equipType.getEquipmentDetails().get(0);//get the first equip ONLY

        if(equip.getID() != null)//Conditional case
          jobAssign.setEquipId(equip.getID());
        if(equip.getDescription() != null)
          jobAssign.setEquipDesc(equip.getDescription());
      }else{
        jobAssign.setEquipId(null);
        jobAssign.setEquipDesc(null);
      }
      //jobAssign.setRecStatus(rec_status);
      jobAssign.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
      jobAssign.setUpdatedUser(HpEKConstants.RMS_RTC_SOURCE);
      jobAssign.setMsgSendDate(msgSendDate);
      jobAssign.setStaffType(HpEKConstants.RMS_STAFF_TYPE_ROP);
      jobAssign.setTransactUser(_input.getAudit().getChangeUser());
      jobAssign.setTransactDate(convertDateToUTC(_input.getAudit().getChangeTime()));
     
     
      //merge JOB_ASSIGN to db
      EntDbFltJobAssign resultJobAssign = clsDlFltJobAssignLocal.merge(jobAssign);
      if(resultJobAssign != null)
        LOG.debug("Assigned job has been updated for Staff <{}>", resultJobAssign.getStaffNumber());
     
      ShiftDetailsType _inputShiftDetailsType = _inputStaffDetail.getShiftDetails();
     
      /** UPDATE shift **/
      if(isNullOrEmptyStr(jobAssign.getIdStaffShift())){
 
View Full Code Here

      throws ParseException {
    Date msgSendDate = convertDateToUTC(_input.getMeta().getMessageTime());
    EntDbStaffShift shift = insertShift(idJobTask, urno, _inputStaffDetail, msgSendDate, recStatus);
   
    //INSERT STAFF
    EntDbFltJobAssign jobAssign = new EntDbFltJobAssign();
    if(_inputStaffDetail.getID() != null)//Conditional case
      jobAssign.setStaffNumber(_inputStaffDetail.getID());
    if(_inputStaffDetail.getName() != null)
      jobAssign.setStaffName(_inputStaffDetail.getName());
   
    //Service Detail
    ServiceDetailsType _inputServiceDetailsType = _inputStaffDetail.getServiceDetails();
    if(_inputServiceDetailsType == null){
      LOG.debug("No Service Detail in input Staff <{}>.", _inputStaffDetail.getID());
      return;
    }
    String serCode = null;
    if (_inputServiceDetailsType.getServiceCode() != null) {// check in MD table
      for (EntDbMdRmsServCode servicCode : clsEntStartUpInitSingleton.getMdRmsServCodesList()) {
        if (_inputServiceDetailsType.getServiceCode().equalsIgnoreCase(servicCode.getStaffTypeCode())) {
          if(servicCode.getStaffTypeCode().equalsIgnoreCase(HpEKConstants.RMS_STAFF_TYPE_SPHL))
            serCode = _inputStaffDetail.getServiceDetails().getServiceCode(); break;
        }
      }
      if(serCode == null)
        LOG.debug("Service Code <{}> is not found in MdRmsServiceCode table.", _inputServiceDetailsType.getServiceCode());
      jobAssign.setSpecialService(_inputServiceDetailsType.getServiceCode());
    }
    String paxSeq = String.valueOf(_inputServiceDetailsType.getPaxSequence());
    // 2013-11-22 updated by JGO - remove pax_ref_num and add pax_name for sphl
    //jobAssign.setPaxRefNum(paxSeq);
    String paxName = _inputServiceDetailsType.getPaxName();
    if (_input.getMeta().getSource().contains("SPHL") && HpUfisUtils.isNotEmptyStr(paxName)) {
      paxName = paxName.replaceAll("/", " ");
      // find the pax from macs
      // check from load pax table by id_flight, paxname and status <> 'x'
      List<EntDbLoadPax> paxes = loadPaxBean.findPaxByFlightAndName(urno, paxName);
      String idLoadPax = "0";
      String idServiceReq = "0";
      if (paxes.size() == 0) {
        LOG.warn("No Pax found in Lod_Pax table by id_flight: {} and pax_name: {}",
            urno,
            paxName);
      } else if (paxes.size() > 1) {
        LOG.warn("More than 1 Pax found in Load_Pax table by id_flight: {} and pax_name: {}",
            urno,
            paxName);
      } else {
        idLoadPax = paxes.get(0).getUuid();
        // look for service request for the pax
        // fisrt round: search by id_load_pax and service_code
        LOG.debug("Find service request from service_request table");
        List<EntDbServiceRequest> requests = serviceRequestBean
            .findPaxRequest(null, idLoadPax, _inputServiceDetailsType.getServiceCode(), null);
        if (requests == null || requests.size() == 0) {
          LOG.warn("No service request found by id_load_pax: {} and service_code: {}",
              idLoadPax,
              _inputServiceDetailsType.getServiceCode());
          LOG.debug("Change Criteria to find service request");
          // if not found, second round: search by id_flight, inter_ref_number and service_code
          requests = serviceRequestBean.findPaxRequest(urno, null,
              _inputServiceDetailsType.getServiceCode(), paxes.get(0)
                  .getPKId().getIntrefnumber());
        }
       
        if (requests == null || requests.size() == 0) {
          LOG.warn("No service request found by id_flight: {}, interRefNumber: {} and service_code: {}",
              urno,
              paxes.get(0).getPKId().getIntrefnumber(),
              _inputServiceDetailsType.getServiceCode());
        } else {
          idServiceReq = requests.get(0).getUuid();
        }
      }
      jobAssign.setIdLoadPax(idLoadPax);
      jobAssign.setIdServiceReq(idServiceReq);
      jobAssign.setPaxName(paxName);
    }

    //to find from SERVICE_REQUEST
/*    EntDbServiceRequest entSerRequest = clsDlPaxServiceRequest.findByIdFlightAndPaxRefNum(urno.intValue(), paxSeq);
    if(entSerRequest != null){
      jobAssign.setIdServiceRequest(entSerRequest.getIntId());//ID???
    }*/
    jobAssign.setChargeNote(String.valueOf(_inputServiceDetailsType.getDocNumber()));
   
    //Equipment
    EquipmentType equipType = _input.getTaskDetails().getResources().getEquipment();
    EquipmentDetailsType equip = new EquipmentDetailsType();
    if(equipType != null &&  !equipType.getEquipmentDetails().isEmpty()){//Conditional case
      equip = equipType.getEquipmentDetails().get(0);//get the first equip ONLY

      if(equip.getID() != null)//Conditional case
        jobAssign.setEquipId(equip.getID());
      if(equip.getDescription() != null)
        jobAssign.setEquipDesc(equip.getDescription());
    }else{
      jobAssign.setEquipId(null);
      jobAssign.setEquipDesc(null);
    }
   
    jobAssign.setTransactUser(_input.getAudit().getChangeUser());
    jobAssign.setTransactDate(convertDateToUTC(_input.getAudit().getChangeTime()));
   
    jobAssign.setMsgSendDate(msgSendDate);
    jobAssign.setIdStaffShift((shift == null)? null : shift.getId());
    jobAssign.setIdFltJobTask(idJobTask);
    jobAssign.setIdFlight(urno);
    jobAssign.setRecStatus(recStatus);
    jobAssign.setCreatedDate(HpUfisCalendar.getCurrentUTCTime());
    jobAssign.setCreatedUser(HpEKConstants.RMS_RTC_SOURCE);
    jobAssign.setStaffType(HpEKConstants.RMS_STAFF_TYPE_SPHL);
    jobAssign.setDataSource(HpEKConstants.RMS_RTC_SOURCE);
 
    EntDbFltJobAssign resultJobAssign = clsDlFltJobAssignLocal.merge(jobAssign);
    if(resultJobAssign != null)
      LOG.debug("Job assign has been processed for Staff <{}>.", resultJobAssign.getStaffNumber());
  }
View Full Code Here

        LOG.debug("Input Staff detail are not existing. Will insert as new.");
        // insert new input staff/shift..
        insertJobAndShift(_input, idJobTask, urno, _inputStaffDetail, status);
      }else{
        for (int i = 0; i < dbAssignedJobList.size(); i++) {
          EntDbFltJobAssign dbAssignedJob = dbAssignedJobList.get(i);
          if(dbAssignedJob.getStaffNumber().equalsIgnoreCase(_inputStaffDetail.getID()))
            break;
          if(i == dbAssignedJobList.size()-1){//reach max of existing record
            // new input record is not found in db
            // insert input record
            //isUpdate = false;
View Full Code Here

      _inputStaffDetailList = staff.getStaffDetails();
   
    //will not remove 'X', if the record is not found..
    for (StaffDetailsType _inputStaffDetail : _inputStaffDetailList) {
      for (int i = 0; i < dbAssignedJobList.size(); i++) {
        EntDbFltJobAssign dbAssignedJob = dbAssignedJobList.get(i);
 
        if (dbAssignedJob.getStaffNumber().equalsIgnoreCase(_inputStaffDetail.getID())) {
          updateJobAndShift("X", dbAssignedJob, _inputStaffDetail, _input);
          break;
        }else if(i == dbAssignedJobList.size()-1){
          LOG.debug("Input Staff <{}> is not found to Delete.");
        }
View Full Code Here

          dbStaffShift.setUpdatedUser(HpEKConstants.RMS_RTC_SOURCE);
          dbStaffShift.setMsgSendDate(msgSendDate);
        }
      }
      //merge to DB
      EntDbFltJobAssign resultJob = clsDlFltJobAssignLocal.merge(jobAssign);
      if(resultJob != null)
        LOG.debug("Removed assigned job for Staff <{}>.", resultJob.getStaffNumber());
     
      EntDbStaffShift resultShift = clsDlStaffShiftLocal.merge(dbStaffShift);
      if(resultShift != null)
        LOG.debug("Removed assign shift for Staff <{}>.", resultShift.getStaffNumber());
     
    }else if(" ".equals(rec_status)){
         
      /** UPDATE JOB_ASSIGN **/
      if(_inputStaffDetail.getID() != null)//Conditional case
        jobAssign.setStaffNumber(_inputStaffDetail.getID());
      if(_inputStaffDetail.getName() != null)
        jobAssign.setStaffName(_inputStaffDetail.getName());
     
      //Service Detail
      ServiceDetailsType _inputServiceDetailsType = _inputStaffDetail.getServiceDetails();
      if(_inputServiceDetailsType == null){
        LOG.debug("No Service Detail in input Staff <{}>.", _inputStaffDetail.getID());
        return;
      }
      String serCode = null;
      if (_inputServiceDetailsType.getServiceCode() != null) {// check in MD table
        for (EntDbMdRmsServCode servicCode : clsEntStartUpInitSingleton.getMdRmsServCodesList()) {
          if (_inputServiceDetailsType.getServiceCode().equalsIgnoreCase(servicCode.getStaffTypeCode())) {
            if(servicCode.getStaffTypeCode().equalsIgnoreCase(HpEKConstants.RMS_STAFF_TYPE_SPHL))
              serCode = _inputStaffDetail.getServiceDetails().getServiceCode(); break;
          }
        }
        if(serCode == null)
          LOG.debug("Service Code <{}> is not found in MdRmsServiceCode table.", _inputServiceDetailsType.getServiceCode());
        jobAssign.setSpecialService(_inputServiceDetailsType.getServiceCode());
      }
      String paxSeq = String.valueOf(_inputServiceDetailsType.getPaxSequence());
      // 2013-11-22 updated by JGO - remove pax_ref_num and add pax_name for sphl
      //jobAssign.setPaxRefNum(paxSeq);
      String paxName = _inputServiceDetailsType.getPaxName();
      if (_input.getMeta().getSource().contains("SPHL") && HpUfisUtils.isNotEmptyStr(paxName)) {
        paxName = paxName.replaceAll("/", " ");
        // find the pax from macs
        // check from load pax table by id_flight, paxname and status <> 'x'
        List<EntDbLoadPax> paxes = loadPaxBean.findPaxByFlightAndName(jobAssign.getIdFlight(), paxName);
        String idLoadPax = "0";
        String idServiceReq = "0";
        if (paxes.size() == 0) {
          LOG.warn("No Pax found in Lod_Pax table by id_flight: {} and pax_name: {}",
              jobAssign.getIdFlight(),
              paxName);
        } else if (paxes.size() > 1) {
          LOG.warn("More than 1 Pax found in Load_Pax table by id_flight: {} and pax_name: {}",
              jobAssign.getIdFlight(),
              paxName);
        } else {
          idLoadPax = paxes.get(0).getUuid();
          // look for service request for the pax
          // fisrt round: search by id_load_pax and service_code
          LOG.debug("Find service request from service_request table");
          List<EntDbServiceRequest> requests = serviceRequestBean
              .findPaxRequest(null, idLoadPax, _inputServiceDetailsType.getServiceCode(), null);
          if (requests == null || requests.size() == 0) {
            LOG.warn("No service request found by id_load_pax: {} and service_code: {}",
                idLoadPax,
                _inputServiceDetailsType.getServiceCode());
            LOG.debug("Change Criteria to find service request");
            // if not found, second round: search by id_flight, inter_ref_number and service_code
            requests = serviceRequestBean.findPaxRequest(jobAssign.getIdFlight(), null,
                _inputServiceDetailsType.getServiceCode(), paxes.get(0)
                    .getPKId().getIntrefnumber());
          }
         
          if (requests == null || requests.size() == 0) {
            LOG.warn("No service request found by id_flight: {}, interRefNumber: {} and service_code: {}",
                jobAssign.getIdFlight(),
                paxes.get(0).getPKId().getIntrefnumber(),
                _inputServiceDetailsType.getServiceCode());
          } else {
            idServiceReq = requests.get(0).getUuid();
          }
        }
        jobAssign.setIdLoadPax(idLoadPax);
        jobAssign.setIdServiceReq(idServiceReq);
        jobAssign.setPaxName(paxName);
      }

      jobAssign.setChargeNote(String.valueOf(_inputServiceDetailsType.getDocNumber()));
     
      //Equipment
      EquipmentType equipType = _input.getTaskDetails().getResources().getEquipment();
      EquipmentDetailsType equip = new EquipmentDetailsType();
      if(equipType != null &&  !equipType.getEquipmentDetails().isEmpty()){//Conditional case
        equip = equipType.getEquipmentDetails().get(0);//get the first equip ONLY

        if(equip.getID() != null)//Conditional case
          jobAssign.setEquipId(equip.getID());
        if(equip.getDescription() != null)
          jobAssign.setEquipDesc(equip.getDescription());
      }else{
        jobAssign.setEquipId(null);
        jobAssign.setEquipDesc(null);
      }
     
      jobAssign.setTransactUser(_input.getAudit().getChangeUser());
      jobAssign.setTransactDate(convertDateToUTC(_input.getAudit().getChangeTime()));
     
      jobAssign.setMsgSendDate(msgSendDate);
      jobAssign.setRecStatus(rec_status);
      jobAssign.setStaffType(HpEKConstants.RMS_STAFF_TYPE_SPHL);
      jobAssign.setDataSource(HpEKConstants.RMS_RTC_SOURCE);
      jobAssign.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
      jobAssign.setUpdatedUser(HpEKConstants.RMS_RTC_SOURCE);
     
      //merge JOB_ASSIGN to db
      EntDbFltJobAssign resultJobAssign = clsDlFltJobAssignLocal.merge(jobAssign);
      if(resultJobAssign != null)
        LOG.debug("Assigned job has been updated for Staff <{}>", resultJobAssign.getStaffNumber());
     
     
      /** UPDATE shift **/
      if(isNullOrEmptyStr(jobAssign.getIdStaffShift())){
        LOG.debug("No input shift to update for staff <{}>", jobAssign.getStaffNumber());
View Full Code Here

      BigDecimal urno = null;
      EntDbAfttab entFlight = null;
      String idFltJobAssign = "0";
      Date checkInDate = null;
      Date msgInTime = null;
      EntDbFltJobAssign entFltJobAssign = null;
      String cmd = UfisASCommands.IRT.name();
     
      fltSuffix = _input.getFlightID().getFltSuffix() == null? "": _input.getFlightID().getFltSuffix();
     
      //format ceda flight string
      /*flNum = _input.getFlightID().getCxCd() +" "+
            HpUfisUtils.formatCedaFltn(String.valueOf(_input.getFlightID().getFltNo())) + fltSuffix;*/
      flNum = HpUfisUtils.formatCedaFlno(_input.getFlightID().getCxCd(), String.valueOf(_input.getFlightID().getFltNo()), fltSuffix);
     
      flDate = inputFlDate.parse(_input.getFlightID().getFltDate());
      //perform only for deptStn = DXB
      if (HpEKConstants.EK_HOPO.equals(_input.getFlightID().getDepStn()))
        entFlight = clsAfttabBeanLocal.findFlightByFlda(flNum, dfDate.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){
        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.getCheckInInfo().getStaffno(), _input.getCheckInInfo().getCrewType());
        idFltJobAssign = (entFltJobAssign == null)? "0" : entFltJobAssign.getId();
      }
      checkInDate = sf.parse(convertFlDateToUTC(_input.getCheckInInfo().getCheckInTime()));
      msgInTime = sf.parse(convertFlDateToUTC(_input.getMeta().getMessageTime()));
     
      EntDbCrewCheckin entity = null, oldEnt = null;
View Full Code Here

TOP

Related Classes of com.ufis_as.ek_if.rms.entities.EntDbFltJobAssign

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.