Examples: App Sphere
This page contains example interceptors that can be registered with Cluster Manager to handle App Sphere specific pointcuts.
The following example shows an interceptor that can be used as a starter App Sphere interceptor, implementing a hook method for each available pointcut.
/*-
* #%L
* Smile CDR - CDR
* %%
* Copyright (C) 2016 - 2025 Smile CDR, Inc.
* %%
* All rights reserved.
* #L%
*/
package com.smilecdr.demo.appgallery;
import ca.cdr.api.fhir.interceptor.CdrHook;
import ca.cdr.api.fhir.interceptor.CdrPointcut;
import ca.cdr.api.model.json.appgallery.common.AGApplicationJson;
import ca.cdr.api.model.json.appgallery.console.AGConsoleJson;
import ca.uhn.fhir.interceptor.api.Interceptor;
import ca.uhn.fhir.util.StopWatch;
import jakarta.annotation.Nonnull;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@SuppressWarnings({"unused"})
@Interceptor
public class AGInterceptorTemplate {
private static final Logger ourLog = LoggerFactory.getLogger(AGInterceptorTemplate.class);
@CdrHook(CdrPointcut.AG_APPLICATION_STATUS_UPDATING)
public void statusUpdating(@Nonnull AGConsoleJson theAGConsoleJson) {
ourLog.info("Interceptor AG_APPLICATION_STATUS_UPDATING - started");
StopWatch stopWatch = new StopWatch();
try {
// your implementation goes here
} finally {
ourLog.info("Interceptor AG_APPLICATION_STATUS_UPDATING - ended, execution took {}", stopWatch);
}
}
@CdrHook(CdrPointcut.AG_APPLICATION_STATUS_UPDATED)
public void statusUpdated(@Nonnull AGConsoleJson theAGConsoleJson) {
ourLog.info("Interceptor AG_APPLICATION_STATUS_UPDATED - started");
StopWatch stopWatch = new StopWatch();
try {
// your implementation goes here
} finally {
ourLog.info("Interceptor AG_APPLICATION_STATUS_UPDATED - ended, execution took {}", stopWatch);
}
}
@CdrHook(CdrPointcut.AG_APPLICATION_REGISTER)
public void applicationRegister(@Nonnull AGApplicationJson theAGApplicationJson) {
ourLog.info("Interceptor AG_APPLICATION_REGISTER - started");
StopWatch stopWatch = new StopWatch();
try {
// your implementation goes here
} finally {
ourLog.info("Interceptor AG_APPLICATION_REGISTER - ended, execution took {}", stopWatch);
}
}
@CdrHook(CdrPointcut.AG_APPLICATION_RE_REGISTER)
public void applicationReRegister(@Nonnull AGApplicationJson theAGApplicationJson) {
ourLog.info("Interceptor AG_APPLICATION_RE_REGISTER - started");
StopWatch stopWatch = new StopWatch();
try {
// your implementation goes here
} finally {
ourLog.info("Interceptor AG_APPLICATION_RE_REGISTER - ended, execution took {}", stopWatch);
}
}
}
You are about to leave the Smile Digital Health documentation and navigate to the Open Source HAPI-FHIR Documentation.