@Override @PrePersist public void calculateHashes() { if (myHashIdentity == null) { String resourceType = getResourceType(); String paramName = getParamName(); String units = getUnits(); String system = getSystem(); setHashIdentity(calculateHashIdentity(resourceType, paramName)); setHashIdentityAndUnits(calculateHashUnits(resourceType, paramName, units)); setHashIdentitySystemAndUnits(calculateHashSystemAndUnits(resourceType, paramName, system, units)); } }
@Override public int hashCode() { calculateHashes(); HashCodeBuilder b = new HashCodeBuilder(); b.append(getResourceType()); b.append(getParamName()); b.append(getSystem()); b.append(getUnits()); b.append(getValue()); return b.toHashCode(); }
public void setUnits(String theUnits) { clearHashes(); myUnits = theUnits; }
@Override public boolean equals(Object theObj) { if (this == theObj) { return true; } if (theObj == null) { return false; } if (!(theObj instanceof ResourceIndexedSearchParamQuantity)) { return false; } ResourceIndexedSearchParamQuantity obj = (ResourceIndexedSearchParamQuantity) theObj; EqualsBuilder b = new EqualsBuilder(); b.append(getParamName(), obj.getParamName()); b.append(getResource(), obj.getResource()); b.append(getSystem(), obj.getSystem()); b.append(getUnits(), obj.getUnits()); b.append(getValue(), obj.getValue()); b.append(getHashIdentity(), obj.getHashIdentity()); b.append(getHashIdentitySystemAndUnits(), obj.getHashIdentitySystemAndUnits()); b.append(getHashIdentityAndUnits(), obj.getHashIdentityAndUnits()); return b.isEquals(); }
long hash = ResourceIndexedSearchParamQuantity.calculateHashSystemAndUnits(theResourceName, theParamName, systemValue, unitsValue); hashPredicate = myBuilder.equal(theFrom.get("myHashIdentitySystemAndUnits"), hash); } else if (!isBlank(unitsValue)) { long hash = ResourceIndexedSearchParamQuantity.calculateHashUnits(theResourceName, theParamName, unitsValue); hashPredicate = myBuilder.equal(theFrom.get("myHashIdentityAndUnits"), hash); } else {
private void addQuantity(ResourceTable theEntity, HashSet<ResourceIndexedSearchParamQuantity> retVal, String resourceName, Quantity nextValue) { if (!nextValue.getValueElement().isEmpty()) { BigDecimal nextValueValue = nextValue.getValueElement().getValue(); String nextValueString = nextValue.getSystemElement().getValueAsString(); String nextValueCode = nextValue.getCode(); ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValueValue, nextValueString, nextValueCode); nextEntity.setResource(theEntity); retVal.add(nextEntity); } }
public Long getHashIdentity() { calculateHashes(); return myHashIdentity; }
break; case QUANTITY: param = new ResourceIndexedSearchParamQuantity(); break; case STRING:
long hash = ResourceIndexedSearchParamQuantity.calculateHashSystemAndUnits(theResourceName, theParamName, systemValue, unitsValue); hashPredicate = myBuilder.equal(theFrom.get("myHashIdentitySystemAndUnits"), hash); } else if (!isBlank(unitsValue)) { long hash = ResourceIndexedSearchParamQuantity.calculateHashUnits(theResourceName, theParamName, unitsValue); hashPredicate = myBuilder.equal(theFrom.get("myHashIdentityAndUnits"), hash); } else {
private void addQuantity(ResourceTable theEntity, HashSet<ResourceIndexedSearchParamQuantity> retVal, String resourceName, Quantity nextValue) { if (!nextValue.getValueElement().isEmpty()) { BigDecimal nextValueValue = nextValue.getValueElement().getValue(); String nextValueString = nextValue.getSystemElement().getValueAsString(); String nextValueCode = nextValue.getCode(); ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValueValue, nextValueString, nextValueCode); nextEntity.setResource(theEntity); retVal.add(nextEntity); } }
public Long getHashIdentityAndUnits() { calculateHashes(); return myHashIdentityAndUnits; }
.setColumnName("HASH_IDENTITY") .addCalculator("HASH_IDENTITY", t -> BaseResourceIndexedSearchParam.calculateHashIdentity(t.getResourceType(), t.getString("SP_NAME"))) .addCalculator("HASH_IDENTITY_AND_UNITS", t -> ResourceIndexedSearchParamQuantity.calculateHashUnits(t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_UNITS"))) .addCalculator("HASH_IDENTITY_SYS_UNITS", t -> ResourceIndexedSearchParamQuantity.calculateHashSystemAndUnits(t.getResourceType(), t.getString("SP_NAME"), t.getString("SP_SYSTEM"), t.getString("SP_UNITS"))) );
ResourceIndexedSearchParamQuantity nextEntity = new ResourceIndexedSearchParamQuantity(resourceName, nextValue.getValueElement().getValue(), nextValue.getSystemElement().getValueAsString(), nextValue.getCode()); nextEntity.setResource(theEntity); retVal.add(nextEntity); } else {
public void setSystem(String theSystem) { clearHashes(); mySystem = theSystem; }
private Long getHashIdentitySystemAndUnits() { calculateHashes(); return myHashIdentitySystemAndUnits; }
public void setValue(BigDecimal theValue) { clearHashes(); myValue = theValue; }