...
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); } } |
Strategy Util class will be called in ObjectNameServiceImpl class
Code Block |
---|
package org.openmrs.module.fhir.api.impl;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.hl7.fhir.dstu3.model.ObjectName;
import org.openmrs.api.impl.BaseOpenmrsService;
import org.openmrs.module.fhir.api.ObjectNameService;
import org.openmrs.module.fhir.api.db.FHIRDAO;
import org.openmrs.module.fhir.api.strategies.objectname.ObjectNameStrategyUtil;
public class ObjectNameServiceImpl extends BaseOpenmrsService implements ObjectNameService {
protected final Log log = LogFactory.getLog(this.getClass());
private FHIRDAO dao;
/**
* @return the dao
*/
public FHIRDAO getDao() {
return dao;
}
/**
* @param dao the dao to set
*/
public void setDao(FHIRDAO dao) {
this.dao = dao;
}
@Override
public ObjectName getObjectName(String uuid) {
return ObjectNameStrageryUtil.getObjectNameStrategy().getObjectName(uuid);
}
@Override
public void deleteObjectName(String uuid) {
ObjectNameStrageryUtil.getObjectNameStrategy().deleteObjectName(uuid);
}
@Override
public ObjectName updateObjectName(String uuid, ObjectName objectName) {
return ObjectNameStrategyUtil.getObjectName().updateObjectName(uuid, objectName);
}
@Override
public ObjectName createObjectName(ObjectName objectName) {
return ObjectNameStrategyUtil.getObjectNameStrategy().createObjectName(ObjectName);
}
}
|