@Test public void convert_shouldConvertAValidConceptNameIdString() throws Exception { int conceptNameId = 1439; CodedOrFreeTextValue codedValue = converter.convert(CONCEPT_NAME_PREFIX + conceptNameId); ConceptName name = codedValue.getCodedNameValue(); assertEquals(conceptNameId, name.getConceptNameId().intValue()); }
@Override public CodedOrFreeTextValue convert(String str) { if (StringUtils.isNotBlank(str)) { if (str.startsWith(CONCEPT_PREFIX)) { String uuidOrConceptId = str.substring(str.indexOf(CONCEPT_PREFIX) + CONCEPT_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptId)) { Concept concept = conversionServiceFactory.getObject().convert(uuidOrConceptId, Concept.class); return new CodedOrFreeTextValue(concept); } } else if (str.startsWith(CONCEPT_NAME_PREFIX)) { String uuidOrConceptNameId = str.substring(str.indexOf(CONCEPT_NAME_PREFIX) + CONCEPT_NAME_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptNameId)) { ConceptName name = conversionServiceFactory.getObject().convert(uuidOrConceptNameId, ConceptName.class); return new CodedOrFreeTextValue(name); } } else if (str.startsWith(NON_CODED_PREFIX)) { return new CodedOrFreeTextValue(str.substring(str.indexOf(NON_CODED_PREFIX) + NON_CODED_PREFIX.length())); } } return new CodedOrFreeTextValue(); }
StringToCodedOrFreeTextValueConverter implements Converter<String, CodedOrFreeTextValue> { @Override public CodedOrFreeTextValue convert(String str) { if (StringUtils.isNotBlank(str)) { if (str.startsWith(CONCEPT_PREFIX)) { String uuidOrConceptId = str.substring(str.indexOf(CONCEPT_PREFIX) + CONCEPT_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptId)) { Concept concept = conversionServiceFactory.getObject().convert(uuidOrConceptId, Concept.class); return new CodedOrFreeTextValue(concept); } } else if (str.startsWith(CONCEPT_NAME_PREFIX)) { String uuidOrConceptNameId = str.substring(str.indexOf(CONCEPT_NAME_PREFIX) + CONCEPT_NAME_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptNameId)) { ConceptName name = conversionServiceFactory.getObject().convert(uuidOrConceptNameId, ConceptName.class); return new CodedOrFreeTextValue(name); } } else if (str.startsWith(NON_CODED_PREFIX)) { return new CodedOrFreeTextValue(str.substring(str.indexOf(NON_CODED_PREFIX) + NON_CODED_PREFIX.length())); } } return new CodedOrFreeTextValue(); } }
StringToCodedOrFreeTextValueConverter implements Converter<String, CodedOrFreeTextValue> { @Override public CodedOrFreeTextValue convert(String str) { if (StringUtils.isNotBlank(str)) { if (str.startsWith(CONCEPT_PREFIX)) { String uuidOrConceptId = str.substring(str.indexOf(CONCEPT_PREFIX) + CONCEPT_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptId)) { Concept concept = conversionServiceFactory.getObject().convert(uuidOrConceptId, Concept.class); return new CodedOrFreeTextValue(concept); } } else if (str.startsWith(CONCEPT_NAME_PREFIX)) { String uuidOrConceptNameId = str.substring(str.indexOf(CONCEPT_NAME_PREFIX) + CONCEPT_NAME_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptNameId)) { ConceptName name = conversionServiceFactory.getObject().convert(uuidOrConceptNameId, ConceptName.class); return new CodedOrFreeTextValue(name); } } else if (str.startsWith(NON_CODED_PREFIX)) { return new CodedOrFreeTextValue(str.substring(str.indexOf(NON_CODED_PREFIX) + NON_CODED_PREFIX.length())); } } return new CodedOrFreeTextValue(); }  }
StringToCodedOrFreeTextValueConverter implements Converter<String, CodedOrFreeTextValue> { @Override public CodedOrFreeTextValue convert(String str) { if (StringUtils.isNotBlank(str)) { if (str.startsWith(CONCEPT_PREFIX)) { String uuidOrConceptId = str.substring(str.indexOf(CONCEPT_PREFIX) + CONCEPT_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptId)) { Concept concept = conversionServiceFactory.getObject().convert(uuidOrConceptId, Concept.class); return new CodedOrFreeTextValue(concept); } } else if (str.startsWith(CONCEPT_NAME_PREFIX)) { String uuidOrConceptNameId = str.substring(str.indexOf(CONCEPT_NAME_PREFIX) + CONCEPT_NAME_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptNameId)) { ConceptName name = conversionServiceFactory.getObject().convert(uuidOrConceptNameId, ConceptName.class); return new CodedOrFreeTextValue(name); } } else if (str.startsWith(NON_CODED_PREFIX)) { return new CodedOrFreeTextValue(str.substring(str.indexOf(NON_CODED_PREFIX) + NON_CODED_PREFIX.length())); } } return new CodedOrFreeTextValue(); }  @Override CodedOrFreeTextValue convert(String str); }
StringToCodedOrFreeTextValueConverter implements Converter<String, CodedOrFreeTextValue> { @Override public CodedOrFreeTextValue convert(String str) { if (StringUtils.isNotBlank(str)) { if (str.startsWith(CONCEPT_PREFIX)) { String uuidOrConceptId = str.substring(str.indexOf(CONCEPT_PREFIX) + CONCEPT_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptId)) { Concept concept = conversionServiceFactory.getObject().convert(uuidOrConceptId, Concept.class); return new CodedOrFreeTextValue(concept); } } else if (str.startsWith(CONCEPT_NAME_PREFIX)) { String uuidOrConceptNameId = str.substring(str.indexOf(CONCEPT_NAME_PREFIX) + CONCEPT_NAME_PREFIX.length()); if (StringUtils.isNotBlank(uuidOrConceptNameId)) { ConceptName name = conversionServiceFactory.getObject().convert(uuidOrConceptNameId, ConceptName.class); return new CodedOrFreeTextValue(name); } } else if (str.startsWith(NON_CODED_PREFIX)) { return new CodedOrFreeTextValue(str.substring(str.indexOf(NON_CODED_PREFIX) + NON_CODED_PREFIX.length())); } } return new CodedOrFreeTextValue(); }  @Override CodedOrFreeTextValue convert(String str);  }