Stream: implementers
Topic: Where to place creation of the Search Param object functi...
Markku Nikkanen (Jul 20 2020 at 08:58):
Hello,
I have created a Search Param object for searching Resources based on extension value.
client.create().resource(createExtensionSearchParam()).execute();
private static SearchParameter createExtensionSearchParam() {
SearchParameter state = new SearchParameter();
...
return state;
}
What would be correct way to run this object to database? I am using fork from the hapi-fhir-jpaserver-starter project. Should I create servlet that creates Search Param resources?
~/repos/my-fhir-service/src/main/webapp/WEB-INF/web.xml
<servlet>
<servlet-name>fhirServlet</servlet-name>
<servlet-class>ca.uhn.fhir.jpa.starter.JpaRestfulServer</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
<servlet>
<servlet-name>myMigration</servlet-name>
<servlet-class>my.project.MyMigration</servlet-class>
<load-on-startup>1</load-on-startup>
</servlet>
Or is there any events (Pointcut?) that are called when JpaRestfulServer initialisation is ready?
public class JpaRestfulServer extends RestfulServer {
@Override
protected void initialize() throws ServletException {
super.initialize();
}
// How to trigger this?
public void initializeReady() {
// create search params
}
}
https://smilecdr.com/hapi-fhir/apidocs/hapi-fhir-base/ca/uhn/fhir/interceptor/api/Pointcut.html
Or would it be better to have a separate project that run all sort of migrations to database like ads Search Params? Perhaps there is already something ready made frameworks for this e.g.
https://hapifhir.io/hapi-fhir/docs/server_jpa/upgrading.html
Michele Mottini (Jul 20 2020 at 11:22):
Maybe better to ask in #hapi
Last updated: Apr 12 2022 at 19:14 UTC