public static ErrorDetails validatePropertyTransferRequest(PropertyTransferDetails propertyTransferDetails){
  ErrorDetails errorDetails=null;
  String assessmentNumber=propertyTransferDetails.getAssessmentNo();
  if (StringUtils.isBlank(assessmentNumber)) {
    errorDetails=new ErrorDetails();
    errorDetails.setErrorCode(ASSESSMENT_NO_REQ_CODE);
    errorDetails.setErrorMessage(ASSESSMENT_NO_REQ_MSG);
    return errorDetails;
  }
  String mutationReasonCode=propertyTransferDetails.getMutationReasonCode();
  if (StringUtils.isBlank(mutationReasonCode)) {
    errorDetails=new ErrorDetails();
    errorDetails.setErrorCode(MUTATION_REASON_CODE_REQ_CODE);
    errorDetails.setErrorMessage(MUTATION_REASON_CODE_REQ_MSG);
    return errorDetails;
  }
  if (StringUtils.isNotBlank(mutationReasonCode) && !mutationReasonCode.equalsIgnoreCase(PropertyTaxConstants.MUTATION_REASON_CODE_GIFT) && !mutationReasonCode.equalsIgnoreCase(PropertyTaxConstants.MUTATION_REASON_CODE_WILL)&& !mutationReasonCode.equalsIgnoreCase(PropertyTaxConstants.MUTATION_REASON_CODE_SALE)&& !mutationReasonCode.equalsIgnoreCase(PropertyTaxConstants.MUTATION_REASON_CODE_RELINQUISH)&& !mutationReasonCode.equalsIgnoreCase(PropertyTaxConstants.MUTATION_REASON_CODE_PARTITION)) {
    errorDetails=new ErrorDetails();
    errorDetails.setErrorCode(MUTATION_REASON_INVALID_CODE_REQ_CODE);
    errorDetails.setErrorMessage(MUTATION_REASON_INVALID_CODE_REQ_MSG);
    return errorDetails;
  }
  if (mutationReasonCode.equalsIgnoreCase(PropertyTaxConstants.MUTATION_REASON_CODE_SALE)) {
    if (StringUtils.isBlank(propertyTransferDetails.getSaleDetails())) {
      errorDetails=new ErrorDetails();
      errorDetails.setErrorCode(SALE_DETAILS_REQ_CODE);
      errorDetails.setErrorMessage(SALE_DETAILS_REQ_MSG);
      return errorDetails;
    }
  }
  if (!mutationReasonCode.equalsIgnoreCase(PropertyTaxConstants.MUTATION_REASON_CODE_SALE)) {
    if (StringUtils.isNotBlank(propertyTransferDetails.getSaleDetails())) {
      errorDetails=new ErrorDetails();
      errorDetails.setErrorCode(OTHER_MUTATION_CODES_SALE_DETAILS_VALIDATION_CODE);
      errorDetails.setErrorMessage(OTHER_MUTATION_CODES_SALE_DETAILS_VALIDATION_MSG);
      return errorDetails;
    }
  }
  String deedNo=propertyTransferDetails.getDeedNo();
  if (StringUtils.isBlank(deedNo)) {
    errorDetails=new ErrorDetails();
    errorDetails.setErrorCode(DEED_NO_REQ_CODE);
    errorDetails.setErrorMessage(DEED_NO_REQ_MSG);
    return errorDetails;
  }
  String deedDate=propertyTransferDetails.getDeedDate();
  if (StringUtils.isBlank(deedDate)) {
    errorDetails=new ErrorDetails();
    errorDetails.setErrorCode(DEED_DATE_REQ_CODE);
    errorDetails.setErrorMessage(DEED_DATE_REQ_MSG);
    return errorDetails;
  }
  List<OwnerInformation> ownerDetailsList=propertyTransferDetails.getOwnerDetails();
  if (ownerDetailsList.isEmpty()) {
    errorDetails=new ErrorDetails();
    errorDetails.setErrorCode(OWNER_DETAILS_REQ_CODE);
    errorDetails.setErrorMessage(OWNER_DETAILS_REQ_MSG);
    return errorDetails;
  }
 else   for (  final OwnerInformation ownerInfo : ownerDetailsList) {
    if (ownerInfo.getMobileNumber() == null) {
      errorDetails=new ErrorDetails();
      errorDetails.setErrorCode(MOBILE_NO_REQ_CODE);
      errorDetails.setErrorMessage(MOBILE_NO_REQ_MSG);
      return errorDetails;
    }
    if (ownerInfo.getName() == null) {
      errorDetails=new ErrorDetails();
      errorDetails.setErrorCode(OWNER_NAME_REQ_CODE);
      errorDetails.setErrorMessage(OWNER_NAME_REQ_MSG);
      return errorDetails;
    }
    if (ownerInfo.getGender() == null) {
      errorDetails=new ErrorDetails();
      errorDetails.setErrorCode(GENDER_REQ_CODE);
      errorDetails.setErrorMessage(GENDER_REQ_MSG);
      return errorDetails;
    }
    if (ownerInfo.getGuardianRelation() == null) {
      errorDetails=new ErrorDetails();
      errorDetails.setErrorCode(GUARDIAN_RELATION_REQ_CODE);
      errorDetails.setErrorMessage(GUARDIAN_RELATION_REQ_MSG);
      return errorDetails;
    }
    if (ownerInfo.getGuardian() == null) {
      errorDetails=new ErrorDetails();
      errorDetails.setErrorCode(GUARDIAN_REQ_CODE);
      errorDetails.setErrorMessage(GUARDIAN_REQ_MSG);
      return errorDetails;
    }
  }
  return errorDetails;
}

