/** * Returns the first tag (if any) that has the given system and code, or returns * <code>null</code> if none */ public Coding getTag(String theSystem, String theCode) { for (Coding next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first security label (if any) that has the given system and code, or returns * <code>null</code> if none */ public Coding getSecurity(String theSystem, String theCode) { for (Coding next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first security label (if any) that has the given system and code, or returns * <code>null</code> if none */ public CodingDt getSecurity(String theSystem, String theCode) { for (CodingDt next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first tag (if any) that has the given system and code, or returns * <code>null</code> if none */ public Coding getTag(String theSystem, String theCode) { for (Coding next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first tag (if any) that has the given system and code, or returns * <code>null</code> if none */ public CodingDt getTag(String theSystem, String theCode) { for (CodingDt next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first tag (if any) that has the given system and code, or returns * <code>null</code> if none */ public Coding getTag(String theSystem, String theCode) { for (Coding next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first security label (if any) that has the given system and code, or returns * <code>null</code> if none */ public Coding getSecurity(String theSystem, String theCode) { for (Coding next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; } protected void listChildren(List<Property> childrenList) {
/** * Returns the first security label (if any) that has the given system and code, or returns * <code>null</code> if none */ public Coding getSecurity(String theSystem, String theCode) { for (Coding next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; } protected void listChildren(List<Property> children) {
private <MT extends IBaseMetaType> void doMetaDelete(MT theMetaDel, BaseHasResource entity) { List<TagDefinition> tags = toTagList(theMetaDel); //@formatter:off for (TagDefinition nextDef : tags) { for (BaseTag next : new ArrayList<BaseTag>(entity.getTags())) { if (ObjectUtil.equals(next.getTag().getTagType(), nextDef.getTagType()) && ObjectUtil.equals(next.getTag().getSystem(), nextDef.getSystem()) && ObjectUtil.equals(next.getTag().getCode(), nextDef.getCode())) { myEntityManager.remove(next); entity.getTags().remove(next); } } } //@formatter:on if (entity.getTags().isEmpty()) { entity.setHasTags(false); } myEntityManager.merge(entity); }
@Override public void addTag(IIdType theId, TagTypeEnum theTagType, String theScheme, String theTerm, String theLabel) { StopWatch w = new StopWatch(); BaseHasResource entity = readEntity(theId); if (entity == null) { throw new ResourceNotFoundException(theId); } for (BaseTag next : new ArrayList<>(entity.getTags())) { if (ObjectUtil.equals(next.getTag().getTagType(), theTagType) && ObjectUtil.equals(next.getTag().getSystem(), theScheme) && ObjectUtil.equals(next.getTag().getCode(), theTerm)) { return; } } entity.setHasTags(true); TagDefinition def = getTagOrNull(TagTypeEnum.TAG, theScheme, theTerm, theLabel); if (def != null) { BaseTag newEntity = entity.addTag(def); if (newEntity.getTagId() == null) { myEntityManager.persist(newEntity); myEntityManager.merge(entity); } } ourLog.debug("Processed addTag {}/{} on {} in {}ms", theScheme, theTerm, theId, w.getMillisAndRestart()); }
@Override public void removeTag(IIdType theId, TagTypeEnum theTagType, String theScheme, String theTerm, RequestDetails theRequestDetails) { // Notify interceptors if (theRequestDetails != null) { ActionRequestDetails requestDetails = new ActionRequestDetails(theRequestDetails, getResourceName(), theId); notifyInterceptors(RestOperationTypeEnum.DELETE_TAGS, requestDetails); } StopWatch w = new StopWatch(); BaseHasResource entity = readEntity(theId); if (entity == null) { throw new ResourceNotFoundException(theId); } for (BaseTag next : new ArrayList<>(entity.getTags())) { if (ObjectUtil.equals(next.getTag().getTagType(), theTagType) && ObjectUtil.equals(next.getTag().getSystem(), theScheme) && ObjectUtil.equals(next.getTag().getCode(), theTerm)) { myEntityManager.remove(next); entity.getTags().remove(next); } } if (entity.getTags().isEmpty()) { entity.setHasTags(false); } myEntityManager.merge(entity); ourLog.debug("Processed remove tag {}/{} on {} in {}ms", theScheme, theTerm, theId.getValue(), w.getMillisAndRestart()); }
private <MT extends IBaseMetaType> void doMetaAdd(MT theMetaAdd, BaseHasResource entity) { List<TagDefinition> tags = toTagList(theMetaAdd); for (TagDefinition nextDef : tags) { boolean hasTag = false; for (BaseTag next : new ArrayList<>(entity.getTags())) { if (ObjectUtil.equals(next.getTag().getTagType(), nextDef.getTagType()) && ObjectUtil.equals(next.getTag().getSystem(), nextDef.getSystem()) && ObjectUtil.equals(next.getTag().getCode(), nextDef.getCode())) { hasTag = true; break; } } if (!hasTag) { entity.setHasTags(true); TagDefinition def = getTagOrNull(nextDef.getTagType(), nextDef.getSystem(), nextDef.getCode(), nextDef.getDisplay()); if (def != null) { BaseTag newEntity = entity.addTag(def); if (newEntity.getTagId() == null) { myEntityManager.persist(newEntity); } } } } validateMetaCount(entity.getTags().size()); myEntityManager.merge(entity); }
myCodeSystemDao.save(codeSystem); } else { if (!ObjectUtil.equals(codeSystem.getResource().getId(), theCodeSystemVersion.getResource().getId())) { String msg = myContext.getLocalizer().getMessage(BaseHapiTerminologySvcImpl.class, "cannotCreateDuplicateCodeSystemUri", theSystemUri, codeSystem.getResource().getIdDt().toUnqualifiedVersionless().getValue());
private static int compare(FhirContext theCtx, IQueryParameterType theO1, IQueryParameterType theO2) { int retVal; if (theO1.getMissing() == null && theO2.getMissing() == null) { retVal = 0; } else if (theO1.getMissing() == null) { retVal = -1; } else if (theO2.getMissing() == null) { retVal = 1; } else if (ObjectUtil.equals(theO1.getMissing(), theO2.getMissing())) { retVal = 0; } else { if (theO1.getMissing()) { retVal = 1; } else { retVal = -1; } } if (retVal == 0) { String q1 = theO1.getQueryParameterQualifier(); String q2 = theO2.getQueryParameterQualifier(); retVal = StringUtils.compare(q1, q2); } if (retVal == 0) { String v1 = theO1.getValueAsQueryToken(theCtx); String v2 = theO2.getValueAsQueryToken(theCtx); retVal = StringUtils.compare(v1, v2); } return retVal; }
/** * Returns the first tag (if any) that has the given system and code, or returns * <code>null</code> if none */ public CodingDt getTag(String theSystem, String theCode) { for (CodingDt next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first security label (if any) that has the given system and code, or returns * <code>null</code> if none */ public CodingDt getSecurity(String theSystem, String theCode) { for (CodingDt next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }
/** * Returns the first tag (if any) that has the given system and code, or returns * <code>null</code> if none */ public Coding getTag(String theSystem, String theCode) { for (Coding next : getTag()) { if (ca.uhn.fhir.util.ObjectUtil.equals(next.getSystem(), theSystem) && ca.uhn.fhir.util.ObjectUtil.equals(next.getCode(), theCode)) { return next; } } return null; }