private void validateResource ( Patient thePatient ) { /* * Our server will have a rule that patients must have a family name or we will reject them */ if ( thePatient . getNameFirstRep ( ) . getFamilyFirstRep ( ) . isEmpty ( ) ) { OperationOutcome outcome = new OperationOutcome ( ) ; outcome . addIssue ( ) . setSeverity ( IssueSeverityEnum . FATAL ) . setDetails ( "No family name provided, Patient resources must have at least one family name." ) ; throw new UnprocessableEntityException ( outcome ) ; } }
This method just provides simple business validation for resources we are storing .