diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/IgnoredRf2EffectiveTimeSlice.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/IgnoredRf2EffectiveTimeSlice.java index c730231398e..c2096ce3bc7 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/IgnoredRf2EffectiveTimeSlice.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/IgnoredRf2EffectiveTimeSlice.java @@ -1,5 +1,5 @@ /* - * Copyright 2021 B2i Healthcare, https://b2ihealthcare.com + * Copyright 2021-2024 B2i Healthcare, https://b2ihealthcare.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -45,7 +45,7 @@ public IgnoredRf2EffectiveTimeSlice(String effectiveTimeToIgnore, String message } @Override - public void register(String containerId, Rf2ContentType type, String[] values, ImportDefectBuilder defectBuilder) { + public void register(long containerId, Rf2ContentType type, String[] values, ImportDefectBuilder defectBuilder) { } @Override diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/MapDBRf2EffectiveTimeSlice.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/MapDBRf2EffectiveTimeSlice.java index 19204d24f92..1a873b69c4d 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/MapDBRf2EffectiveTimeSlice.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/MapDBRf2EffectiveTimeSlice.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2023 B2i Healthcare, https://b2ihealthcare.com + * Copyright 2017-2024 B2i Healthcare, https://b2ihealthcare.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -105,25 +105,24 @@ private T getComponent(String componentId) { } @Override - public void register(String containerId, Rf2ContentType type, String[] values, ImportDefectBuilder defectBuilder) { + public void register(long containerId, Rf2ContentType type, String[] values, ImportDefectBuilder defectBuilder) { String[] valuesWithType = new String[values.length + 1]; valuesWithType[0] = type.getType(); System.arraycopy(values, 0, valuesWithType, 1, values.length); final String componentId = values[0]; - final long containerIdL = Long.parseLong(containerId); // track refset members via membersByReferencedComponent map if (Rf2RefSetContentType.class.isAssignableFrom(type.getClass())) { - if (!membersByReferencedComponent.containsKey(containerIdL)) { - membersByReferencedComponent.put(containerIdL, newHashSet()); + if (!membersByReferencedComponent.containsKey(containerId)) { + membersByReferencedComponent.put(containerId, newHashSet()); } - membersByReferencedComponent.get(containerIdL).add(componentId); + membersByReferencedComponent.get(containerId).add(componentId); } else { // register other non-concept components in the dependency graph to force strongly connected subgraphs - if (!IComponent.ROOT_ID.equals(containerId)) { - registerDependencies(containerIdL, PrimitiveSets.newLongOpenHashSet(Long.parseLong(componentId))); + if (IComponent.ROOT_IDL != containerId) { + registerDependencies(containerId, PrimitiveSets.newLongOpenHashSet(Long.parseLong(componentId))); } } diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2ContentType.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2ContentType.java index 44b303896df..7d165cc16e5 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2ContentType.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2ContentType.java @@ -1,5 +1,5 @@ /* - * Copyright 2017-2021 B2i Healthcare, https://b2ihealthcare.com + * Copyright 2017-2024 B2i Healthcare, https://b2ihealthcare.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -38,8 +38,15 @@ public interface Rf2ContentType { default void register(String[] values, Rf2EffectiveTimeSlice slice, ImportDefectBuilder defectBuilder) { final String containerId = getContainerId(values); - slice.register(containerId, this, values, defectBuilder); - slice.registerDependencies(getDependentComponentId(values), getDependencies(values)); + try { + final long containerIdL = Long.parseLong(containerId); + + slice.register(containerIdL, this, values, defectBuilder); + slice.registerDependencies(getDependentComponentId(values), getDependencies(values)); + } catch (NumberFormatException e) { + defectBuilder.error("Non-SCTID (%s) present in container column of RF2 content type of '%s'", containerId, getType()); + return; + } } default long getDependentComponentId(String[] values) { diff --git a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2EffectiveTimeSlice.java b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2EffectiveTimeSlice.java index feab84bbd14..b74bf4fcf55 100644 --- a/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2EffectiveTimeSlice.java +++ b/snomed/com.b2international.snowowl.snomed.datastore/src/com/b2international/snowowl/snomed/datastore/request/rf2/importer/Rf2EffectiveTimeSlice.java @@ -1,5 +1,5 @@ /* - * Copyright 2021-2023 B2i Healthcare, https://b2ihealthcare.com + * Copyright 2021-2024 B2i Healthcare, https://b2ihealthcare.com * * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. @@ -35,7 +35,7 @@ public interface Rf2EffectiveTimeSlice { int BATCH_SIZE = 5000; - void register(String containerId, Rf2ContentType type, String[] values, ImportDefectBuilder defectBuilder); + void register(long containerId, Rf2ContentType type, String[] values, ImportDefectBuilder defectBuilder); void registerDependencies(long componentId, LongSet dependencies);