Skip to content

Commit

Permalink
MAINT-2499 Logic updated
Browse files Browse the repository at this point in the history
  • Loading branch information
QuyenLy87 committed Apr 12, 2024
1 parent c935d6b commit d43f0fd
Showing 1 changed file with 7 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,8 @@ public class PublishServiceImpl implements PublishService {

private static final String PUBLISHED_BUILD = "published_build_backup";

private static final String SNOMEDCT = "SNOMEDCT";

private static final Logger LOGGER = LoggerFactory.getLogger(PublishServiceImpl.class);

private final FileHelper srsFileHelper;
Expand Down Expand Up @@ -286,7 +288,7 @@ private void uploadReleaseFileToNewVersionedContentBucket(Build build, ReleaseFi
.findAny()
.orElse(null);
if (codeSystem != null) {
File releaseFile = File.createTempFile("temp", RF2Constants.ZIP_FILE_EXTENSION);
File releaseFile = new File(releaseFiles.releaseFileName());
try {
try (InputStream inputFileStream = srsFileHelper.getFileStream(s3PathHelper.getBuildOutputFilePath(build, releaseFiles.releaseFileName()));
FileOutputStream out = new FileOutputStream(releaseFile)) {
Expand All @@ -298,16 +300,17 @@ private void uploadReleaseFileToNewVersionedContentBucket(Build build, ReleaseFi
Map<String, Object> metadata = getBranchMetadataIncludeInherited(build.getConfiguration().getBranchPath());
moduleId = (String) metadata.get("defaultModuleId");
}
if (!StringUtils.isEmpty(moduleId) && build.getConfiguration().getExtensionConfig() != null) {
if (StringUtils.isEmpty(moduleId) && build.getConfiguration().getExtensionConfig() != null) {
String moduleIdsStr = build.getConfiguration().getExtensionConfig().getModuleIds();
if (!StringUtils.isEmpty(moduleIdsStr)) {
moduleId = moduleIdsStr.split(Constants.COMMA)[0].trim();
}
}
if (!StringUtils.isEmpty(moduleId)) {
if (StringUtils.isEmpty(moduleId)) {
moduleId = RF2Constants.INTERNATIONAL_CORE_MODULE_ID;
}
moduleStorageCoordinator.upload(codeSystem.getShortName(), moduleId, build.getConfiguration().getEffectiveTimeSnomedFormat(), releaseFile);
String codeSystemShortname = SNOMEDCT.equals(codeSystem.getShortName()) ? RF2Constants.INT : codeSystem.getShortName().substring(codeSystem.getShortName().indexOf('-') + 1);
moduleStorageCoordinator.upload(codeSystemShortname, moduleId, build.getConfiguration().getEffectiveTimeSnomedFormat(), releaseFile);
} finally {
org.apache.commons.io.FileUtils.forceDelete(releaseFile);
}
Expand Down

0 comments on commit d43f0fd

Please sign in to comment.