From 751face0a64fc219ad4af29d39c7329d22cb0a85 Mon Sep 17 00:00:00 2001 From: James Agnew Date: Tue, 30 Sep 2014 13:16:09 -0400 Subject: [PATCH] Argh. Fix to 0.7-SNAPSHOT, not 0.6-SNAPSHOT --- hapi-fhir-base/examples/pom.xml | 4 +- hapi-fhir-base/pom.xml | 2 +- .../java/ca/uhn/fhir/util/ObjectUtil.java | 15 ++++++ hapi-fhir-base/testmindeps/pom.xml | 4 +- hapi-fhir-jpaserver-base/pom.xml | 4 +- .../ca/uhn/fhir/jpa/dao/FhirResourceDao.java | 52 ++++++++++++------- hapi-fhir-jpaserver-test/pom.xml | 6 +-- hapi-fhir-jpaserver-uhnfhirtest/pom.xml | 10 ++-- hapi-fhir-oauth2/pom.xml | 4 +- hapi-fhir-structures-dstu/pom.xml | 6 +-- hapi-fhir-testpage-overlay/pom.xml | 6 +-- hapi-tinder-plugin/pom.xml | 4 +- hapi-tinder-test/pom.xml | 6 +-- pom.xml | 2 +- restful-server-example-test/pom.xml | 4 +- restful-server-example/pom.xml | 4 +- 16 files changed, 80 insertions(+), 53 deletions(-) create mode 100644 hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ObjectUtil.java diff --git a/hapi-fhir-base/examples/pom.xml b/hapi-fhir-base/examples/pom.xml index 1a2e015b06d..9e1e4f4348c 100644 --- a/hapi-fhir-base/examples/pom.xml +++ b/hapi-fhir-base/examples/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../../pom.xml @@ -17,7 +17,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT javax.servlet diff --git a/hapi-fhir-base/pom.xml b/hapi-fhir-base/pom.xml index c67d3653c3d..20bc7b9d663 100644 --- a/hapi-fhir-base/pom.xml +++ b/hapi-fhir-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml diff --git a/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ObjectUtil.java b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ObjectUtil.java new file mode 100644 index 00000000000..1292bf11292 --- /dev/null +++ b/hapi-fhir-base/src/main/java/ca/uhn/fhir/util/ObjectUtil.java @@ -0,0 +1,15 @@ +package ca.uhn.fhir.util; + +public class ObjectUtil { + + public static boolean equals(Object object1, Object object2) { + if (object1 == object2) { + return true; + } + if ((object1 == null) || (object2 == null)) { + return false; + } + return object1.equals(object2); + } + +} diff --git a/hapi-fhir-base/testmindeps/pom.xml b/hapi-fhir-base/testmindeps/pom.xml index 9cb316e2cae..84aa1061ef6 100644 --- a/hapi-fhir-base/testmindeps/pom.xml +++ b/hapi-fhir-base/testmindeps/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../../pom.xml @@ -40,7 +40,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT diff --git a/hapi-fhir-jpaserver-base/pom.xml b/hapi-fhir-jpaserver-base/pom.xml index 052179eb79c..e7482edb462 100644 --- a/hapi-fhir-jpaserver-base/pom.xml +++ b/hapi-fhir-jpaserver-base/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -44,7 +44,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT commons-logging diff --git a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java index dcf68d0cc99..56c0253caa7 100644 --- a/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java +++ b/hapi-fhir-jpaserver-base/src/main/java/ca/uhn/fhir/jpa/dao/FhirResourceDao.java @@ -92,6 +92,7 @@ import ca.uhn.fhir.rest.server.exceptions.ResourceGoneException; import ca.uhn.fhir.rest.server.exceptions.ResourceNotFoundException; import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException; import ca.uhn.fhir.util.FhirTerser; +import ca.uhn.fhir.util.ObjectUtil; @Transactional(propagation = Propagation.REQUIRED) public class FhirResourceDao extends BaseFhirDao implements IFhirResourceDao { @@ -117,7 +118,7 @@ public class FhirResourceDao extends BaseFhirDao implements } for (BaseTag next : new ArrayList(entity.getTags())) { - if (next.getTag().getScheme().equals(theScheme) && next.getTag().getTerm().equals(theTerm)) { + if (ObjectUtil.equals(next.getTag().getScheme(), theScheme) && ObjectUtil.equals(next.getTag().getTerm(), theTerm)) { return; } } @@ -141,7 +142,8 @@ public class FhirResourceDao extends BaseFhirDao implements if (theResource.getId().isEmpty() == false) { if (isValidPid(theResource.getId())) { - throw new UnprocessableEntityException("This server cannot create an entity with a user-specified numeric ID - Client should not specify an ID when creating a new resource, or should include at least one letter in the ID to force a client-defined ID"); + throw new UnprocessableEntityException( + "This server cannot create an entity with a user-specified numeric ID - Client should not specify an ID when creating a new resource, or should include at least one letter in the ID to force a client-defined ID"); } createForcedIdIfNeeded(entity, theResource.getId()); @@ -229,7 +231,8 @@ public class FhirResourceDao extends BaseFhirDao implements final T current = currentTmp; - String querySring = "SELECT count(h) FROM ResourceHistoryTable h " + "WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE" + " AND h.myUpdated < :END" + (theSince != null ? " AND h.myUpdated >= :SINCE" : ""); + String querySring = "SELECT count(h) FROM ResourceHistoryTable h " + "WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE" + " AND h.myUpdated < :END" + + (theSince != null ? " AND h.myUpdated >= :SINCE" : ""); TypedQuery countQuery = myEntityManager.createQuery(querySring, Long.class); countQuery.setParameter("PID", translateForcedIdToPid(theId)); countQuery.setParameter("RESTYPE", resourceType); @@ -267,8 +270,9 @@ public class FhirResourceDao extends BaseFhirDao implements retVal.add(current); } - TypedQuery q = myEntityManager.createQuery("SELECT h FROM ResourceHistoryTable h WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE AND h.myUpdated < :END " + (theSince != null ? " AND h.myUpdated >= :SINCE" : "") - + " ORDER BY h.myUpdated ASC", ResourceHistoryTable.class); + TypedQuery q = myEntityManager.createQuery( + "SELECT h FROM ResourceHistoryTable h WHERE h.myResourceId = :PID AND h.myResourceType = :RESTYPE AND h.myUpdated < :END " + + (theSince != null ? " AND h.myUpdated >= :SINCE" : "") + " ORDER BY h.myUpdated ASC", ResourceHistoryTable.class); q.setParameter("PID", translateForcedIdToPid(theId)); q.setParameter("RESTYPE", resourceType); q.setParameter("END", end.getValue(), TemporalType.TIMESTAMP); @@ -317,7 +321,8 @@ public class FhirResourceDao extends BaseFhirDao implements throw new ConfigurationException("Unknown search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + "]"); } if (sp.getParamType() != SearchParamTypeEnum.TOKEN) { - throw new ConfigurationException("Search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + "] is not a token type, only token is supported"); + throw new ConfigurationException("Search param on resource[" + myResourceName + "] for secondary key[" + mySecondaryPrimaryKeyParamName + + "] is not a token type, only token is supported"); } } @@ -353,10 +358,11 @@ public class FhirResourceDao extends BaseFhirDao implements entity = null; } } - + if (entity == null) { if (theId.hasVersionIdPart()) { - TypedQuery q = myEntityManager.createQuery("SELECT t from ResourceHistoryTable t WHERE t.myResourceId = :RID AND t.myResourceType = :RTYP AND t.myResourceVersion = :RVER", ResourceHistoryTable.class); + TypedQuery q = myEntityManager.createQuery( + "SELECT t from ResourceHistoryTable t WHERE t.myResourceId = :RID AND t.myResourceType = :RTYP AND t.myResourceVersion = :RVER", ResourceHistoryTable.class); q.setParameter("RID", pid); q.setParameter("RTYP", myResourceName); q.setParameter("RVER", theId.getVersionIdPartAsLong()); @@ -365,10 +371,10 @@ public class FhirResourceDao extends BaseFhirDao implements if (entity == null) { throw new ResourceNotFoundException(theId); } - } + } validateGivenIdIsAppropriateToRetrieveResource(theId, entity); - + validateResourceType(entity); return entity; @@ -532,7 +538,8 @@ public class FhirResourceDao extends BaseFhirDao implements if (previouslyLoadedPids.size() >= getConfig().getIncludeLimit()) { OperationOutcome oo = new OperationOutcome(); - oo.addIssue().setSeverity(IssueSeverityEnum.WARNING).setDetails("Not all _include resources were actually included as the request surpassed the limit of " + getConfig().getIncludeLimit() + " resources"); + oo.addIssue().setSeverity(IssueSeverityEnum.WARNING) + .setDetails("Not all _include resources were actually included as the request surpassed the limit of " + getConfig().getIncludeLimit() + " resources"); retVal.add(0, oo); } } @@ -704,8 +711,7 @@ public class FhirResourceDao extends BaseFhirDao implements } /** - * If set, the given param will be treated as a secondary primary key, and multiple resources will not be able to - * share the same value. + * If set, the given param will be treated as a secondary primary key, and multiple resources will not be able to share the same value. */ public void setSecondaryPrimaryKeyParamName(String theSecondaryPrimaryKeyParamName) { mySecondaryPrimaryKeyParamName = theSecondaryPrimaryKeyParamName; @@ -728,7 +734,7 @@ public class FhirResourceDao extends BaseFhirDao implements if (theId.hasVersionIdPart() && theId.getVersionIdPartAsLong().longValue() != entity.getVersion()) { throw new InvalidRequestException("Trying to update " + theId + " but this is not the current version"); } - + ResourceTable savedEntity = updateEntity(theResource, entity, true, false); notifyWriteCompleted(); @@ -1294,7 +1300,8 @@ public class FhirResourceDao extends BaseFhirDao implements return p; } - private Predicate createPredicateString(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder, From theFrom) { + private Predicate createPredicateString(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder, + From theFrom) { String rawSearchTerm; if (theParameter instanceof TokenParam) { TokenParam id = (TokenParam) theParameter; @@ -1313,7 +1320,8 @@ public class FhirResourceDao extends BaseFhirDao implements } if (rawSearchTerm.length() > ResourceIndexedSearchParamString.MAX_LENGTH) { - throw new InvalidRequestException("Parameter[" + theParamName + "] has length (" + rawSearchTerm.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamString.MAX_LENGTH + "): " + rawSearchTerm); + throw new InvalidRequestException("Parameter[" + theParamName + "] has length (" + rawSearchTerm.length() + ") that is longer than maximum allowed (" + + ResourceIndexedSearchParamString.MAX_LENGTH + "): " + rawSearchTerm); } String likeExpression = normalizeString(rawSearchTerm); @@ -1327,7 +1335,8 @@ public class FhirResourceDao extends BaseFhirDao implements return singleCode; } - private Predicate createPredicateToken(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder, From theFrom) { + private Predicate createPredicateToken(IQueryParameterType theParameter, String theParamName, CriteriaBuilder theBuilder, + From theFrom) { String code; String system; if (theParameter instanceof TokenParam) { @@ -1347,10 +1356,12 @@ public class FhirResourceDao extends BaseFhirDao implements } if (system != null && system.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) { - throw new InvalidRequestException("Parameter[" + theParamName + "] has system (" + system.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + system); + throw new InvalidRequestException("Parameter[" + theParamName + "] has system (" + system.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + + "): " + system); } if (code != null && code.length() > ResourceIndexedSearchParamToken.MAX_LENGTH) { - throw new InvalidRequestException("Parameter[" + theParamName + "] has code (" + code.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + "): " + code); + throw new InvalidRequestException("Parameter[" + theParamName + "] has code (" + code.length() + ") that is longer than maximum allowed (" + ResourceIndexedSearchParamToken.MAX_LENGTH + + "): " + code); } ArrayList singleCodePredicates = (new ArrayList()); @@ -1499,7 +1510,8 @@ public class FhirResourceDao extends BaseFhirDao implements private void validateResourceType(BaseHasResource entity) { if (!myResourceName.equals(entity.getResourceType())) { - throw new ResourceNotFoundException("Resource with ID " + entity.getIdDt().getIdPart() + " exists but it is not of type " + myResourceName + ", found resource of type " + entity.getResourceType()); + throw new ResourceNotFoundException("Resource with ID " + entity.getIdDt().getIdPart() + " exists but it is not of type " + myResourceName + ", found resource of type " + + entity.getResourceType()); } } diff --git a/hapi-fhir-jpaserver-test/pom.xml b/hapi-fhir-jpaserver-test/pom.xml index 9abcd40a5b8..fa440f6142a 100644 --- a/hapi-fhir-jpaserver-test/pom.xml +++ b/hapi-fhir-jpaserver-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -17,7 +17,7 @@ ca.uhn.hapi.fhir hapi-fhir-jpaserver-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT org.thymeleaf @@ -127,7 +127,7 @@ ca.uhn.hapi.fhir hapi-tinder-plugin - 0.6-SNAPSHOT + 0.7-SNAPSHOT buildclient diff --git a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml index 02737c72538..944458339f2 100644 --- a/hapi-fhir-jpaserver-uhnfhirtest/pom.xml +++ b/hapi-fhir-jpaserver-uhnfhirtest/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -16,12 +16,12 @@ ca.uhn.hapi.fhir hapi-fhir-jpaserver-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-testpage-overlay - 0.6-SNAPSHOT + 0.7-SNAPSHOT war provided @@ -29,7 +29,7 @@ ca.uhn.hapi.fhir hapi-fhir-jpaserver-test - 0.6-SNAPSHOT + 0.7-SNAPSHOT test @@ -185,7 +185,7 @@ ca.uhn.hapi.fhir hapi-tinder-plugin - 0.6-SNAPSHOT + 0.7-SNAPSHOT buildclient diff --git a/hapi-fhir-oauth2/pom.xml b/hapi-fhir-oauth2/pom.xml index 4f94b7b97ef..0b25822e359 100644 --- a/hapi-fhir-oauth2/pom.xml +++ b/hapi-fhir-oauth2/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -17,7 +17,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT diff --git a/hapi-fhir-structures-dstu/pom.xml b/hapi-fhir-structures-dstu/pom.xml index 507885552bb..dda39a0f878 100644 --- a/hapi-fhir-structures-dstu/pom.xml +++ b/hapi-fhir-structures-dstu/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -18,7 +18,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT @@ -27,7 +27,7 @@ ca.uhn.hapi.fhir hapi-tinder-plugin - 0.6-SNAPSHOT + 0.7-SNAPSHOT diff --git a/hapi-fhir-testpage-overlay/pom.xml b/hapi-fhir-testpage-overlay/pom.xml index b13ede1b425..be8df6e6989 100644 --- a/hapi-fhir-testpage-overlay/pom.xml +++ b/hapi-fhir-testpage-overlay/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -27,7 +27,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT org.thymeleaf @@ -50,7 +50,7 @@ ca.uhn.hapi.fhir hapi-fhir-jpaserver-test - 0.6-SNAPSHOT + 0.7-SNAPSHOT test diff --git a/hapi-tinder-plugin/pom.xml b/hapi-tinder-plugin/pom.xml index c86ddef4b90..3142ebaf1f0 100644 --- a/hapi-tinder-plugin/pom.xml +++ b/hapi-tinder-plugin/pom.xml @@ -5,7 +5,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -19,7 +19,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT diff --git a/hapi-tinder-test/pom.xml b/hapi-tinder-test/pom.xml index 69984f42eab..b03354f5be9 100644 --- a/hapi-tinder-test/pom.xml +++ b/hapi-tinder-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -17,7 +17,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT @@ -40,7 +40,7 @@ ca.uhn.hapi.fhir hapi-tinder-plugin - 0.6-SNAPSHOT + 0.7-SNAPSHOT custom-structs diff --git a/pom.xml b/pom.xml index d7dd1819111..588afded1c4 100644 --- a/pom.xml +++ b/pom.xml @@ -12,7 +12,7 @@ ca.uhn.hapi.fhir hapi-fhir pom - 0.6-SNAPSHOT + 0.7-SNAPSHOT HAPI-FHIR http://hl7api.sourceforge.net/hapi-fhir/ diff --git a/restful-server-example-test/pom.xml b/restful-server-example-test/pom.xml index 2b30ade836c..68e148fbc3e 100644 --- a/restful-server-example-test/pom.xml +++ b/restful-server-example-test/pom.xml @@ -4,7 +4,7 @@ ca.uhn.hapi.fhir hapi-fhir - 0.6-SNAPSHOT + 0.7-SNAPSHOT ../pom.xml @@ -17,7 +17,7 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT ch.qos.logback diff --git a/restful-server-example/pom.xml b/restful-server-example/pom.xml index 5b1a072627b..73fffeabc9e 100644 --- a/restful-server-example/pom.xml +++ b/restful-server-example/pom.xml @@ -34,14 +34,14 @@ ca.uhn.hapi.fhir hapi-fhir-base - 0.6-SNAPSHOT + 0.7-SNAPSHOT ca.uhn.hapi.fhir hapi-fhir-testpage-overlay - 0.6-SNAPSHOT + 0.7-SNAPSHOT war provided