...
Code Block |
---|
package org.openmrs.module.fhir.api.strategies.relatedpersonobjectname; import org.hl7.fhir.dstu3.model.Objectname; public interface GenericObjectnameStrategy { Objectname getObjectname(String uuid); void deleteObjectname(String uuid); Objectname updateObjectname(String uuid, Objectname objectname); Objectname createObjectname(Objectname objectname); } |
...
After that, the interface needs to be implemented by ObjectnameStrategy class that would contain concrete implementatons of method stubs.
A Strategy Util class, like ObjectNameStrategyUtil should be created next toretrieve the implemnted strategy in the following way
Code Block |
---|
package org.openmrs.module.fhir.api.strategies.objectname; import org.openmrs.api.context.Context; import org.openmrs.module.fhir.api.util.FHIRUtils; public class ObjectNameStrategyUtil { public static GenericObjectNameStrategy getObjectNameStrategy() { String strategy = FHIRUtils.getObjectNameStrategy(); return strategy == null ? new ObjectNameStrategy() : Context.getRegisteredComponent(strategy, GenericObjectNameStrategy.class); } } |