public static ErrorDetails validatePropertyTransferRequest ( PropertyTransferDetails propertyTransferDetails ) { ErrorDetails errorDetails = null ; String assessmentNumber = propertyTransferDetails . getAssessmentNo ( ) ; if ( StringUtils . isBlank ( assessmentNumber ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( ASSESSMENT_NO_REQ_CODE ) ; errorDetails . setErrorMessage ( ASSESSMENT_NO_REQ_MSG ) ; return errorDetails ; } String mutationReasonCode = propertyTransferDetails . getMutationReasonCode ( ) ; if ( StringUtils . isBlank ( mutationReasonCode ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( MUTATION_REASON_CODE_REQ_CODE ) ; errorDetails . setErrorMessage ( MUTATION_REASON_CODE_REQ_MSG ) ; return errorDetails ; } if ( StringUtils . isNotBlank ( mutationReasonCode ) && ! mutationReasonCode . equalsIgnoreCase ( PropertyTaxConstants . MUTATION_REASON_CODE_GIFT ) && ! mutationReasonCode . equalsIgnoreCase ( PropertyTaxConstants . MUTATION_REASON_CODE_WILL ) && ! mutationReasonCode . equalsIgnoreCase ( PropertyTaxConstants . MUTATION_REASON_CODE_SALE ) && ! mutationReasonCode . equalsIgnoreCase ( PropertyTaxConstants . MUTATION_REASON_CODE_RELINQUISH ) && ! mutationReasonCode . equalsIgnoreCase ( PropertyTaxConstants . MUTATION_REASON_CODE_PARTITION ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( MUTATION_REASON_INVALID_CODE_REQ_CODE ) ; errorDetails . setErrorMessage ( MUTATION_REASON_INVALID_CODE_REQ_MSG ) ; return errorDetails ; } if ( mutationReasonCode . equalsIgnoreCase ( PropertyTaxConstants . MUTATION_REASON_CODE_SALE ) ) { if ( StringUtils . isBlank ( propertyTransferDetails . getSaleDetails ( ) ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( SALE_DETAILS_REQ_CODE ) ; errorDetails . setErrorMessage ( SALE_DETAILS_REQ_MSG ) ; return errorDetails ; } } if ( ! mutationReasonCode . equalsIgnoreCase ( PropertyTaxConstants . MUTATION_REASON_CODE_SALE ) ) { if ( StringUtils . isNotBlank ( propertyTransferDetails . getSaleDetails ( ) ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( OTHER_MUTATION_CODES_SALE_DETAILS_VALIDATION_CODE ) ; errorDetails . setErrorMessage ( OTHER_MUTATION_CODES_SALE_DETAILS_VALIDATION_MSG ) ; return errorDetails ; } } String deedNo = propertyTransferDetails . getDeedNo ( ) ; if ( StringUtils . isBlank ( deedNo ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( DEED_NO_REQ_CODE ) ; errorDetails . setErrorMessage ( DEED_NO_REQ_MSG ) ; return errorDetails ; } String deedDate = propertyTransferDetails . getDeedDate ( ) ; if ( StringUtils . isBlank ( deedDate ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( DEED_DATE_REQ_CODE ) ; errorDetails . setErrorMessage ( DEED_DATE_REQ_MSG ) ; return errorDetails ; } List < OwnerInformation > ownerDetailsList = propertyTransferDetails . getOwnerDetails ( ) ; if ( ownerDetailsList . isEmpty ( ) ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( OWNER_DETAILS_REQ_CODE ) ; errorDetails . setErrorMessage ( OWNER_DETAILS_REQ_MSG ) ; return errorDetails ; } else for ( final OwnerInformation ownerInfo : ownerDetailsList ) { if ( ownerInfo . getMobileNumber ( ) == null ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( MOBILE_NO_REQ_CODE ) ; errorDetails . setErrorMessage ( MOBILE_NO_REQ_MSG ) ; return errorDetails ; } if ( ownerInfo . getName ( ) == null ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( OWNER_NAME_REQ_CODE ) ; errorDetails . setErrorMessage ( OWNER_NAME_REQ_MSG ) ; return errorDetails ; } if ( ownerInfo . getGender ( ) == null ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( GENDER_REQ_CODE ) ; errorDetails . setErrorMessage ( GENDER_REQ_MSG ) ; return errorDetails ; } if ( ownerInfo . getGuardianRelation ( ) == null ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( GUARDIAN_RELATION_REQ_CODE ) ; errorDetails . setErrorMessage ( GUARDIAN_RELATION_REQ_MSG ) ; return errorDetails ; } if ( ownerInfo . getGuardian ( ) == null ) { errorDetails = new ErrorDetails ( ) ; errorDetails . setErrorCode ( GUARDIAN_REQ_CODE ) ; errorDetails . setErrorMessage ( GUARDIAN_REQ_MSG ) ; return errorDetails ; } } return errorDetails ; }
validates property transfer request
