Package com.ufis_as.ek_if.rms.entities

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


    if (irmtabRef > 0) {
      msgLogged = Boolean.TRUE;
    }
     
      if (resourceAssignmentType != null){
        EntDbFltJobAssign edpiodEntDbFltJobAssign = new EntDbFltJobAssign();
        EntDbFltJobTask edpiodEntDbFltJobTask = new EntDbFltJobTask();
//        EntDbStaffShift edpiodEntDbStaffShift = new EntDbStaffShift();
       
//        SimpleDateFormat RTCdf = new SimpleDateFormat(HpEKConstants.EKRTC_TIME_FORMAT);
        // convert local time to UTC
//        RTCdf.setTimeZone(HpEKConstants.utcTz);
       
        // check meta
        if (resourceAssignmentType.getMeta() == null){
          LOG.info("Mandatory field Meta is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set message time
        if (resourceAssignmentType.getMeta().getMessageTime() != null){
          edpiodEntDbFltJobAssign.setMsgSendDate(convertXMLGregorianCalendarToDate(resourceAssignmentType.getMeta().getMessageTime()));
        }else {
          LOG.info("Mandatory field message time is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // check messageID
        if (resourceAssignmentType.getMeta().getMessageID() == 0){
          LOG.info("Mandatory field messageID time is 0, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // check message type
        if (resourceAssignmentType.getMeta().getMessageType() == null || "".equals(resourceAssignmentType.getMeta().getMessageType())){
          LOG.info("Mandatory field message type is null or empty string, ResourceShiftType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }else if (!Arrays.asList(messageAssignmentTypeArray).contains(resourceAssignmentType.getMeta().getMessageType())){
          LOG.info("Mandatory field message type {} is in possible value, ResourceShiftType message is rejected", resourceAssignmentType.getMeta().getMessageType());
         
          sendErroNotification(EnumExceptionCodes.EENUM);
         
          return false;
        }
       
        // check messageSubtype
        if (resourceAssignmentType.getMeta().getMessageSubtype() == null || "".equals(resourceAssignmentType.getMeta().getMessageSubtype().trim())){
          LOG.info("Mandatory field messageSubtype is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }else if (!Arrays.asList(messageAssignmentSubtypeArray).contains(resourceAssignmentType.getMeta().getMessageSubtype().toUpperCase().trim())){
          LOG.info("Mandatory field messageSubtype {} is in possible value, resourceAssignmentType message is rejected", resourceAssignmentType.getMeta().getMessageSubtype());
         
          sendErroNotification(EnumExceptionCodes.EENUM);
         
          return false;
        }else {
          resAssignMsgSubType = resourceAssignmentType.getMeta().getMessageSubtype();
        }
       
        // set messageSource
        if (resourceAssignmentType.getMeta().getMessageSource() != null && !"".equals(resourceAssignmentType.getMeta().getMessageSource().trim())){
          if (Arrays.asList(messageSourceArray).contains(resourceAssignmentType.getMeta().getMessageSource().toUpperCase().trim())){
            switch(resourceAssignmentType.getMeta().getMessageSource().toUpperCase().trim()){
              case "EKRTC":
                edpiodEntDbFltJobAssign.setStaffType("EK");
                edpiodEntDbFltJobTask.setStaffType("EK");
                break;
              case "GXRTC":
                edpiodEntDbFltJobAssign.setStaffType("GX");
                edpiodEntDbFltJobTask.setStaffType("GX");
                break;
              case "CSRTC":
                edpiodEntDbFltJobAssign.setStaffType("CS");
                edpiodEntDbFltJobTask.setStaffType("CS");
                break;
            }
          }else{
            LOG.info("Mandatory field messageSource {} is not in possible value, resourceAssignmentType message is rejected", resourceAssignmentType.getMeta().getMessageSource());
           
            sendErroNotification(EnumExceptionCodes.EENUM);
           
              return false;
          }
         
        }else {
          LOG.info("Mandatory field messageSource is null or empty string, ResourceShiftType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set TSK
        if (resourceAssignmentType.getTSK() == null ){
          LOG.info("Mandatory field messageSource is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set AID
        if (resourceAssignmentType.getTSK().getAID() != null && !"".equals(resourceAssignmentType.getTSK().getAID().trim())){
          edpiodEntDbFltJobTask.setTaskId(new BigDecimal(resourceAssignmentType.getTSK().getAID()));
        }else {
          LOG.info("Mandatory field AID is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set TRG (not mandatory for ORI = 0)
        if (resourceAssignmentType.getTSK().getTRG() != null && !"".equals(resourceAssignmentType.getTSK().getTRG().trim())){
          edpiodEntDbFltJobTask.setTaskRuleGrp(resourceAssignmentType.getTSK().getTRG());
        }else {
          if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
          LOG.info("Mandatory field TRG is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
          }
        }
       
        // set TRQ (not mandatory for ORI = 0)
        if (resourceAssignmentType.getTSK().getTRQ() != null && !"".equals(resourceAssignmentType.getTSK().getTRQ().trim())){
          if (entStartupInitSingleton.isMDTaskReqtListOn()){
          // to check with master data
            switch (edpiodEntDbFltJobTask.getStaffType()){
          case "EK":
            if (!entStartupInitSingleton.getEKASTaskReqtList().contains(resourceAssignmentType.getTSK().getTRQ().trim())){
              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRQ().trim() ,"EKAS");
            }
            break;
          case "GX":
            if (!entStartupInitSingleton.getGXTaskReqtList().contains(resourceAssignmentType.getTSK().getTRQ().trim())){
              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRQ().trim() ,"GX");
            }
            break;
          case "CS":
            if (!entStartupInitSingleton.getCSTaskReqtList().contains(resourceAssignmentType.getTSK().getTRQ().trim())){
              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRQ().trim() ,"CS");
            }
            break;
            }
           
            sendErroNotification(EnumExceptionCodes.WNOMD);
           
       
          edpiodEntDbFltJobTask.setTaskRequirementId(resourceAssignmentType.getTSK().getTRQ());
        }else {
          if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
          LOG.info("Mandatory field TRQ is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
          }
        }
       
        // set TRD
        if (resourceAssignmentType.getTSK().getTRD() != null && !"".equals(resourceAssignmentType.getTSK().getTRD().trim())){
          if (entStartupInitSingleton.isMDTaskReqtListOn()){
          // to check with master data
            switch (edpiodEntDbFltJobTask.getStaffType()){
          case "EK":
            if (!entStartupInitSingleton.getEKASTaskReqtList().contains(resourceAssignmentType.getTSK().getTRD().trim())){
              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRD().trim() ,"EKAS");
            }
            break;
          case "GX":
            if (!entStartupInitSingleton.getGXTaskReqtList().contains(resourceAssignmentType.getTSK().getTRD().trim())){
              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRD().trim() ,"GX");
            }
            break;
          case "CS":
            if (!entStartupInitSingleton.getCSTaskReqtList().contains(resourceAssignmentType.getTSK().getTRD().trim())){
              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRD().trim() ,"CS");
            }
            break;
              }
           
            sendErroNotification(EnumExceptionCodes.WNOMD);
           
         
          edpiodEntDbFltJobTask.setTaskDeptId(resourceAssignmentType.getTSK().getTRD());
        }
       
        // set DEP
        if (resourceAssignmentType.getTSK().getDEP() != null && !"".equals(resourceAssignmentType.getTSK().getDEP().trim())){
          if (entStartupInitSingleton.isMDDeptListOn()){
          // to check master data
          switch (edpiodEntDbFltJobTask.getStaffType()){
          case "EK":
            if (!entStartupInitSingleton.getEKASDeptList().contains(resourceAssignmentType.getTSK().getDEP().trim())){
              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getDEP().trim() ,"EKAS");
            }
            break;
          case "GX":
            if (!entStartupInitSingleton.getGXDeptList().contains(resourceAssignmentType.getTSK().getDEP().trim())){
              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getDEP().trim() ,"GX");
            }
            break;
          case "CS":
            if (!entStartupInitSingleton.getCSDeptList().contains(resourceAssignmentType.getTSK().getDEP().trim())){
              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getDEP().trim() ,"CS");
            }
            break;           
           
         
          sendErroNotification(EnumExceptionCodes.WNOMD);
         
          }
          edpiodEntDbFltJobTask.setTaskDeptId(resourceAssignmentType.getTSK().getDEP());
        }else {
          LOG.info("Mandatory field DEP is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set TYP
        if (resourceAssignmentType.getTSK().getTYP() != null && !"".equals(resourceAssignmentType.getTSK().getTYP().trim())){
//          // to check master data
//          switch (edpiodEntDbFltJobTask.getStaffType()){
//          case "EK":
//            if (!entStartupInitSingleton.getEKASTaskTypesList().contains(resourceAssignmentType.getTSK().getTYP().trim())){
//              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getTYP().trim() ,"EKAS");
//            }
//            break;
//          case "GX":
//            if (!entStartupInitSingleton.getGXTaskTypesList().contains(resourceAssignmentType.getTSK().getTYP().trim())){
//              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getTYP().trim() ,"GX");
//            }
//            break;
//          case "CS":
//            if (!entStartupInitSingleton.getCSTaskTypesList().contains(resourceAssignmentType.getTSK().getTYP().trim())){
//              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getTYP().trim() ,"CS");
//            }
//            break;           
//          } 
          edpiodEntDbFltJobTask.setTaskType(resourceAssignmentType.getTSK().getTYP());
        }else {
          LOG.info("Mandatory field TYP is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
//        // added according icd 2.0 and Mei's design, when ORI = 0 not related to flight
//        if ("0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
//          LOG.info("ORI = 0, resourceAssignmentType message is rejected");
//          return false;
//        }
       
        // set ORI
        if (resourceAssignmentType.getTSK().getORI() != null && !"".equals(resourceAssignmentType.getTSK().getORI().trim())){
          if (entStartupInitSingleton.isMDTaskGrptypeListOn()){
          // to check master data
          switch (edpiodEntDbFltJobTask.getStaffType()){
          case "EK":
            if (!entStartupInitSingleton.getEKASTaskGrptypeList().contains(resourceAssignmentType.getTSK().getORI().trim())){
              LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getORI().trim() ,"EKAS");
            }
            break;
          case "GX":
            if (!entStartupInitSingleton.getGXTaskGrptypeList().contains(resourceAssignmentType.getTSK().getORI().trim())){
              LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getORI().trim() ,"GX");
            }
            break;
          case "CS":
            if (!entStartupInitSingleton.getCSTaskGrptypeList().contains(resourceAssignmentType.getTSK().getORI().trim())){
              LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getORI().trim() ,"CS");
            }
            break;           
         
         
          sendErroNotification(EnumExceptionCodes.WNOMD);
         
          }
         
          edpiodEntDbFltJobTask.setTaskGrpType(resourceAssignmentType.getTSK().getORI());
        }else {
          LOG.info("Mandatory field ORI is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set SNO
        if (resourceAssignmentType.getTSK().getSNO() != 0){
          edpiodEntDbFltJobTask.setTaskNum(new BigDecimal(resourceAssignmentType.getTSK().getSNO()));
        }else {
          LOG.info("Mandatory field SNO is 0, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set MNO
        if (resourceAssignmentType.getTSK().getMNO() != 0){
          edpiodEntDbFltJobTask.setMainTaskNum(new BigDecimal(resourceAssignmentType.getTSK().getMNO()));
        }else {
          LOG.info("Mandatory field MNO is 0, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set RMK
        if (resourceAssignmentType.getTSK().getRMK() != null && !"".equals(resourceAssignmentType.getTSK().getRMK().trim())){
          edpiodEntDbFltJobTask.setTaskRemark(resourceAssignmentType.getTSK().getRMK());
        }
       
        // set STI
        if (resourceAssignmentType.getTSK().getSTI() != null && !"".equals(resourceAssignmentType.getTSK().getSTI())){
          try {
            edpiodEntDbFltJobTask.setTaskActualStartDate(convertStringToDate(resourceAssignmentType.getTSK().getSTI()));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date STI, {}", e);
//          LOG.info("Mandatory field STI can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }
       
        // set ETI
        if (resourceAssignmentType.getTSK().getETI() != null){
          try {
            edpiodEntDbFltJobTask.setTaskActualEndDate(convertStringToDate(resourceAssignmentType.getTSK().getETI()));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date ETI, {}", e);
//          LOG.info("Mandatory field ETI can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }
       
        // set DUR
        if (resourceAssignmentType.getTSK().getDUR() != null && resourceAssignmentType.getTSK().getDUR() != 0){
          edpiodEntDbFltJobTask.setTaskActualDuration(new BigDecimal(resourceAssignmentType.getTSK().getDUR()));
        }
       
        // set EST
        if (resourceAssignmentType.getTSK().getEST() != null && !"".equals(resourceAssignmentType.getTSK().getEST() )){
          try {
            edpiodEntDbFltJobTask.setTaskPlanStartDate(convertStringToDate(resourceAssignmentType.getTSK().getEST()));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date DUR, {}", e);
//          LOG.info("Mandatory field EST can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }else {
          LOG.info("Mandatory field EST is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set LET
        if (resourceAssignmentType.getTSK().getLET() != null && !"".equals(resourceAssignmentType.getTSK().getLET().trim())){
          try {
            edpiodEntDbFltJobTask.setTaskPlanEndDate(convertStringToDate(resourceAssignmentType.getTSK().getLET()));
            // task_plan_duration = task_plan_end_date - task_plan_start_date
            int days = Days.daysBetween(new DateTime(edpiodEntDbFltJobTask.getTaskPlanStartDate()), new DateTime(edpiodEntDbFltJobTask.getTaskPlanEndDate())).getDays();
            int seconds = days * 24 * 60 * 60;
            edpiodEntDbFltJobTask.setTaskPlanDuration(new BigDecimal(seconds));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date LET, {}", e);
//          LOG.info("Mandatory field LET can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }else {
          LOG.info("Mandatory field LET is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set SLO
        if (resourceAssignmentType.getTSK().getSLO() != null && !"".equals(resourceAssignmentType.getTSK().getSLO().trim())){
          edpiodEntDbFltJobTask.setTaskStartLoc(resourceAssignmentType.getTSK().getSLO());
        }else {
          LOG.info("Mandatory field SLO is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set ELO
        if (resourceAssignmentType.getTSK().getELO() != null && !"".equals(resourceAssignmentType.getTSK().getELO().trim())){
          edpiodEntDbFltJobTask.setTaskEndLoc(resourceAssignmentType.getTSK().getELO());
        }else {
          LOG.info("Mandatory field ELO is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set HST
        if (resourceAssignmentType.getTSK().getHST() != null && !"".equals(resourceAssignmentType.getTSK().getHST().trim())){
          edpiodEntDbFltJobTask.setTaskHandlingState(resourceAssignmentType.getTSK().getHST());
        }else {
          LOG.info("Mandatory field HST is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set MWA (not available for DEP =CB)
        if (!"CB".equalsIgnoreCase(resourceAssignmentType.getTSK().getDEP())){
       
        if (resourceAssignmentType.getTSK().getMWA() != null && !"".equals(resourceAssignmentType.getTSK().getMWA().trim())){
          if (entStartupInitSingleton.isMDWorkAreasListOn()){
          // to check with master data
            switch (edpiodEntDbFltJobTask.getStaffType()){
          case "EK":
            if (!entStartupInitSingleton.getEKASWorkAreasList().contains(resourceAssignmentType.getTSK().getMWA().trim())){
              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getMWA().trim() ,"EKAS");
            }
            break;
          case "GX":
            if (!entStartupInitSingleton.getGXWorkAreasList().contains(resourceAssignmentType.getTSK().getMWA().trim())){
              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getMWA().trim() ,"GX");
            }
            break;
          case "CS":
            if (!entStartupInitSingleton.getCSWorkAreasList().contains(resourceAssignmentType.getTSK().getMWA().trim())){
              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getMWA().trim() ,"CS");
            }
            break;
          }
           
            sendErroNotification(EnumExceptionCodes.WNOMD);
           
          }
          edpiodEntDbFltJobTask.setTaskWorkArea(resourceAssignmentType.getTSK().getMWA());
        }
//        else {
//          LOG.info("Mandatory field MWA is null or empty string, resourceAssignmentType message is rejected");
//          return false;
//        }
        }
       
        // set SWA
        if (resourceAssignmentType.getTSK().getSWA() != null && !"".equals(resourceAssignmentType.getTSK().getSWA().trim())){
          edpiodEntDbFltJobTask.setTaskSubworkArea(resourceAssignmentType.getTSK().getSWA());
        }
       
        // set WLD
        if (resourceAssignmentType.getTSK().getWLD() != null && resourceAssignmentType.getTSK().getWLD() != 0){
          edpiodEntDbFltJobTask.setTaskWorkloadFactor(new BigDecimal(resourceAssignmentType.getTSK().getWLD()));
        }
       
        // set PRI
        if (resourceAssignmentType.getTSK().getPRI() != 0){
          edpiodEntDbFltJobTask.setTaskPriority(new BigDecimal(resourceAssignmentType.getTSK().getPRI()));
        }
       
        // Attention ! make use of this info to search flight in AFTTAB (AFTTAB.ACT3 or ACT5)
        //  AFT
//        if (resourceAssignmentType.getTSK().getAFT() != null && !"".equals(resourceAssignmentType.getTSK().getAFT().trim())){
//        }
       
           // set STS
        if (resourceAssignmentType.getTSK().getSTS() != null && !"".equals(resourceAssignmentType.getTSK().getSTS().trim())){
//            // to check with master data
//            switch (edpiodEntDbFltJobTask.getStaffType()){
//          case "EK":
//            if (!entStartupInitSingleton.getEKASTaskStatusList().contains(resourceAssignmentType.getTSK().getSTS().trim())){
//              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getSTS().trim() ,"EKAS");
//            }
//            break;
//          case "GX":
//            if (!entStartupInitSingleton.getGXTaskStatusList().contains(resourceAssignmentType.getTSK().getSTS().trim())){
//              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getSTS().trim() ,"GX");
//            }
//            break;
//          case "CS":
//            if (!entStartupInitSingleton.getCSTaskStatusList().contains(resourceAssignmentType.getTSK().getSTS().trim())){
//              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getSTS().trim() ,"CS");
//            }
//            break;
//          } 
          edpiodEntDbFltJobTask.setTaskStatus(resourceAssignmentType.getTSK().getSTS());
        }else {
          LOG.info("Mandatory field STS is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set STT
        if (resourceAssignmentType.getTSK().getSTT() != null && !"".equals(resourceAssignmentType.getTSK().getSTT().trim())){
          if (entStartupInitSingleton.isMDTaskGrptypeListOn()){
        // to check with master data
        switch (edpiodEntDbFltJobTask.getStaffType()){
      case "EK":
        if (!entStartupInitSingleton.getEKASTaskGrptypeList().contains(resourceAssignmentType.getTSK().getSTT().trim())){
          LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getSTT().trim() ,"EKAS");
        }
        break;
      case "GX":
        if (!entStartupInitSingleton.getGXTaskGrptypeList().contains(resourceAssignmentType.getTSK().getSTT().trim())){
          LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getSTT().trim() ,"GX");
        }
        break;
      case "CS":
        if (!entStartupInitSingleton.getCSTaskGrptypeList().contains(resourceAssignmentType.getTSK().getSTT().trim())){
          LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getSTT().trim() ,"CS");
        }
        break;
         
       
        sendErroNotification(EnumExceptionCodes.WNOMD);
       
        }
          edpiodEntDbFltJobTask.setSubtaskStatus(resourceAssignmentType.getTSK().getSTT());
        }else {
          LOG.info("Mandatory field STT is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // Attention ! Use this info to form the full flight number (AFTTAB.FLNO)
        // set DNO
//        if (resourceAssignmentType.getTSK().getDNO() != null && !"".equals(resourceAssignmentType.getTSK().getDNO().trim())){
//          // TO CONTINUE>>>>>>
//        }
       
        // Make use of this info to search flight in AFTTAB Convert to UTC prior to search (AFTTAB.STOD)
        // set DFD
//        if (resourceAssignmentType.getTSK().getDFD() != null){
//          // TO CONTINUE>>>>>>
//        }
       
        // Make use of this info to search flight in AFTTAB (AFTTAB.ORG3)
        // set REG
//        if (resourceAssignmentType.getTSK().getREG() != null && !"".equals(resourceAssignmentType.getTSK().getREG().trim())){
//          // TO CONTINUE>>>>>>
//        }

       
        // Make use of this info to search flight in AFTTAB (AFTTAB.ORG3)
           // check DSN (not mandatory for ORI = 0)
        if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
       
        if (resourceAssignmentType.getTSK().getDSN() == null || "".equals(resourceAssignmentType.getTSK().getDSN().trim())){
          LOG.info("Mandatory field DSN is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        }
       
        // Use this info to form the full flight number (AFTTAB.FLNO)
           // check ASN (not mandatory for ORI = 0)
        if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
       
        if (resourceAssignmentType.getTSK().getASN() == null || "".equals(resourceAssignmentType.getTSK().getASN().trim())){
          LOG.info("Mandatory field ASN is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        }
       
        // set SID (chnage to conditional according to version 2)
        if (resourceAssignmentType.getTSK().getSID() != null && !"".equals(resourceAssignmentType.getTSK().getSID().trim())){
          edpiodEntDbFltJobAssign.setShiftId( new BigDecimal(resourceAssignmentType.getTSK().getSID()));
        }
//        else {
//          LOG.info("Mandatory field SID is null or empty string, resourceAssignmentType message is rejected");
//          return false;
//        }
View Full Code Here


    dtflString = HpCommonConfig.dtfl;
    logLevel = HpCommonConfig.irmtab;
    msgLogged = Boolean.FALSE;
    String crewType = null;
    Boolean isLast = Boolean.FALSE;
    EntDbFltJobAssign crewAssignment = null;
    EntDbFltJobAssign currCrewAssignment = null;
    EntDbFltJobAssign oldCrewAssignment = null;
    if (irmtabRef > 0) {
      msgLogged = Boolean.TRUE;
    }
    try {

      if (crewsOnFlightAssign.getFlightId() != null) {

        String urno = null;
        String flightNumber = crewsOnFlightAssign.getFlightId()
            .getCxCd().substring(0, 2)
            + " "
            + crewsOnFlightAssign.getFlightId().getFltNum()
            + (crewsOnFlightAssign.getFlightId().getFltSuffix() == null ? ""
                : crewsOnFlightAssign.getFlightId()
                    .getFltSuffix());
        String flda = chgXMLGregorianCalendarToDateString(crewsOnFlightAssign
            .getFlightId().getFltDate());
        if (HpUfisUtils.isNullOrEmptyStr(flda)) {
          LOG.error("Dropping the message .Incorrect flight date:"
              + "flight Number = {}, " + "Flight Date= {}, ",
              new Object[] { flightNumber, flda });
          if (logLevel
              .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                  .name())) {
            if (!msgLogged) {
              irmtabRef = _irmfacade.storeRawMsg(message,
                  dtflString);
              msgLogged = Boolean.TRUE;
            }
          }
          if (irmtabRef > 0) {
            sendErrInfo(EnumExceptionCodes.EWVAL, irmtabRef,
                isLast, flightNumber, flda);
          }
          return;
        }

        LOG.debug("flightNumber: " + flightNumber + "   FlightDate:"
            + flda);
        /*
         * LOG.debug("After Formating flight Date (yyyy-MM-dd):" +
         * sdf.format(chgXMLGregorianCalendarToDate(crewsOnFlightAssign
         * .getFlightId().getFltDate())));
         */
        // Look into DB only if ORG or DES is 'DXB'
        // if (crewsOnFlightAssign.getFlightId().getArrStn()
        // .equalsIgnoreCase(HpEKConstants.EK_HOPO)
        // || crewsOnFlightAssign.getFlightId().getDepStn()
        // .equalsIgnoreCase(HpEKConstants.EK_HOPO)) {
        // EntDbAfttab criteriaParams = new EntDbAfttab();
        // criteriaParams.setFlno(flightNumber);
        // criteriaParams.setFlda(flda);
        /*
         * urno = _afttabBean.getUrnoByFldaFlnoOrgDes(criteriaParams,
         * crewsOnFlightAssign.getFlightId().getArrStn(),
         * crewsOnFlightAssign.getFlightId().getDepStn());
         */
        // Search for IdFlight from FLT_DAILY
        fltDailyDto = new EntFlightDailyDTO();
        fltDailyDto
            .setFlda(sdf
                .format(chgXMLGregorianCalendarToDate(crewsOnFlightAssign
                    .getFlightId().getFltDate())));
        fltDailyDto.setFlightNumber(flightNumber);
        fltDailyDto.setFltOrg3(crewsOnFlightAssign.getFlightId()
            .getDepStn());
        fltDailyDto.setFltDes3(crewsOnFlightAssign.getFlightId()
            .getArrStn());
        urno = flitDailyBean.getFltDailyId(fltDailyDto);
        LOG.info("IdFlight:" + urno);
        if (HpUfisUtils.isNullOrEmptyStr(urno)) {
          LOG.error(
              "No flight is available in FLT_DAILY with the Flight details. Flight Number: {}, Flight Date: {}:Dropping the message.",
              new Object[] { flightNumber, flda });
          if (logLevel
              .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                  .name())) {
            if (!msgLogged) {
              irmtabRef = _irmfacade.storeRawMsg(message,
                  dtflString);
              msgLogged = Boolean.TRUE;
            }
          }
          if (irmtabRef > 0) {
            sendErrInfo(EnumExceptionCodes.ENOFL, irmtabRef,
                isLast, flightNumber, flda);
          }
          return;
        }

        long idFlight = (urno != null && (String.valueOf(urno) != null) && (!urno
            .isEmpty())) ? Long.parseLong(urno) : 0;
        String recStatus = " ";

        // Retrieve all crews from DB for the flight and on FltDate

        if (!crewsOnFlightAssign.getCrewFlightAssignment()
            .getCrewAssignment().isEmpty()) {

          List<CrewFlightAssignment.CrewAssignment> crewsAssigned = crewsOnFlightAssign
              .getCrewFlightAssignment().getCrewAssignment();

          List<String> incomingCrewsList = new ArrayList<String>();

          // if (idFlight != 0 && !crewsAssigned.isEmpty()) {
          if (!crewsAssigned.isEmpty()) {

            /*
             * LOGIC FOR SUMMARY
             */
            if (staffTypeMap.isEmpty()) {
              List<EntDbMdStaffType> staffTypeList = _mdStaffType
                  .getStaffTypeDetails();
              // Storing the Staff Type details in a list in order
              // Staff_SubType,Staff_Type
              List<String> details;
              if (!staffTypeList.isEmpty()) {
                for (EntDbMdStaffType staffTypeobj : staffTypeList) {
                  details = new ArrayList<String>();
                  // details.add(staffTypeobj.getStaffTypeCode());
                  details.add(staffTypeobj.getStaffSubtype());
                  details.add(staffTypeobj.getStaffTypeCode());
                  staffTypeMap.put(
                      staffTypeobj.getStaffType(),
                      details);
                }
              }
            }
            HashMap<String, Long> summaryByResType = new HashMap<String, Long>();
            HashMap<String, Long> summaryByWorkType = new HashMap<String, Long>();
            HashMap<String, Long> resTypeMap = new HashMap<String, Long>();
            HashMap<String, CrewFlightAssignment.CrewAssignment> crewFilter = new HashMap<String, CrewFlightAssignment.CrewAssignment>();
            for (CrewFlightAssignment.CrewAssignment iCrew : crewsAssigned) {
              isLast = Boolean.FALSE;
              if (iCrew.equals(crewsAssigned.get(crewsAssigned
                  .size() - 1))) {
                isLast = Boolean.TRUE;
              }
              if (HpUfisUtils.isNullOrEmptyStr(crewType)) {
                crewType = iCrew.getCrewType();
              }
              if (HpUfisUtils
                  .isNullOrEmptyStr(iCrew.getStaffno())
              // || crews.getFirstName() == null
              // || crews.getLastName() == null
              ) {
                LOG.error(
                    "Saff Details (StaffNo) are not specified correctly. Dropping the Crew Assignment Details:"
                        + "FlightNum = {}, "
                        + "Flight Date = {}, "
                        + "Crew ={}, ",
                    new Object[] { flightNumber, flda,
                        iCrew.getStaffno() });
                if (logLevel
                    .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                        .name())) {
                  if (!msgLogged) {
                    irmtabRef = _irmfacade.storeRawMsg(
                        message, dtflString);
                    msgLogged = Boolean.TRUE;
                  }
                }
                if (irmtabRef > 0) {
                  sendErrInfo(EnumExceptionCodes.EMAND,
                      irmtabRef, isLast, flightNumber,
                      flda);
                }
                continue;
              }
              // If similar staff occurs more than once in message
              if (crewFilter.isEmpty()) {
                crewFilter.put(iCrew.getStaffno(), iCrew);
              } else if (crewFilter.keySet().contains(
                  iCrew.getStaffno())) {
                crewFilter.put(iCrew.getStaffno(), iCrew);
              } else {
                crewFilter.put(iCrew.getStaffno(), iCrew);
              }
              if (incomingCrewsList.isEmpty()) {
                incomingCrewsList.add(iCrew.getStaffno());
              } else if (!incomingCrewsList.contains(iCrew
                  .getStaffno())) {
                incomingCrewsList.add(iCrew.getStaffno());
              }
            }
            List<CrewFlightAssignment.CrewAssignment> crewsAssignedFilter = new ArrayList<CrewFlightAssignment.CrewAssignment>(
                crewFilter.values());

            LOG.debug("flightNumber: "
                + flightNumber
                + "   idFlight:"
                + idFlight
                + "   FlightDate:"
                + convertDateToUTC(crewsOnFlightAssign
                    .getFlightId().getFltDate()));
            // If idFlight=0 no need to search in FLT_JOB_ASSIGN
            List<EntDbFltJobAssign> crewsFromDb = Collections.EMPTY_LIST;
            // Change on 29NOV2013
            if (idFlight != 0) {
              /*
               * crewsFromDb = _fltJobAssign
               * .getAssignedCrewsByFltId(idFlight);
               */
              crewsFromDb = _fltJobAssign
                  .getAssignedCrewsByFltIdCrewType(idFlight,
                      crewType);
            }

            //
            // LOG.debug(" Crews from DB list size:"+
            // crewsFromDb.size());
            HashMap<String, EntDbFltJobAssign> staffFromDB = new HashMap<String, EntDbFltJobAssign>();
            if (crewsFromDb != null && !crewsFromDb.isEmpty()) {
              for (EntDbFltJobAssign rec : crewsFromDb) {
                isLast = Boolean.FALSE;
                if (rec.equals(crewsFromDb.get(crewsFromDb
                    .size() - 1))) {
                  isLast = Boolean.TRUE;
                }
                if (!incomingCrewsList.contains(rec
                    .getStaffNumber())) {

                  // rec.setUpdatedDate(HpUfisCalendar
                  // .getCurrentUTCTime());

                  // rec.setUpdatedUser(HpEKConstants.ACTS_DATA_SOURCE);
                  // Change on 29NOV2013
                  /*
                   * crewAssignment = _fltJobAssign
                   * .getAssignedCrewIdByFlight(
                   * rec.getIdFlight(), rec.getStaffNumber());
                   * if (crewAssignment != null) {
                   * oldCrewAssignment = crewAssignment;
                   * crewAssignment
                   * .setUpdatedDate(HpUfisCalendar
                   * .getCurrentUTCTime()); crewAssignment
                   * .setUpdatedUser
                   * (HpEKConstants.ACTS_DATA_SOURCE);
                   * crewAssignment.setRecStatus("X");
                   * currCrewAssignment = _fltJobAssign
                   * .merge(crewAssignment);
                   */
                  oldCrewAssignment = rec.getClone();
                  rec.setUpdatedDate(HpUfisCalendar
                      .getCurrentUTCTime());
                  rec.setUpdatedUser(HpEKConstants.ACTS_DATA_SOURCE);
                  rec.setRecStatus("X");
                  currCrewAssignment = _fltJobAssign
                      .merge(rec);
                  if (currCrewAssignment != null) {
                    /*
                     * sendJobAssignUpdateToCedaInJson(
                     * currCrewAssignment,
                     * oldCrewAssignment, HpUfisAppConstants
                     * .UfisASCommands.URT .name(), isLast);
                     */

                    if (HpUfisUtils
                        .isNotEmptyStr(HpCommonConfig.notifyTopic)) {
                      // send notification message to
                      // topic
                      clsBlUfisBCTopic
                          .sendNotification(
                              isLast.booleanValue(),
                              HpUfisAppConstants.UfisASCommands.DRT,
                              null,
                              oldCrewAssignment,
                              currCrewAssignment);
                    }
                    if (HpUfisUtils
                        .isNotEmptyStr(HpCommonConfig.notifyQueue)) {
                      // if topic not defined, send
                      // notification to queue
                      ufisQueueProducer
                          .sendNotification(
                              isLast,
                              HpUfisAppConstants.UfisASCommands.DRT,
                              null,
                              oldCrewAssignment,
                              currCrewAssignment);
                    }
                    LOG.debug("ACTS Job Assign Record change communicated to Ceda.");
                  } else {
                    LOG.error(
                        "Failed on updating the record to DB. Crew Details(Staff Number): {}",
                        crewAssignment.getStaffNumber());
                  }
                  // }

                } else {
                  staffFromDB.put(rec.getStaffNumber(), rec);
                }
              }
            }
            for (CrewFlightAssignment.CrewAssignment crews : crewsAssignedFilter) {
              isLast = Boolean.FALSE;

              if (crews.equals(crewsAssignedFilter
                  .get(crewsAssignedFilter.size() - 1))) {
                isLast = Boolean.TRUE;
              }
              EntDbFltJobAssign fltJobAssignObj = new EntDbFltJobAssign();
              fltJobAssignObj
                  .setIdFlight(new BigDecimal(idFlight));
              if (crews.getAssignedOnDate() == null
                  || crews.getCrewTripEnd() == null
                  || crews.getCrewTripStart() == null
                  || crews.getActionType() == null) {
                LOG.error(
                    "Crew details(Assigned On Date, Crew Trip Start, Crew Trip End and Action Type) not specified correctly. Dropping the Crew  Assignment:"
                        + "FlightNum = {}, "
                        + "Flight Date = {}, "
                        + "Crew ={}, ",
                    new Object[] { flightNumber, flda,
                        crews.getStaffno() });
                if (logLevel
                    .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                        .name())) {
                  if (!msgLogged) {
                    irmtabRef = _irmfacade.storeRawMsg(
                        message, dtflString);
                    msgLogged = Boolean.TRUE;
                  }
                }
                if (irmtabRef > 0) {
                  sendErrInfo(EnumExceptionCodes.EMAND,
                      irmtabRef, isLast, flightNumber,
                      flda);
                }
                continue;
              }
              if (HpUfisUtils.isNullOrEmptyStr(crews
                  .getCrewType())
                  || HpUfisUtils.isNullOrEmptyStr(crews
                      .getOperatingGrade())
                  || HpUfisUtils.isNullOrEmptyStr(crews
                      .getWorkType())) {
                LOG.error(
                    "Crew Details are not specified correctly. Dropping the Crew Assignment Details:"
                        + "FlightNum = {}, "
                        + "Flight Date = {}, "
                        + "Crew ={}, ",
                    new Object[] { flightNumber, flda,
                        crews.getStaffno() });
                if (logLevel
                    .equalsIgnoreCase(HpUfisAppConstants.IrmtabLogLev.LOG_ERR
                        .name())) {
                  if (!msgLogged) {
                    irmtabRef = _irmfacade.storeRawMsg(
                        message, dtflString);
                    msgLogged = Boolean.TRUE;
                  }
                }
                if (irmtabRef > 0) {
                  sendErrInfo(EnumExceptionCodes.EMAND,
                      irmtabRef, isLast, flightNumber,
                      flda);
                }
                continue;
              }

              fltJobAssignObj = assignFlightData(fltJobAssignObj,
                  crewsOnFlightAssign);

              if ((!staffFromDB.isEmpty())
                  && staffFromDB.keySet().contains(
                      crews.getStaffno())
                  && (staffFromDB.get(crews.getStaffno())
                      .getIdFlight() != BigDecimal.ZERO)) { // update
                // the
                // existing
                // recordstaffFromDB
                EntDbFltJobAssign recFromDB = staffFromDB
                    .get(crews.getStaffno());
                oldCrewAssignment = recFromDB.getClone();
                recFromDB = assignFlightData(recFromDB,
                    crewsOnFlightAssign);
                if (crews.getActionType().equals(
                    ActionType.DELETE)) {
                  LOG.warn(
                      "Crew exist in FLT_JOB_ASSIGN. Deleting the Crew: "
                          + "FlightId = {}, "
                          + "Staff Number = {}, ",
                      new Object[] {
                          fltJobAssignObj
                              .getIdFlight(),
                          fltJobAssignObj
                              .getStaffNumber() });
                  recFromDB.setUpdatedDate(HpUfisCalendar
                      .getCurrentUTCTime());
                  recFromDB
                      .setUpdatedUser(HpEKConstants.ACTS_DATA_SOURCE);
                  // _fltJobAssign
                  // .deleteCrewFltAssign(recFromDB);
                  // Change on 29NOV2013
                  /*
                   * crewAssignment = _fltJobAssign
                   * .getAssignedCrewIdByFlight(
                   * recFromDB.getIdFlight(),
                   * recFromDB.getStaffNumber()); if
                   * (crewAssignment != null) {
                   * crewAssignment.setRecStatus("X");
                   * currCrewAssignment = _fltJobAssign
                   * .merge(crewAssignment);
                   */
                  recFromDB.setRecStatus("X");
                  currCrewAssignment = _fltJobAssign
                      .merge(recFromDB);
                  if (currCrewAssignment != null) {
                    /*
                     * sendJobAssignUpdateToCedaInJson(
                     * currCrewAssignment,
                     * oldCrewAssignment, HpUfisAppConstants
                     * .UfisASCommands.URT .name(), isLast);
                     * LOG.debug(
                     * "ACTS Job Assign Record change has beed communicated to Ceda."
                     * );
                     */
                    if (HpUfisUtils
                        .isNotEmptyStr(HpCommonConfig.notifyTopic)) {
                      // send notification message to
                      // topic
                      clsBlUfisBCTopic
                          .sendNotification(
                              isLast.booleanValue(),
                              HpUfisAppConstants.UfisASCommands.DRT,
                              null,
                              oldCrewAssignment,
                              currCrewAssignment);
                    }
                    if (HpUfisUtils
                        .isNotEmptyStr(HpCommonConfig.notifyQueue)) {
                      // if topic not defined, send
                      // notification to queue
                      ufisQueueProducer
                          .sendNotification(
                              isLast,
                              HpUfisAppConstants.UfisASCommands.DRT,
                              null,
                              oldCrewAssignment,
                              currCrewAssignment);
                    }
                    LOG.debug("ACTS Job Assign Record change communicated to Ceda.");
                  } else {
                    LOG.error(
                        "Failed on updating the record to DB. Crew Details(Staff Number): {}",
                        crewAssignment.getStaffNumber());
                  }
                  // }
                  continue;
                }

                recFromDB
                    .setJobAssignDate(convertDateToUTC(crews
                        .getAssignedOnDate()));
                recFromDB.setTripStart(crews.getCrewTripStart()
                    .value().substring(0, 1));
                recFromDB.setTripEnd(crews.getCrewTripEnd()
                    .value().substring(0, 1));
                // recFromDB.setStaffNumber(crews.getStaffno());
                recFromDB.setStaffFirstName(crews
                    .getFirstName());
                recFromDB.setStaffLastName(crews.getLastName());
                if (HpUfisUtils.isNotEmptyStr(fltJobAssignObj
                    .getStaffFirstName())
                    && HpUfisUtils
                        .isNotEmptyStr(fltJobAssignObj
                            .getStaffLastName())) {
                  fltJobAssignObj
                      .setStaffName(fltJobAssignObj
                          .getStaffFirstName()
                          .concat(" "
                              + fltJobAssignObj
                                  .getStaffLastName()));
                }
                recFromDB.setStaffType(crews.getCrewType());
                recFromDB.setStaffOpGrade(crews
                    .getOperatingGrade());
                recFromDB.setStaffWorkType(crews.getWorkType());
                recFromDB.setRecStatus(" ");
                recFromDB
                    .setUpdatedUser(HpEKConstants.ACTS_DATA_SOURCE);

                recFromDB.setUpdatedDate(HpUfisCalendar
                    .getCurrentUTCTime());

                currCrewAssignment = _fltJobAssign
                    .merge(recFromDB);
                LOG.debug(
                    "Updated the crew details into FLT_JOB_ASSIGN successfully.{}",
                    (flightNumber + " " + crews
                        .getStaffno()));
                if (currCrewAssignment != null) {
                  /*
                   * sendJobAssignUpdateToCedaInJson(
                   * currCrewAssignment, null,
                   * HpUfisAppConstants.UfisASCommands.URT
                   * .name(), isLast); LOG.debug(
                   * "ACTS Job Assign Record update communicated to Ceda."
                   * );
                   */
                  if (HpUfisUtils
                      .isNotEmptyStr(HpCommonConfig.notifyTopic)) {
                    // send notification message to topic
                    clsBlUfisBCTopic
                        .sendNotification(
                            isLast.booleanValue(),
                            HpUfisAppConstants.UfisASCommands.URT,
                            null,
                            oldCrewAssignment,
                            currCrewAssignment);
                  }
                  if (HpUfisUtils
                      .isNotEmptyStr(HpCommonConfig.notifyQueue)) {
                    // if topic not defined, send
                    // notification to queue
                    ufisQueueProducer
                        .sendNotification(
                            isLast,
                            HpUfisAppConstants.UfisASCommands.URT,
                            null,
                            oldCrewAssignment,
                            currCrewAssignment);
                  }
                  LOG.debug("ACTS Job A)ssign Record change communicated to Ceda.");
                } else {
                  LOG.error(
                      "Failed on updating the record to DB. Crew Details(Staff Number): {}",
                      recFromDB.getStaffNumber());
                }

                if (idFlight != 0
                    && (recFromDB.getStaffWorkType()
                        .equalsIgnoreCase("OP") || recFromDB
                        .getStaffWorkType()
                        .equalsIgnoreCase("HV"))) {
                  String key = recFromDB.getStaffType() + ","
                      + recFromDB.getStaffWorkType();
                  // LOG.debug("key:"+key);
                  // LOG.debug("summaryByWorkType.containsKey(key):"+summaryByWorkType.containsKey(key));

                  if (summaryByResType.isEmpty()
                      || !summaryByResType
                          .containsKey(recFromDB
                              .getStaffType())) {
                    summaryByResType.put(
                        recFromDB.getStaffType(),
                        new Long(1));
                    summaryByWorkType.put(key, new Long(1));
                  } else if (summaryByResType
                      .containsKey(recFromDB
                          .getStaffType())
                      && !summaryByWorkType
                          .containsKey(key)) {
                    // LOG.debug("key:"+key);
                    long count = summaryByResType.get(
                        recFromDB.getStaffType())
                        .longValue();
                    summaryByResType.put(
                        recFromDB.getStaffType(),
                        new Long(count + 1));
                    summaryByWorkType.put(key, new Long(1));
                  } else {
                    long count = summaryByResType.get(
                        recFromDB.getStaffType())
                        .longValue();
                    summaryByResType.put(
                        recFromDB.getStaffType(),
                        new Long(count + 1));
                    summaryByWorkType.put(key, new Long(
                        summaryByWorkType.get(key)
                            .longValue() + 1));
                  }
View Full Code Here

        existJobAssignList = dlEKRTCFltJobAssignBean
            .getExsitRecordByShiftIdX(entDbStaffShift.getShiftId());
        LOG.info("search records in FltJobAssign table, takes {} ms", System.currentTimeMillis()
            - startTime)
         
          EntDbFltJobAssign existJobAssignForTask = null;
         
          if (existJobAssignList != null && existJobAssignList.size() >0){
            existJobAssignForTask = existJobAssignList.get(0);
          }
         
         
           if (existJobAssignForTask != null){  
             // search record in jobAssign table and set value
//             EntDbFltJobAssign existJobAssign = dlEKRTCFltJobAssignBean.getExsitRecord(existJobAssignForTask.getTaskId(), entDbStaffShift.getShiftId());
            
             EntDbFltJobAssign oldEntDbFltJobAssign = (EntDbFltJobAssign)SerializationUtils.clone(existJobAssignForTask);
            
           startTime = System.currentTimeMillis();
          // staffShift set idFlight
          entDbStaffShift.setIdFlight(existJobAssignForTask
              .getIdFlight());
          entDbStaffShift.setIdFltJobTask(existJobAssignForTask
              .getIdFltJobTask());
          entDbStaffShift.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
          entDbStaffShift.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
          //             dlEKRTCStaffShiftBean.Update(entDbStaffShift);
          // added by 2013-11-15
          existJobAssignForTask.setStaffFirstName(entDbStaffShift
              .getStaffFirstName());
          existJobAssignForTask.setStaffName(entDbStaffShift
              .getStaffName());
          existJobAssignForTask.setStaffNumber(entDbStaffShift
              .getStaffNumber());
          existJobAssignForTask.setStaffType(entDbStaffShift
              .getStaffType());
          existJobAssignForTask.setIdStaffShift(entDbStaffShift
              .getId());
          existJobAssignForTask.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
          existJobAssignForTask.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
         
          LOG.info("update staffShift FltJobAssign fltJobTask table, takes {} ms", System.currentTimeMillis()
              - startTime);
         
          // send notification
          ufisTopicProducer.sendNotification(true, UfisASCommands.URT,
              String.valueOf(existJobAssignForTask.getIdFlight()), oldEntDbFltJobAssign, existJobAssignForTask);
            
//             EntDbFltJobAssign existJobAssign = null;                                          comment on 2013-11-15                                 
//            
//            Iterator<EntDbFltJobAssign> existJobAssignListIt = existJobAssignList.iterator();
//            while (existJobAssignListIt.hasNext()){
//              EntDbFltJobAssign jobAssign = existJobAssignListIt.next();
//              if (jobAssign.getShiftId().equals(entDbStaffShift.getShiftId())){
//                existJobAssign = jobAssign;
//              }
//            }
//         
//             if (existJobAssign == null){
//               existJobAssign = new EntDbFltJobAssign();
//              
//               existJobAssign.setStaffFirstName(entDbStaffShift.getStaffFirstName());
//               existJobAssign.setStaffName(entDbStaffShift.getStaffName());
//               existJobAssign.setStaffNumber(entDbStaffShift.getStaffNumber());
//               existJobAssign.setStaffType(entDbStaffShift.getStaffType());
//               existJobAssign.setIdStaffShift(entDbStaffShift.getId());
//               existJobAssign.setShiftId(entDbStaffShift.getShiftId());
//              
////               dlEKRTCFltJobAssignBean.Persist(existJobAssign);
//             }else {
//               existJobAssign.setStaffFirstName(entDbStaffShift.getStaffFirstName());
//               existJobAssign.setStaffName(entDbStaffShift.getStaffName());
//               existJobAssign.setStaffNumber(entDbStaffShift.getStaffNumber());
//               existJobAssign.setStaffType(entDbStaffShift.getStaffType());
//               existJobAssign.setIdStaffShift(entDbStaffShift.getId());
//              
////               dlEKRTCFltJobAssignBean.Update(existJobAssign);        
//             }
            

                 
           }
          
         }else if ("UPD".equalsIgnoreCase(blHandleEKRTC.getStaffShiftMsgSubType())){
           // search exist record
           EntDbStaffShift existStaffShift;
        long startTime = System.currentTimeMillis();
        existStaffShift = dlEKRTCStaffShiftBean
            .getExsitRecordByShiftIdX(entDbStaffShift.getShiftId());
        LOG.info("search records in staffShift table, takes {} ms", System.currentTimeMillis()
            - startTime);

           
           if (existStaffShift != null){
     
             EntDbStaffShift oldEntDbStaffShift = (EntDbStaffShift)SerializationUtils.clone(existStaffShift);
            
           startTime = System.currentTimeMillis();
          // update staffShift table
          Class<EntDbStaffShift> EntDbStaffShiftClass = EntDbStaffShift.class;
          Field[] EntDbStaffShiftClassFields = EntDbStaffShiftClass
              .getDeclaredFields();
          //             Field[] EntDbStaffShiftClassFields = EntDbStaffShiftClass.getFields();
          for (Field f : EntDbStaffShiftClassFields) {
            if (!"id".equalsIgnoreCase(f.getName())
                && !"serialVersionUID".equalsIgnoreCase(f
                    .getName())) {
              setEntityValue(
                  existStaffShift,
                  f.getName(),
                  getEntityValue(entDbStaffShift, f.getName()));
            }
          }
          existStaffShift.setRecStatus(" ");
          existStaffShift.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
          existStaffShift.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
          //             dlEKRTCStaffShiftBean.Update(entDbStaffShift);
          LOG.info("update  staffShift table, takes {} ms", System.currentTimeMillis()
              - startTime);
         
          // send notification
          ufisTopicProducer.sendNotification(true, UfisASCommands.URT,
              String.valueOf(existStaffShift.getIdFlight()), oldEntDbStaffShift, existStaffShift);

//             EntDbFltJobTask existJobTask = dlEKRTCFltJobTaskBean.getExsitRecordByJobAssignShiftId(entDbStaffShift.getShiftId());
             List<EntDbFltJobAssign> existJobAssignList;
          startTime = System.currentTimeMillis();
          existJobAssignList = dlEKRTCFltJobAssignBean
              .getExsitRecordByShiftIdX(entDbStaffShift
                  .getShiftId());
          LOG.info("search records in FltJobAssign table, takes {} ms", System.currentTimeMillis()
              - startTime);
   
//             // search record in FltJobTask table
//             EntDbFltJobTask existJobTask = dlEKRTCFltJobTaskBean.getExsitRecordByJobAssignShiftId(entDbStaffShift.getShiftId());
            EntDbFltJobAssign existJobAssignForTask = null;
           
            if (existJobAssignList != null && existJobAssignList.size() >0){
              existJobAssignForTask = existJobAssignList.get(0);
            }
           
           
             if (existJobAssignForTask != null){
               EntDbFltJobAssign oldEntDbFltJobAssign = (EntDbFltJobAssign)SerializationUtils.clone(existJobAssignForTask);
              
               // staffShift set idFlight
               existStaffShift.setIdFlight(existJobAssignForTask.getIdFlight());
               existStaffShift.setIdFltJobTask(existJobAssignForTask.getIdFltJobTask());
              
               // added by 2013-11-15
            startTime = System.currentTimeMillis();
            existJobAssignForTask.setStaffFirstName(existStaffShift
                .getStaffFirstName());
            existJobAssignForTask.setStaffName(existStaffShift
                .getStaffName());
            existJobAssignForTask.setStaffNumber(existStaffShift
                .getStaffNumber());
            existJobAssignForTask.setStaffType(existStaffShift
                .getStaffType());
            existJobAssignForTask.setIdStaffShift(existStaffShift
                .getId());
           
            existJobAssignForTask.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
            existJobAssignForTask.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
            LOG.info("update FltJobAssign table, takes {} ms",
                System.currentTimeMillis() - startTime);

              
//               dlEKRTCStaffShiftBean.Update(entDbStaffShift);
              
//               // search record in jobAssign table and set value
//               EntDbFltJobAssign existJobAssign = dlEKRTCFltJobAssignBean.getExsitRecord(existJobTask.getTaskId(), existStaffShift.getShiftId());
              
//               EntDbFltJobAssign existJobAssign = null;            comment on 2013-11-15
//              
//                Iterator<EntDbFltJobAssign> existJobAssignListIt = existJobAssignList.iterator();
//                while (existJobAssignListIt.hasNext()){
//                  EntDbFltJobAssign jobAssign = existJobAssignListIt.next();
//                  if (jobAssign.getShiftId().equals(entDbStaffShift.getShiftId())){
//                    existJobAssign = jobAssign;
//                  }
//                }
//              
//              
//               if (existJobAssign != null){
//                 startTime = System.currentTimeMillis();
//                
//                 existJobAssign.setStaffFirstName(existStaffShift.getStaffFirstName());
//                 existJobAssign.setStaffName(existStaffShift.getStaffName());
//                 existJobAssign.setStaffNumber(existStaffShift.getStaffNumber());
//                 existJobAssign.setStaffType(existStaffShift.getStaffType());
//                 existJobAssign.setIdStaffShift(existStaffShift.getId());
////                 dlEKRTCFltJobAssignBean.Update(existJobAssign);   
//                
//                endTime = System.currentTimeMillis();
//                LOG.info("takes {} ms to update FltJobAssign table ", (endTime - startTime));
//               }
                   
             }
            
           }
              
          
         }
         else if ("DEL".equalsIgnoreCase(blHandleEKRTC.getStaffShiftMsgSubType())){ // added by 2013-11-15

           long startTime = System.currentTimeMillis();
        EntDbStaffShift existStaffShift = dlEKRTCStaffShiftBean
            .getExsitRecordByShiftIdX(entDbStaffShift.getShiftId());
        LOG.info("search records in staffShift table, takes {} ms", System.currentTimeMillis()
            - startTime);
       
        // update staffShift
        if (existStaffShift != null){
          existStaffShift.setRecStatus("X");
         
          // send notification
          ufisTopicProducer.sendNotification(true, UfisASCommands.DET,
              String.valueOf(existStaffShift.getIdFlight()), null, existStaffShift);
        }else{
          LOG.warn("could not find exist record from staffShif for DEL msg");
        }
       
        // update fltJobAssign table

//           EntDbFltJobTask existJobTask = dlEKRTCFltJobTaskBean.getExsitRecordByJobAssignShiftId(entDbStaffShift.getShiftId());
          List<EntDbFltJobAssign> existJobAssignList;
         
        startTime = System.currentTimeMillis();
        existJobAssignList = dlEKRTCFltJobAssignBean
            .getExsitRecordByShiftIdX(entDbStaffShift.getShiftId());
        LOG.info("search records in FltJobAssign table, takes {} ms", System.currentTimeMillis()
            - startTime);

//           // search record in FltJobTask table
//           EntDbFltJobTask existJobTask = dlEKRTCFltJobTaskBean.getExsitRecordByJobAssignShiftId(entDbStaffShift.getShiftId());
          EntDbFltJobAssign existJobAssignForTask = null;
         
          if (existJobAssignList != null && existJobAssignList.size() >0){
            existJobAssignForTask = existJobAssignList.get(0);
          }
         
          if (existJobAssignForTask != null){
            existJobAssignForTask.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
            existJobAssignForTask.setUpdatedUser("RTC");
            existJobAssignForTask.setRecStatus("X");
            existJobAssignForTask.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
           
            // send notification
            ufisTopicProducer.sendNotification(true, UfisASCommands.DET,
                String.valueOf(existJobAssignForTask.getIdFlight()), null, existJobAssignForTask);
          }

         
         }
        
View Full Code Here

             
              // send notification
              ufisTopicProducer.sendNotification(true, UfisASCommands.URT,
                  String.valueOf(existJobTask.getIdFlight()), oldEntDbFltJobTask, existJobTask);
             
            EntDbFltJobAssign matchFltJobAssign = null;
               Iterator<EntDbFltJobAssign> existJobAssignListIt = existJobAssignList.iterator();
               while (existJobAssignListIt.hasNext()){
                 EntDbFltJobAssign FltJobAssign = existJobAssignListIt.next();
                 if (FltJobAssign.getShiftId().equals(entDbFltJobAssign.getShiftId())){
                   matchFltJobAssign = FltJobAssign;
                   break;
                 }
               }
              
               if (matchFltJobAssign != null){
          
               startTime = System.currentTimeMillis();
              // update jobAssign
              Class<EntDbFltJobAssign> EntDbFltJobAssign = EntDbFltJobAssign.class;
              Field[] EntDbFltJobAssignClassFields = EntDbFltJobAssign
                  .getDeclaredFields();
              for (Field f : EntDbFltJobAssignClassFields) {
                if (!"id".equalsIgnoreCase(f.getName())
                    && !"serialVersionUID"
                        .equalsIgnoreCase(f.getName())) {
                  setEntityValue(
                      matchFltJobAssign,
                      f.getName(),
                      getEntityValue(entDbFltJobAssign,
                          f.getName()));
                }
              }
              matchFltJobAssign.setRecStatus(" ");
              matchFltJobAssign.setUpdatedDate(HpUfisCalendar
                  .getCurrentUTCTime());
              LOG.info("update fltJobAssign table, takes {} ms",
                  System.currentTimeMillis() - startTime);

//                 dlEKRTCFltJobAssignBean.Update(existJobAssign);
                 }else {
                   LOG.info("existJobAssign is null, jobAssign table will not be updated");
                 }
           
                   if (MatchStaffShift != null){
                    startTime = System.currentTimeMillis();
                    
                   startTime = System.currentTimeMillis();
                // update staffShift
                MatchStaffShift.setIdFlight(existJobTask
                    .getIdFlight());
                MatchStaffShift.setIdFltJobTask(existJobTask
                    .getId());
                LOG.info("update staffShift table, takes {} ms",
                    System.currentTimeMillis() - startTime);
 
                   }
           
             }else{
              startTime = System.currentTimeMillis();
              
               // mark fltJobTask as 'X'
               existJobTask.setRecStatus("X");
               existJobTask.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
               existJobTask.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
              
               Iterator<EntDbStaffShift> existStaffShifListIt = existStaffShiftList.iterator();
               while(existStaffShifListIt.hasNext()){
                 EntDbStaffShift entDbStaffShiftX = existStaffShifListIt.next();
                 // mark existing staffShift  as 'X', delete
                 entDbStaffShiftX.setRecStatus("X");
                 entDbStaffShiftX.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
                 entDbStaffShiftX.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
               }
              
               Iterator<EntDbFltJobAssign> existEntDbFltJobAssignListIt = existJobAssignList.iterator();
               while (existEntDbFltJobAssignListIt.hasNext()){
                 EntDbFltJobAssign entDbFltJobAssignX  = existEntDbFltJobAssignListIt.next();
                 // mark existing fltJobTask  as 'X', delete
                 entDbFltJobAssignX.setRecStatus("X");
                 entDbFltJobAssignX.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
                 entDbFltJobAssignX.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());

               }

              LOG.info("update related staffShift fltJobAssign fltJobTask records to 'X', takes {} ms ", (System.currentTimeMillis() - startTime));

              startTime = System.currentTimeMillis();
              // insert new record to fltJobTask and fltJobAssign table
              entDbFltJobTask.setIdFlight(urno);
              dlEKRTCFltJobTaskBean.Persist(entDbFltJobTask);
              entDbFltJobAssign.setIdFlight(urno);
              entDbFltJobAssign.setIdFltJobTask(entDbFltJobTask
                  .getId());
              dlEKRTCFltJobAssignBean.Persist(entDbFltJobAssign);
              LOG.info("insert new record to fltJobTask and fltJobAssign table, takes {} ms",
                  System.currentTimeMillis() - startTime);
   
             }

         
           }
//           else {
//             LOG.info("exist record for JobTask not found, resourceAssignmentType 'UPD' message will be insert as new record");
//             // insert into fltJobTask table
//             entDbFltJobTask.setIdFlight(urno);
//             dlEKRTCFltJobTaskBean.Persist(entDbFltJobTask);
//             // insert into fltJobAssign table
//             entDbFltJobAssign.setIdFlight(urno);
//             entDbFltJobAssign.setIdFltJobTask(entDbFltJobTask.getId());
//             dlEKRTCFltJobAssignBean.Persist(entDbFltJobAssign);
//            
//             startTime = System.currentTimeMillis();
//             // search record in staffShift table
//             EntDbStaffShift existStaffShift = dlEKRTCStaffShiftBean.getExsitRecordByShiftIdX(entDbFltJobAssign.getShiftId());
//             endTime = System.currentTimeMillis();
//            LOG.info("takes {} ms to search records in staffShift table ", (endTime - startTime));
//            
//             if (existStaffShift != null){
//               // staffShift set idFlight and updated
//               existStaffShift.setIdFlight(entDbFltJobTask.getIdFlight());
//               existStaffShift.setIdFltJobTask(entDbFltJobTask.getId());
//               existStaffShift.setUpdatedDate(new Date());
////               dlEKRTCStaffShiftBean.Update(existStaffShift);
//              
//               // update fltJboAssign
//               entDbFltJobAssign.setIdStaffShift(existStaffShift.getId());
//               entDbFltJobAssign.setStaffFirstName(existStaffShift.getStaffFirstName());
//               entDbFltJobAssign.setStaffName(existStaffShift.getStaffName());
//               entDbFltJobAssign.setStaffNumber(existStaffShift.getStaffNumber());
//               entDbFltJobAssign.setStaffType(existStaffShift.getStaffType());      
////               dlEKRTCFltJobAssignBean.Update(entDbFltJobAssign);     
//             }
//           }
        
          
         }else if ("DEL".equalsIgnoreCase(blHandleEKRTC.getResAssignMsgSubType())){

           // search record in FltJobTask table
           EntDbFltJobTask existJobTask;
         startTime = System.currentTimeMillis();
        existJobTask = dlEKRTCFltJobTaskBean
            .getExsitRecordX(entDbFltJobTask.getTaskId());
        LOG.info("search records in jobTask table, takes {} ms", System.currentTimeMillis()
            - startTime);
          
           if (existJobTask != null){
            
             startTime = System.currentTimeMillis();
             // mark task record as deleted, "X"
            // update jobTask
             Class<EntDbFltJobTask> entDbFltJobTaskClass = EntDbFltJobTask.class;
             Field[] entDbFltJobTaskClassFields = entDbFltJobTaskClass.getDeclaredFields();
             for(Field f : entDbFltJobTaskClassFields){
               if (!"id".equalsIgnoreCase(f.getName()) && !"serialVersionUID".equalsIgnoreCase(f.getName())){
                 setEntityValue(existJobTask, f.getName(), getEntityValue(entDbFltJobTask, f.getName()));
               }
             }  
            
             existJobTask.setRecStatus("X");
//             dlEKRTCFltJobTaskBean.Update(existJobTask);
             existJobTask.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
             existJobTask.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
            
             // search exist record of jobAssign
             List<EntDbFltJobAssign> existJobAssignList = dlEKRTCFltJobAssignBean.getExsitRecordX(existJobTask.getId());
             Iterator<EntDbFltJobAssign>  existJobAssignListIt = existJobAssignList.iterator();
             while (existJobAssignListIt.hasNext()){
               EntDbFltJobAssign existFltJobAssign = existJobAssignListIt.next();
              
              // update jobTask
               Class<EntDbFltJobAssign> entDbFltJobAssignClass = EntDbFltJobAssign.class;
               Field[] entDbFltJobAssignClassFields = entDbFltJobAssignClass.getDeclaredFields();
               for(Field f : entDbFltJobAssignClassFields){
                 if (!"id".equalsIgnoreCase(f.getName()) && !"serialVersionUID".equalsIgnoreCase(f.getName())){
                   setEntityValue(existFltJobAssign, f.getName(), getEntityValue(entDbFltJobAssign, f.getName()));
                 }
               }  
            // mark job assign as deleted, "X"
               existFltJobAssign.setIdFlight(existJobTask.getIdFlight());
               existFltJobAssign.setRecStatus("X");
               existFltJobAssign.setUpdatedUser(HpEKConstants.EKRTC_DATA_SOURCE);
//               dlEKRTCFltJobAssignBean.Update(existFltJobAssign);
               existFltJobAssign.setUpdatedDate(HpUfisCalendar.getCurrentUTCTime());
              
              // send notification
              ufisTopicProducer.sendNotification(true, UfisASCommands.DET,
                  String.valueOf(existFltJobAssign.getIdFlight()), null, existFltJobAssign);
             }
            
             // search exist record of staffShift
             List<EntDbStaffShift> existStaffShiftList  = dlEKRTCStaffShiftBean.getExsitRecordByidFltJboTaskX(existJobTask.getId());
             Iterator<EntDbStaffShift> existStaffShiftListIt = existStaffShiftList.iterator();
View Full Code Here

  }

  @Override
  @TransactionAttribute(TransactionAttributeType.REQUIRED)
  public EntDbFltJobAssign merge(EntDbFltJobAssign fltJobAssign) {
    EntDbFltJobAssign result = null;
    try {
      result = em.merge(fltJobAssign);
    } catch (OptimisticLockException Oexc) {
      LOG.error("OptimisticLockException Entity:{} , Error:{}",
          fltJobAssign, Oexc);
View Full Code Here

  }
 
  @Override
  public EntDbFltJobAssign getAssignedCrewIdByFlight(BigDecimal idFlight, String staffNum, String crewType) {

    EntDbFltJobAssign entResult = null;
    try {
      Query query = em.createNamedQuery("EntDbFltJobAssign.findAssignedCrewByFlidAndStaffNum");
      query.setParameter("idFlight", idFlight);
      query.setParameter("staffNumber", staffNum);
      query.setParameter("staffTypeCode", HpEKConstants.CREW_STAFF_TYPE_CODE);
View Full Code Here

    if (irmtabRef > 0) {
      msgLogged = Boolean.TRUE;
    }
     
      if (resourceAssignmentType != null){
        EntDbFltJobAssign edpiodEntDbFltJobAssign = new EntDbFltJobAssign();
        EntDbFltJobTask edpiodEntDbFltJobTask = new EntDbFltJobTask();
//        EntDbStaffShift edpiodEntDbStaffShift = new EntDbStaffShift();
       
//        SimpleDateFormat RTCdf = new SimpleDateFormat(HpEKConstants.EKRTC_TIME_FORMAT);
        // convert local time to UTC
//        RTCdf.setTimeZone(HpEKConstants.utcTz);
       
        // check meta
        if (resourceAssignmentType.getMeta() == null){
          LOG.info("Mandatory field Meta is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set message time
        if (resourceAssignmentType.getMeta().getMessageTime() != null){
          edpiodEntDbFltJobAssign.setMsgSendDate(convertXMLGregorianCalendarToDate(resourceAssignmentType.getMeta().getMessageTime()));
        }else {
          LOG.info("Mandatory field message time is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // check messageID
        if (resourceAssignmentType.getMeta().getMessageID() == 0){
          LOG.info("Mandatory field messageID time is 0, resourceAssignmentType message is rejected");
          return false;
        }
       
        // check message type
        if (resourceAssignmentType.getMeta().getMessageType() == null || "".equals(resourceAssignmentType.getMeta().getMessageType())){
          LOG.info("Mandatory field message type is null or empty string, ResourceShiftType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }else if (!Arrays.asList(messageAssignmentTypeArray).contains(resourceAssignmentType.getMeta().getMessageType())){
          LOG.info("Mandatory field message type {} is in possible value, ResourceShiftType message is rejected", resourceAssignmentType.getMeta().getMessageType());
         
          sendErroNotification(EnumExceptionCodes.EENUM);
         
          return false;
        }
       
        // check messageSubtype
        if (resourceAssignmentType.getMeta().getMessageSubtype() == null || "".equals(resourceAssignmentType.getMeta().getMessageSubtype().trim())){
          LOG.info("Mandatory field messageSubtype is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }else if (!Arrays.asList(messageAssignmentSubtypeArray).contains(resourceAssignmentType.getMeta().getMessageSubtype().toUpperCase().trim())){
          LOG.info("Mandatory field messageSubtype {} is in possible value, resourceAssignmentType message is rejected", resourceAssignmentType.getMeta().getMessageSubtype());
         
          sendErroNotification(EnumExceptionCodes.EENUM);
         
          return false;
        }else {
          resAssignMsgSubType = resourceAssignmentType.getMeta().getMessageSubtype();
        }
       
        // set messageSource
        if (resourceAssignmentType.getMeta().getMessageSource() != null && !"".equals(resourceAssignmentType.getMeta().getMessageSource().trim())){
          if (Arrays.asList(messageSourceArray).contains(resourceAssignmentType.getMeta().getMessageSource().toUpperCase().trim())){
            switch(resourceAssignmentType.getMeta().getMessageSource().toUpperCase().trim()){
              case "ENGRTC":
                edpiodEntDbFltJobAssign.setStaffType("ENGR");
                edpiodEntDbFltJobTask.setStaffType("ENGR");
                break;
            }
          }else{
            LOG.info("Mandatory field messageSource {} is not in possible value, resourceAssignmentType message is rejected", resourceAssignmentType.getMeta().getMessageSource());
           
            sendErroNotification(EnumExceptionCodes.EENUM);
           
              return false;
          }
         
        }else {
          LOG.info("Mandatory field messageSource is null or empty string, ResourceShiftType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set TSK
        if (resourceAssignmentType.getTSK() == null ){
          LOG.info("Mandatory field messageSource is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set AID
        if (resourceAssignmentType.getTSK().getAID() != null && !"".equals(resourceAssignmentType.getTSK().getAID())){
          edpiodEntDbFltJobTask.setTaskId(new BigDecimal(resourceAssignmentType.getTSK().getAID()));
        }else {
          LOG.info("Mandatory field AID is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set TRG
        if (resourceAssignmentType.getTSK().getTRG() != null && !"".equals(resourceAssignmentType.getTSK().getTRG().trim())){
          edpiodEntDbFltJobTask.setTaskRuleGrp(resourceAssignmentType.getTSK().getTRG());
        }else{
          if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
            LOG.info("Mandatory field TRG is null or empty string, resourceAssignmentType message is rejected");
           
            sendErroNotification(EnumExceptionCodes.EMAND);
           
              return false;
          }
        }
       
        // set TRQ
        if (resourceAssignmentType.getTSK().getTRQ() != null && !"".equals(resourceAssignmentType.getTSK().getTRQ().trim())){
          if (entStartupInitSingleton.isMDTaskReqtListOn()){
          // to check with master data
            switch (edpiodEntDbFltJobTask.getStaffType()){
          case "ENGR":
            if (!entStartupInitSingleton.getENGRTaskReqtList().contains(resourceAssignmentType.getTSK().getTRQ().trim())){
              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRQ().trim() ,"ENGR");
            }
            break;
            }
        } 
          edpiodEntDbFltJobTask.setTaskRequirementId(resourceAssignmentType.getTSK().getTRQ());
        }else {
          if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
          LOG.info("Mandatory field TRQ is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
          }
        }
       
//        // set TRD
//        if (resourceAssignmentType.getTSK().getTRD() != null && !"".equals(resourceAssignmentType.getTSK().getTRD().trim())){
//          if (entStartupInitSingleton.isMDTaskReqtListOn()){
//          // to check with master data
//            switch (edpiodEntDbFltJobTask.getStaffType()){
//          case "EK":
//            if (!entStartupInitSingleton.getEKASTaskReqtList().contains(resourceAssignmentType.getTSK().getTRD().trim())){
//              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRD().trim() ,"EKAS");
//            }
//            break;
//          case "GX":
//            if (!entStartupInitSingleton.getGXTaskReqtList().contains(resourceAssignmentType.getTSK().getTRD().trim())){
//              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRD().trim() ,"GX");
//            }
//            break;
//          case "CS":
//            if (!entStartupInitSingleton.getCSTaskReqtList().contains(resourceAssignmentType.getTSK().getTRD().trim())){
//              LOG.warn("not matching the master data, staffType {}, taskReqtId {}", resourceAssignmentType.getTSK().getTRD().trim() ,"CS");
//            }
//            break;
//              }
//          } 
//          edpiodEntDbFltJobTask.setTaskDeptId(resourceAssignmentType.getTSK().getTRD());
//        }
       
        // set DEP
        if (resourceAssignmentType.getTSK().getDEP() != null && !"".equals(resourceAssignmentType.getTSK().getDEP().trim())){
          if (entStartupInitSingleton.isMDDeptListOn()){
          // to check master data
          switch (edpiodEntDbFltJobTask.getStaffType()){
          case "ENGR":
            if (!entStartupInitSingleton.getENGRDeptList().contains(resourceAssignmentType.getTSK().getDEP().trim())){
              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getDEP().trim() ,"ENGR");
             
              sendErroNotification(EnumExceptionCodes.WNOMD);
             
            }
            break;
          }
          }
          edpiodEntDbFltJobTask.setTaskDeptId(resourceAssignmentType.getTSK().getDEP());
        }else {
          LOG.info("Mandatory field DEP is null or empty string, resourceAssignmentType message is rejected");
          return false;
        }
       
        // set TYP
        if (resourceAssignmentType.getTSK().getTYP() != null && !"".equals(resourceAssignmentType.getTSK().getTYP().trim())){
//          // to check master data
//          switch (edpiodEntDbFltJobTask.getStaffType()){
//          case "EK":
//            if (!entStartupInitSingleton.getEKASTaskTypesList().contains(resourceAssignmentType.getTSK().getTYP().trim())){
//              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getTYP().trim() ,"EKAS");
//            }
//            break;
//          case "GX":
//            if (!entStartupInitSingleton.getGXTaskTypesList().contains(resourceAssignmentType.getTSK().getTYP().trim())){
//              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getTYP().trim() ,"GX");
//            }
//            break;
//          case "CS":
//            if (!entStartupInitSingleton.getCSTaskTypesList().contains(resourceAssignmentType.getTSK().getTYP().trim())){
//              LOG.warn("not matching the master data, staffType {}, deptId {}", resourceAssignmentType.getTSK().getTYP().trim() ,"CS");
//            }
//            break;           
//          } 
          edpiodEntDbFltJobTask.setTaskType(resourceAssignmentType.getTSK().getTYP());
        }else {
          LOG.info("Mandatory field TYP is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set ORI
        if (resourceAssignmentType.getTSK().getORI() != null && !"".equals(resourceAssignmentType.getTSK().getORI().trim())){
          if (entStartupInitSingleton.isMDTaskGrptypeListOn()){
          // to check master data
          switch (edpiodEntDbFltJobTask.getStaffType()){
          case "ENGR":
            if (!entStartupInitSingleton.getENGRTaskGrptypeList().contains(resourceAssignmentType.getTSK().getORI().trim())){
              LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getORI().trim() ,"ENGR");
             
              sendErroNotification(EnumExceptionCodes.WNOMD);
            }
            break;
         
         
          }
         
          edpiodEntDbFltJobTask.setTaskGrpType(resourceAssignmentType.getTSK().getORI());
        }else {
          LOG.info("Mandatory field ORI is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set SNO
        if (resourceAssignmentType.getTSK().getSNO() != 0){
          edpiodEntDbFltJobTask.setTaskNum(new BigDecimal(resourceAssignmentType.getTSK().getSNO()));
        }else {
          LOG.info("Mandatory field SNO is 0, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set MNO
        if (resourceAssignmentType.getTSK().getMNO() != 0){
          edpiodEntDbFltJobTask.setMainTaskNum(new BigDecimal(resourceAssignmentType.getTSK().getMNO()));
        }else {
          LOG.info("Mandatory field MNO is 0, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set RMK
        if (resourceAssignmentType.getTSK().getRMK() != null && !"".equals(resourceAssignmentType.getTSK().getRMK().trim())){
          edpiodEntDbFltJobTask.setTaskRemark(resourceAssignmentType.getTSK().getRMK());
        }
       
        // set STI
        if (resourceAssignmentType.getTSK().getSTI() != null && !"".equals(resourceAssignmentType.getTSK().getSTI())){
          try {
            edpiodEntDbFltJobTask.setTaskActualStartDate(convertStringToDate(resourceAssignmentType.getTSK().getSTI()));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date STI, {}", e);
//          LOG.info("Mandatory field STI can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }
       
        // set ETI
        if (resourceAssignmentType.getTSK().getETI() != null && !"".equals(resourceAssignmentType.getTSK().getETI())){
          try {
            edpiodEntDbFltJobTask.setTaskActualEndDate(convertStringToDate(resourceAssignmentType.getTSK().getETI()));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date ETI, {}", e);
//          LOG.info("Mandatory field ETI can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }
       
        // set DUR
        if (resourceAssignmentType.getTSK().getDUR() != 0){
          edpiodEntDbFltJobTask.setTaskActualDuration(new BigDecimal(resourceAssignmentType.getTSK().getDUR()));
        }
       
        // set EST
        if (resourceAssignmentType.getTSK().getEST() != null && !"".equals(resourceAssignmentType.getTSK().getEST())){
          try {
            edpiodEntDbFltJobTask.setTaskPlanStartDate(convertStringToDate(resourceAssignmentType.getTSK().getEST()));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date EST, {}", e);
//          LOG.info("Mandatory field EST can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }else {
          LOG.info("Mandatory field EST is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set LET
        if (resourceAssignmentType.getTSK().getLET() != null && !"".equals(resourceAssignmentType.getTSK().getLET())){
          try {
            edpiodEntDbFltJobTask.setTaskPlanEndDate(convertStringToDate(resourceAssignmentType.getTSK().getLET()));
            // task_plan_duration = task_plan_end_date - task_plan_start_date
            int days = Days.daysBetween(new DateTime(edpiodEntDbFltJobTask.getTaskPlanStartDate()), new DateTime(edpiodEntDbFltJobTask.getTaskPlanEndDate())).getDays();
            int seconds = days * 24 * 60 * 60;
            edpiodEntDbFltJobTask.setTaskPlanDuration(new BigDecimal(seconds));
        } catch (ParseException e) {
          LOG.error("erro when parse String to Date LET, {}", e);
//          LOG.info("Mandatory field LET can not be parsed correctly, resourceAssignmentType message is rejected");
//            return false;
        }
        }else {
          LOG.info("Mandatory field LET is null, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set SLO
        if (resourceAssignmentType.getTSK().getSLO() != null && !"".equals(resourceAssignmentType.getTSK().getSLO().trim())){
          edpiodEntDbFltJobTask.setTaskStartLoc(resourceAssignmentType.getTSK().getSLO());
        }else {
          LOG.info("Mandatory field SLO is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set ELO
        if (resourceAssignmentType.getTSK().getELO() != null && !"".equals(resourceAssignmentType.getTSK().getELO().trim())){
          edpiodEntDbFltJobTask.setTaskEndLoc(resourceAssignmentType.getTSK().getELO());
        }else {
          LOG.info("Mandatory field ELO is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set ARK
        if (resourceAssignmentType.getTSK().getARK() != null && !"".equals(resourceAssignmentType.getTSK().getARK().trim())){
          edpiodEntDbFltJobTask.setTaskCannedMsg(resourceAssignmentType.getTSK().getARK());
        }
       
        // set HST
        if (resourceAssignmentType.getTSK().getHST() != null && !"".equals(resourceAssignmentType.getTSK().getHST().trim())){
          edpiodEntDbFltJobTask.setTaskHandlingState(resourceAssignmentType.getTSK().getHST());
        }else {
          LOG.info("Mandatory field HST is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
        // set MWA
        if (resourceAssignmentType.getTSK().getMWA() != null && !"".equals(resourceAssignmentType.getTSK().getMWA().trim())){
          if (entStartupInitSingleton.isMDWorkAreasListOn()){
          // to check with master data
            switch (edpiodEntDbFltJobTask.getStaffType()){
          case "ENGR":
            if (!entStartupInitSingleton.getENGRWorkAreasList().contains(resourceAssignmentType.getTSK().getMWA().trim())){
              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getMWA() ,"ENGR");
            }
            break;
            }
          }
          edpiodEntDbFltJobTask.setTaskWorkArea(resourceAssignmentType.getTSK().getMWA());
        }
//        else {
//          LOG.info("Mandatory field MWA is null or empty string, resourceAssignmentType message is rejected");
//          return false;
//        }
       
        // set SWA
        if (resourceAssignmentType.getTSK().getSWA() != null && !"".equals(resourceAssignmentType.getTSK().getSWA().trim())){
          edpiodEntDbFltJobTask.setTaskSubworkArea(resourceAssignmentType.getTSK().getSWA());
        }
       
        // set WLD
        if (resourceAssignmentType.getTSK().getWLD() != null && resourceAssignmentType.getTSK().getWLD() != 0){
          edpiodEntDbFltJobTask.setTaskWorkloadFactor(new BigDecimal(resourceAssignmentType.getTSK().getWLD()));
        }
    
        // set PRI
        if (resourceAssignmentType.getTSK().getPRI() != null && resourceAssignmentType.getTSK().getPRI() != 0){
          edpiodEntDbFltJobTask.setTaskPriority(new BigDecimal(resourceAssignmentType.getTSK().getPRI()));
        }
       
         // set NRO
        if (resourceAssignmentType.getTSK().getNRO() != null && !"".equals(resourceAssignmentType.getTSK().getNRO().trim())){
          edpiodEntDbFltJobTask.setTaskCategory(resourceAssignmentType.getTSK().getNRO());
        }
       
        // Attention ! make use of this info to search flight in AFTTAB (AFTTAB.ACT3 or ACT5)
//          AFT
//        if (resourceAssignmentType.getTSK().getAFT() != null && !"".equals(resourceAssignmentType.getTSK().getAFT().trim())){
//        }
        // set NRO
//        if (resourceAssignmentType.getTSK().getAFT() != null && !"".equals(resourceAssignmentType.getTSK().getAFT().trim())){
//          edpiodEntDbFltJobTask.setTaskCategory(resourceAssignmentType.getTSK().getAFT());
//        }
       
           // set STS
        if (resourceAssignmentType.getTSK().getSTS() != null && !"".equals(resourceAssignmentType.getTSK().getSTS().trim())){
//            // to check with master data
//            switch (edpiodEntDbFltJobTask.getStaffType()){
//          case "EK":
//            if (!entStartupInitSingleton.getEKASTaskStatusList().contains(resourceAssignmentType.getTSK().getSTS().trim())){
//              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getSTS().trim() ,"EKAS");
//            }
//            break;
//          case "GX":
//            if (!entStartupInitSingleton.getGXTaskStatusList().contains(resourceAssignmentType.getTSK().getSTS().trim())){
//              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getSTS().trim() ,"GX");
//            }
//            break;
//          case "CS":
//            if (!entStartupInitSingleton.getCSTaskStatusList().contains(resourceAssignmentType.getTSK().getSTS().trim())){
//              LOG.warn("not matching the master data, staffType {}, workArea {}", resourceAssignmentType.getTSK().getSTS().trim() ,"CS");
//            }
//            break;
//          } 
          edpiodEntDbFltJobTask.setTaskStatus(resourceAssignmentType.getTSK().getSTS());
        }else {
          LOG.info("Mandatory field STS is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
        }
       
//        // set STT
//        if (resourceAssignmentType.getTSK().getSTT() != null && !"".equals(resourceAssignmentType.getTSK().getSTT().trim())){
//          if (entStartupInitSingleton.isMDTaskGrptypeListOn()){
//        // to check with master data
//        switch (edpiodEntDbFltJobTask.getStaffType()){
//      case "EK":
//        if (!entStartupInitSingleton.getEKASTaskGrptypeList().contains(resourceAssignmentType.getTSK().getSTT().trim())){
//          LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getSTT().trim() ,"EKAS");
//        }
//        break;
//      case "GX":
//        if (!entStartupInitSingleton.getGXTaskGrptypeList().contains(resourceAssignmentType.getTSK().getSTT().trim())){
//          LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getSTT().trim() ,"GX");
//        }
//        break;
//      case "CS":
//        if (!entStartupInitSingleton.getCSTaskGrptypeList().contains(resourceAssignmentType.getTSK().getSTT().trim())){
//          LOG.warn("not matching the master data, staffType {}, taskGrptypeId {}", resourceAssignmentType.getTSK().getSTT().trim() ,"CS");
//        }
//        break;
//          } 
//        }
//          edpiodEntDbFltJobTask.setTaskStatus(resourceAssignmentType.getTSK().getSTT());
//        }else {
//          LOG.info("Mandatory field STT is null or empty string, resourceAssignmentType message is rejected");
//          return false;
//        }
       
        // Attention ! Use this info to form the full flight number (AFTTAB.FLNO)
        // set DNO
//        if (resourceAssignmentType.getTSK().getDNO() != null && !"".equals(resourceAssignmentType.getTSK().getDNO().trim())){
//          // TO CONTINUE>>>>>>
//        }
       
        // Make use of this info to search flight in AFTTAB Convert to UTC prior to search (AFTTAB.STOD)
        // set DFD
//        if (resourceAssignmentType.getTSK().getDFD() != null){
//          // TO CONTINUE>>>>>>
//        }
       
        // Make use of this info to search flight in AFTTAB (AFTTAB.ORG3)
        // set REG
//        if (resourceAssignmentType.getTSK().getREG() != null && !"".equals(resourceAssignmentType.getTSK().getREG().trim())){
//          // TO CONTINUE>>>>>>
//        }
       
        // Make use of this info to search flight in AFTTAB (AFTTAB.ORG3)
        // set RAG
        if (resourceAssignmentType.getTSK().getRAG() != null || !"".equals(resourceAssignmentType.getTSK().getRAG().trim())){
          edpiodEntDbFltJobTask.setTaskColorCode(resourceAssignmentType.getTSK().getRAG());
        }
       
        // set CRT
        if (resourceAssignmentType.getTSK().getCRT() != null || !"".equals(resourceAssignmentType.getTSK().getCRT().trim())){
          edpiodEntDbFltJobTask.setTaskCriticalFlag(resourceAssignmentType.getTSK().getCRT());
        }
       
       
           // check DSN
        if (resourceAssignmentType.getTSK().getDSN() == null || "".equals(resourceAssignmentType.getTSK().getDSN().trim())){
          if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
          LOG.info("Mandatory field DSN is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
          }
        }
       
        // Use this info to form the full flight number (AFTTAB.FLNO)
           // check ASN
        if (resourceAssignmentType.getTSK().getASN() == null || "".equals(resourceAssignmentType.getTSK().getASN().trim())){
          if (!"0".equalsIgnoreCase(resourceAssignmentType.getTSK().getORI())){
          LOG.info("Mandatory field ASN is null or empty string, resourceAssignmentType message is rejected");
         
          sendErroNotification(EnumExceptionCodes.EMAND);
         
          return false;
          }
        }
       
//           // check ANO
//        if (resourceAssignmentType.getTSK().getANO() == null || "".equals(resourceAssignmentType.getTSK().getANO().trim())){
//          LOG.info("Mandatory field ANO is null or empty string, resourceAssignmentType message is rejected");
//          return false;
//        }
       
        // set SID
        if (resourceAssignmentType.getTSK().getSID() != null && !"".equals(resourceAssignmentType.getTSK().getSID())){
          edpiodEntDbFltJobAssign.setShiftId( new BigDecimal(resourceAssignmentType.getTSK().getSID()));
        }
//        else {
//          LOG.info("Mandatory field SID is null or empty string, resourceAssignmentType message is rejected");
//          return false;
//        }
View Full Code Here

      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();
View Full Code Here

    protected EntityManager getEntityManager() {
        return em;
    }
   
    public EntDbFltJobAssign getExsitRecord(EntDbFltJobAssign entDbFltJobAssign){
      EntDbFltJobAssign existRecord = null;
     
      Query query = em.createNamedQuery("EntDbFltJobAssign.findRecord");
    query.setParameter("idFltJobTask", entDbFltJobAssign.getIdFltJobTask());
    query.setParameter("idStaffShift", entDbFltJobAssign.getIdStaffShift());
   
View Full Code Here

     
      return existRecord;
    }
   
    public EntDbFltJobAssign getExsitRecord(BigDecimal idFltJobTask, BigDecimal idStaffShift){
      EntDbFltJobAssign existRecord = null;
     
      Query query = em.createNamedQuery("EntDbFltJobAssign.findRecord");
    query.setParameter("idFltJobTask", idFltJobTask);
    query.setParameter("idStaffShift", idStaffShift);
   
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.