public static String getInstance ( Date startDate , Granularity startGran , Date endDate , Granularity endGran ) { ActiveStatusCodeStartDate codeStartDate ; if ( startDate == null ) { codeStartDate = ActiveStatusCodeStartDate . UNKNOWN ; } else if ( startGran == AbsoluteTimeGranularity . YEAR ) { codeStartDate = ActiveStatusCodeStartDate . YEAR ; } else if ( startGran == AbsoluteTimeGranularity . MONTH ) { codeStartDate = ActiveStatusCodeStartDate . MONTH ; } else if ( startGran == AbsoluteTimeGranularity . DAY ) { codeStartDate = ActiveStatusCodeStartDate . DAY ; } else if ( startGran == AbsoluteTimeGranularity . HOUR ) { codeStartDate = ActiveStatusCodeStartDate . HOUR ; } else if ( startGran == AbsoluteTimeGranularity . MINUTE ) { codeStartDate = ActiveStatusCodeStartDate . MINUTE ; } else if ( startGran == AbsoluteTimeGranularity . SECOND ) { codeStartDate = ActiveStatusCodeStartDate . SECOND ; } else { codeStartDate = ActiveStatusCodeStartDate . NULL ; } ActiveStatusCodeEndDate codeEndDate ; if ( startDate == null ) { codeEndDate = ActiveStatusCodeEndDate . UNKNOWN ; } else if ( startGran == AbsoluteTimeGranularity . YEAR ) { codeEndDate = ActiveStatusCodeEndDate . YEAR ; } else if ( startGran == AbsoluteTimeGranularity . MONTH ) { codeEndDate = ActiveStatusCodeEndDate . MONTH ; } else if ( startGran == AbsoluteTimeGranularity . DAY ) { codeEndDate = ActiveStatusCodeEndDate . DAY ; } else if ( startGran == AbsoluteTimeGranularity . HOUR ) { codeEndDate = ActiveStatusCodeEndDate . HOUR ; } else if ( startGran == AbsoluteTimeGranularity . MINUTE ) { codeEndDate = ActiveStatusCodeEndDate . MINUTE ; } else if ( startGran == AbsoluteTimeGranularity . SECOND ) { codeEndDate = ActiveStatusCodeEndDate . SECOND ; } else { codeEndDate = ActiveStatusCodeEndDate . NULL ; } return codeEndDate . getCode ( ) + codeStartDate . getCode ( ) ; }
Infer the correct active status code given what dates are available and whether or not the encounter information is finalized .