/** * 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; }
public static IValidationContext<IBaseResource> forText(final FhirContext theContext, final String theResourceBody) { ObjectUtil.requireNonNull(theContext, "theContext can not be null"); ObjectUtil.requireNotEmpty(theResourceBody, "theResourceBody can not be null or empty"); return new BaseValidationContext<IBaseResource>(theContext) {
@Override public void addValidationMessage(SingleValidationMessage theMessage) { ObjectUtil.requireNonNull(theMessage, "theMessage must not be null"); myMessages.add(theMessage); }
@Override public void addValidationMessage(SingleValidationMessage theMessage) { ObjectUtil.requireNonNull(theMessage, "theMessage must not be null"); myMessages.add(theMessage); }
/** * 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; }
public static IValidationContext<IBaseResource> forText(final FhirContext theContext, final String theResourceBody) { ObjectUtil.requireNonNull(theContext, "theContext can not be null"); ObjectUtil.requireNotEmpty(theResourceBody, "theResourceBody can not be null or empty"); return new BaseValidationContext<IBaseResource>(theContext) {
/** * 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 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 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());