Source:
private void markChildComponentAsUnsafeWhereApplicable(Component component) { Component initialComponent = component.getParentComponent(); Donation donation = initialComponent.getDonation(); while (initialComponent.getParentComponent() != null) { initialComponent = initialComponent.getParentComponent(); } if (initialComponent.getStatusChanges() != null) { for (ComponentStatusChange statusChange : initialComponent.getStatusChanges()) { if (statusChange.getIsDeleted()) { continue; } if (!component.getComponentType().getContainsPlasma() && statusChange.getStatusChangeReason().getCategory() == ComponentStatusChangeReasonCategory.UNSAFE && statusChange.getStatusChangeReason().getType() == ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA) { continue; } if (statusChange.getStatusChangeReason().getCategory() == ComponentStatusChangeReasonCategory.UNSAFE) { markComponentAsUnsafe(component, ComponentStatusChangeReasonType.UNSAFE_PARENT); return; } } } long bleedTime = bleedTimeService.getBleedTime(donation.getBleedStartTime(), donation.getBleedEndTime()); long timeSinceDonation = bleedTimeService.getTimeSinceDonation(donation.getDonationDate(), initialComponent.getProcessedOn()); if (component.getComponentType().getMaxBleedTime() != null && bleedTime > component.getComponentType().getMaxBleedTime()) { markComponentAsUnsafe(component, ComponentStatusChangeReasonType.EXCEEDS_MAX_BLEED_TIME); } else if (component.getComponentType().getMaxBleedTime() != null && timeSinceDonation > component.getComponentType().getMaxTimeSinceDonation()) { markComponentAsUnsafe(component, ComponentStatusChangeReasonType.EXCEEDS_MAXTIME_SINCE_DONATION); } }

Target:
private void markChildComponentAsUnsafeWhereApplicable(Component component) { Component initialComponent = component.getParentComponent(); Donation donation = initialComponent.getDonation(); while (!initialComponent.isInitialComponent()) { initialComponent = initialComponent.getParentComponent(); } if (initialComponent.getStatusChanges() != null) { for (ComponentStatusChange statusChange : initialComponent.getStatusChanges()) { if (statusChange.getIsDeleted()) { continue; } if (!component.getComponentType().getContainsPlasma() && statusChange.getStatusChangeReason().getCategory() == ComponentStatusChangeReasonCategory.UNSAFE && statusChange.getStatusChangeReason().getType() == ComponentStatusChangeReasonType.TEST_RESULTS_CONTAINS_PLASMA) { continue; } if (statusChange.getStatusChangeReason().getCategory() == ComponentStatusChangeReasonCategory.UNSAFE) { markComponentAsUnsafe(component, ComponentStatusChangeReasonType.UNSAFE_PARENT); return; } } } long bleedTime = bleedTimeService.getBleedTime(donation.getBleedStartTime(), donation.getBleedEndTime()); long timeSinceDonation = bleedTimeService.getTimeSinceDonation( initialComponent.getCreatedOn(), initialComponent.getProcessedOn()); if (component.getComponentType().getMaxBleedTime() != null && bleedTime >= component.getComponentType().getMaxBleedTime()) { markComponentAsUnsafe(component, ComponentStatusChangeReasonType.EXCEEDS_MAX_BLEED_TIME); } else if (component.getComponentType().getMaxTimeSinceDonation() != null && timeSinceDonation >= component.getComponentType().getMaxTimeSinceDonation()) { markComponentAsUnsafe(component, ComponentStatusChangeReasonType.EXCEEDS_MAXTIME_SINCE_DONATION); } }