diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java index 25486ed..120abcf 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/service/impl/FhirSRV.java @@ -140,11 +140,8 @@ private SubmissionSetEntryDTO createSubmissionSetEntry(final org.jsoup.nodes.Doc sse.setAuthorRole(authorSlotDTO.getAuthorRole()); sse.setPatientId(buildPatient(docCDA)); - String org = organizationId; - if(organizationId.startsWith("0")) { - org = organizationId.substring(1, organizationId.length()); - } - sse.setSourceId(SOURCE_ID_PREFIX+org); + String sourceId = StringUtility.sanitizeSourceId(organizationId); + sse.setSourceId(SOURCE_ID_PREFIX+sourceId); sse.setUniqueID(identificativoSottomissione); sse.setSubmissionTime(new SimpleDateFormat(Constants.Misc.INI_DATE_PATTERN).format(new Date())); diff --git a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/utility/StringUtility.java b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/utility/StringUtility.java index de0b9ab..09ac0e3 100644 --- a/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/utility/StringUtility.java +++ b/src/main/java/it/finanze/sanita/fse2/ms/gtw/dispatcher/utility/StringUtility.java @@ -212,4 +212,12 @@ public static T fromJSONJackson(final String json, final Class clazz) { public static String sanitizeMessage(final String message) { return message.replace("", ""); } + + public static String sanitizeSourceId(final String organizationId) { + String sourceId = organizationId; + if(sourceId.startsWith("0")) { + sourceId = sourceId.substring(1, sourceId.length()); + } + return sourceId; + } }