Skip to content

Commit

Permalink
issue #3495 - patient_id claim is only required for patient scopes
Browse files Browse the repository at this point in the history
Also addressed review comments by adding class-level javadoc

Signed-off-by: Lee Surprenant <lmsurpre@us.ibm.com>
  • Loading branch information
lmsurpre committed Mar 23, 2022
1 parent eb6c324 commit 5ddfc13
Show file tree
Hide file tree
Showing 4 changed files with 282 additions and 119 deletions.
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
/*
* (C) Copyright IBM Corp. 2016, 2021
* (C) Copyright IBM Corp. 2016, 2022
*
* SPDX-License-Identifier: Apache-2.0
*/
Expand All @@ -10,10 +10,8 @@
import java.util.List;
import java.util.ServiceLoader;
import java.util.concurrent.CopyOnWriteArrayList;
import java.util.logging.Level;
import java.util.logging.Logger;

import com.ibm.fhir.core.FHIRUtilities;
import com.ibm.fhir.persistence.context.FHIRPersistenceEvent;
import com.ibm.fhir.server.spi.interceptor.FHIRPersistenceInterceptor;
import com.ibm.fhir.server.spi.interceptor.FHIRPersistenceInterceptorException;
Expand All @@ -23,7 +21,7 @@
* This class implements the FHIR persistence interceptor framework. This framework allows users to inject business
* logic into the REST API request processing code path at various points.
*
* Interceptors are discovered using the jdk's ServiceProvider class.
* Interceptors are discovered using the jdk's ServiceLoader class.
*
* To register an interceptor implementation, develop a class that implements the FHIRPersistenceInterceptor interface,
* and then insert your implementation class name into a file called
Expand All @@ -46,18 +44,11 @@ private FHIRPersistenceInterceptorMgr() {
// Discover all implementations of our interceptor interface, then add them to our list of interceptors.
ServiceLoader<FHIRPersistenceInterceptor> slList = ServiceLoader.load(FHIRPersistenceInterceptor.class);
Iterator<FHIRPersistenceInterceptor> iter = slList.iterator();
if (iter.hasNext()) {
log.fine("Discovered the following persistence interceptors:");
while (iter.hasNext()) {
FHIRPersistenceInterceptor interceptor = iter.next();
if (log.isLoggable(Level.FINE)) {
log.fine(">>> " + interceptor.getClass().getName() + '@' + FHIRUtilities.getObjectHandle(interceptor));
}
interceptors.add(interceptor);
}
} else {
log.fine("No persistence interceptors found...");
while (iter.hasNext()) {
FHIRPersistenceInterceptor interceptor = iter.next();
interceptors.add(interceptor);
}
log.info("Loaded the following persistence interceptors: " + interceptors);
}

/**
Expand All @@ -66,9 +57,7 @@ private FHIRPersistenceInterceptorMgr() {
* @param interceptor persistence interceptor to be registered
*/
public void addInterceptor(FHIRPersistenceInterceptor interceptor) {
if (log.isLoggable(Level.FINE)) {
log.fine("Registering persistence interceptor: " + interceptor.getClass().getName() + '@' + FHIRUtilities.getObjectHandle(interceptor));
}
log.info("Registering persistence interceptor: " + interceptor);
interceptors.add(interceptor);
}

Expand All @@ -78,9 +67,7 @@ public void addInterceptor(FHIRPersistenceInterceptor interceptor) {
* @param interceptor persistence interceptor to be registered
*/
public void addPrioritizedInterceptor(FHIRPersistenceInterceptor interceptor) {
if (log.isLoggable(Level.FINE)) {
log.fine("Registering persistence interceptor: " + interceptor.getClass().getName() + '@' + FHIRUtilities.getObjectHandle(interceptor));
}
log.info("Registering prioritized persistence interceptor: " + interceptor);
interceptors.add(0, interceptor);
}

Expand Down
Loading

0 comments on commit 5ddfc13

Please sign in to comment.