From 668af7651487cb28d37dc3e5a5b4a9d06d784b95 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Thu, 29 Aug 2019 22:03:58 -0400 Subject: [PATCH] Make method static again --- .../java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java | 15 +++++---------- 1 file changed, 5 insertions(+), 10 deletions(-) diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java index a4183486244..e9575c3b80d 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/BaseHapiFhirDao.java @@ -75,7 +75,6 @@ import org.springframework.transaction.PlatformTransactionManager; import org.springframework.transaction.support.TransactionSynchronizationAdapter; import org.springframework.transaction.support.TransactionSynchronizationManager; -import javax.annotation.PostConstruct; import javax.persistence.*; import javax.persistence.criteria.CriteriaBuilder; import javax.persistence.criteria.CriteriaQuery; @@ -170,7 +169,6 @@ public abstract class BaseHapiFhirDao implements IDao, private SearchBuilderFactory mySearchBuilderFactory; private FhirContext myContext; private ApplicationContext myApplicationContext; - private Class> myStringType; @Override public void setApplicationContext(ApplicationContext theApplicationContext) throws BeansException { @@ -1452,19 +1450,16 @@ public abstract class BaseHapiFhirDao implements IDao, return mySearchParamRegistry; } - @PostConstruct - @SuppressWarnings({"ResultOfMethodCallIgnored", "unchecked"}) - public void startSetStringType() { - myStringType = (Class>) myContext.getElementDefinition("string").getImplementingClass(); - } + @SuppressWarnings("unchecked") + public static String parseContentTextIntoWords(FhirContext theContext, IBaseResource theResource) { - private String parseContentTextIntoWords(FhirContext theContext, IBaseResource theResource) { + Class> stringType = (Class>) theContext.getElementDefinition("string").getImplementingClass(); StringBuilder retVal = new StringBuilder(); - List> childElements = theContext.newTerser().getAllPopulatedChildElementsOfType(theResource, myStringType); + List> childElements = theContext.newTerser().getAllPopulatedChildElementsOfType(theResource, stringType); for (@SuppressWarnings("rawtypes") IPrimitiveType nextType : childElements) { - if (myStringType.equals(nextType.getClass())) { + if (stringType.equals(nextType.getClass())) { String nextValue = nextType.getValueAsString(); if (isNotBlank(nextValue)) { retVal.append(nextValue.replace("\n", " ").replace("\r", " "));