Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

SO-2902: Add multi-language RF2 import support. #194

Merged
merged 31 commits into from
Mar 8, 2018
Merged
Show file tree
Hide file tree
Changes from 5 commits
Commits
Show all changes
31 commits
Select commit Hold shift + click to select a range
36ca49a
[rf2] Added tests for multi-language rf2 importer.
Jan 25, 2018
45be2bf
[rf2] Changed description, languagerefset file property to collection.
Jan 25, 2018
03faa6a
[rf2] Changed logic so it can work with collections.
Jan 25, 2018
fdbfab1
[rf2] Added test import rf2 archives
Jan 25, 2018
6724fcf
[rf2] Added statusCode check for the concept id, renamed variables to
Feb 6, 2018
5d570af
[rf2] Changed data binding properties.
Feb 9, 2018
8f6aa50
[rf2] Changed loops to streams moved adding description and language...
Feb 9, 2018
360660f
[rf2] Merged the two test cases into one.
Feb 9, 2018
0d002c4
[rf2] Changed logic of reading and writing of description files and...
Feb 9, 2018
bbdfc2a
[rf2] Added final modifiers.
Feb 9, 2018
5f24b78
[rf2] Fixed test import file changed language code and refset id.
Feb 9, 2018
d6d7eec
[rf2] Fixed typo.
Feb 9, 2018
ce4198f
[rf2] Fixed conceptId of refset in the import file.
Feb 9, 2018
cc853fb
[rf2] Added placeholder properties for databinding.
Feb 12, 2018
e733067
[rf2] Added validation for definition text files, removed extra lines.
Feb 15, 2018
f750f87
[rf2] Added proper monitor progress. Added logic to write...
Feb 15, 2018
53eb20d
[rf2] Added method to read collection of files and to monitor progress.
Feb 15, 2018
4cc9f5f
[rf2] Removed extra line.
Feb 15, 2018
2ed7940
[rf2] Removed extra line. Added logic to handle multiple...
Feb 15, 2018
924ef02
[rf2] Removed unneeded iteration.
Feb 15, 2018
a71ce1d
[rf2] Added logic to handle collection of text definition files.
Feb 15, 2018
797d4d5
[rf2] Removed extra line.
Feb 15, 2018
c1b1cd1
Merge remote-tracking branch 'origin/6.x' into
nagyo Feb 28, 2018
0534a6b
SO-2902: Simplify test case
nagyo Feb 28, 2018
e10c0bc
[snomed.import] Refactor ImportConfiguration
nagyo Mar 6, 2018
4888bbc
[snomed.import] Fix cloning of stated relationship file
nagyo Mar 7, 2018
bfbbde1
Merge remote-tracking branch 'origin/6.x' into issue/rf2-multi-langua…
nagyo Mar 7, 2018
222e30a
SO-2902: Update license header
nagyo Mar 7, 2018
9f25745
SO-2902: Use Pattern.quote instead of Charmatcher.replace
nagyo Mar 7, 2018
e409c61
SO-2902: Use try-with-resource for description readers
nagyo Mar 7, 2018
a24bb80
SO-2902: Fix NPE
nagyo Mar 7, 2018
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Binary file not shown.
Binary file not shown.
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,11 @@
import static com.b2international.snowowl.snomed.api.rest.CodeSystemVersionRestRequests.createVersion;
import static com.b2international.snowowl.snomed.api.rest.CodeSystemVersionRestRequests.getVersion;
import static com.b2international.snowowl.snomed.api.rest.SnomedComponentRestRequests.getComponent;
import static com.b2international.snowowl.snomed.api.rest.SnomedImportRestRequests.*;
import static com.b2international.snowowl.snomed.api.rest.SnomedImportRestRequests.createImport;
import static com.b2international.snowowl.snomed.api.rest.SnomedImportRestRequests.deleteImport;
import static com.b2international.snowowl.snomed.api.rest.SnomedImportRestRequests.getImport;
import static com.b2international.snowowl.snomed.api.rest.SnomedImportRestRequests.uploadImportFile;
import static com.b2international.snowowl.snomed.api.rest.SnomedImportRestRequests.waitForImportJob;
import static com.b2international.snowowl.test.commons.rest.RestExtensions.lastPathSegment;
import static org.hamcrest.CoreMatchers.equalTo;

Expand Down Expand Up @@ -203,5 +207,52 @@ public void import11ExtensionConceptWithVersion() {
getComponent(branchPath, SnomedComponentType.CONCEPT, "555231000005107").statusCode(200);
getVersion("SNOMEDCT-NE", "2015-02-05").statusCode(200);
}


@Test
public void importMoreThanOneLanguageCodeDescription() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please add a number to the test method's name like the others above. As you can see there is an annotation at the top: @FixMethodOrder(MethodSorters.NAME_ASCENDING) which enforces method execution order.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

importDescriptionsWithMultipleLanguageCodes or importDescriptionsWithDifferentLanguageCodes

final String enDescriptionId = "41320138114";
final String svDescriptionId = "24688171113";
final String conceptIdODescription = "301795004";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Typo


Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Unnecessary extra line

getComponent(branchPath, SnomedComponentType.DESCRIPTION, enDescriptionId).statusCode(404);
getComponent(branchPath, SnomedComponentType.DESCRIPTION, svDescriptionId).statusCode(404);
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptIdODescription).statusCode(404);

final Map<?, ?> importConfiguration = ImmutableMap.builder()
.put("type", Rf2ReleaseType.DELTA.name())
.put("branchPath", branchPath.getPath())
.put("createVersions", false)
.build();

importArchive("SnomedCT_Release_INT_20150131_new_concept_for_languageCode.zip");
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptIdODescription).statusCode(200);

importArchive("SnomedCT_Release_INT_20150201_new_description_with2_language_code.zip", importConfiguration);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The description in sct2_Description_Delta-sv_INT_20150201 has a language code 'en', please fix that!

getComponent(branchPath, SnomedComponentType.DESCRIPTION, enDescriptionId).statusCode(200);
getComponent(branchPath, SnomedComponentType.DESCRIPTION, svDescriptionId).statusCode(200);
}

@Test
public void importFromMoreThanOneLanguageRefset() {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are not importing more than one language refset! It should be rather something like:
importLanguageRefsetMembersWithMultipleLanguageCodes or importLanguageRefsetMembersWithDifferentLanguageCodes

final String enLanguageRefsetConceptId = "34d07985-48a0-41e7-b6ec-b28e6b00adfc";
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You should decide to either merge the two test cases together (since the RF2 files are the same and you always import both descriptions and language refset members as well) or split the RF2 files and test language refset and description import separately.

final String svLanguageRefsetConceptId = "34d07985-48a0-41e7-b6ec-b28e6b00adfb";
final String conceptIdOfDescriptions = "301795004";

getComponent(branchPath, SnomedComponentType.MEMBER, enLanguageRefsetConceptId).statusCode(404);
getComponent(branchPath, SnomedComponentType.MEMBER, svLanguageRefsetConceptId).statusCode(404);
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptIdOfDescriptions).statusCode(404);

final Map<?, ?> importConfiguration = ImmutableMap.builder()
.put("type", Rf2ReleaseType.DELTA.name())
.put("branchPath", branchPath.getPath())
.put("createVersions", false)
.build();
importArchive("SnomedCT_Release_INT_20150131_new_concept_for_languageCode.zip");
getComponent(branchPath, SnomedComponentType.CONCEPT, conceptIdOfDescriptions).statusCode(200);

importArchive("SnomedCT_Release_INT_20150201_new_description_with2_language_code.zip", importConfiguration);
getComponent(branchPath, SnomedComponentType.MEMBER, enLanguageRefsetConceptId).statusCode(200);
getComponent(branchPath, SnomedComponentType.MEMBER, svLanguageRefsetConceptId).statusCode(200);
}

}
Original file line number Diff line number Diff line change
Expand Up @@ -107,13 +107,20 @@ public void execute(final CommandInterpreter interpreter) {
// Setting up configuration only with the required fields
config.setSourceKind(ImportSourceKind.ARCHIVE);
config.setArchiveFile(archiveFile);
config.setDescriptionsFile(new File(archiveFileSet.getFileName(zipFiles, ReleaseComponentType.DESCRIPTION, contentSubType)));
config.setLanguageRefSetFile(languageRefSetFile);
final Collection<String> allFileName = archiveFileSet.getAllFileName(zipFiles, ReleaseComponentType.DESCRIPTION, contentSubType);
final Collection<File> descriptionFileNames = Collections.emptySet();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the initialization of this set. You create an immutable set and then try to add elements to it??
Here is the javadoc of Collections.emptySet(): "Returns an empty set (immutable)." Javadoc is your friend! Nevertheless this could be solved with Java 8 streams in one line.

for (String fileName : allFileName) {
descriptionFileNames.add(new File(fileName));
}
config.setDescriptionsFiles(descriptionFileNames);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We are in a for loop here, why do you add all the description files to the config in each iteration?

config.addLanguageRefSetFiles(languageRefSetFile);

final SnomedRefSetNameCollector provider = new SnomedRefSetNameCollector(config, new NullProgressMonitor(), "");

try {
provider.parse(config.toURL(config.getLanguageRefSetFile()));
for (File langFile : config.getLanguageRefSetFiles()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

You are already iterating through the available language refset files in the outer for loop, I don't think this is necessary here.

provider.parse(config.toURL(langFile));
}
} catch (final IOException e) {
interpreter.println(e);
return;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@
import com.b2international.snowowl.snomed.importer.net4j.SnomedImportResult;
import com.b2international.snowowl.snomed.importer.net4j.SnomedValidationDefect;
import com.b2international.snowowl.snomed.importer.rf2.util.ImportUtil;
import com.google.common.collect.ImmutableList;
import com.google.common.io.Files;

/**
Expand Down Expand Up @@ -92,12 +93,12 @@ protected void indicating(final ExtendedDataInputStream in, final OMMonitor moni
receivedFilesDirectory.deleteOnExit();

readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setConceptsFile(f); }}, monitor.fork());
readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setDescriptionsFile(f); }}, monitor.fork());
readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setDescriptionsFiles(ImmutableList.of(f)); }}, monitor.fork());
readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setTextDefinitionFile(f); }}, monitor.fork());
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not going to work like this, see how refset URLs or excluded refset ids are sent over the wire.

readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setRelationshipsFile(f); }}, monitor.fork());
readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setStatedRelationshipsFile(f); }}, monitor.fork());
readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setDescriptionType(f); }}, monitor.fork());
readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setLanguageRefSetFile(f); }}, monitor.fork());
readComponent(in, importConfiguration, receivedFilesDirectory, new FileCallback() { @Override public void setFile(final File f) { importConfiguration.setLanguageRefSetFiles(ImmutableList.of(f)); }}, monitor.fork());

final int refSetUrlCount = in.readInt();

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,7 @@
import java.lang.reflect.InvocationTargetException;
import java.net.URL;
import java.text.MessageFormat;
import java.util.ArrayList;
import java.util.Arrays;
import java.util.Collection;
import java.util.Collections;
Expand Down Expand Up @@ -206,9 +207,9 @@ private SnomedImportResult doImport(
// read and copy entries to temporary files
try (final ZipFile archive = new ZipFile(releaseArchive)) {
config.setConceptsFile(createTemporaryFile(tempDir, archive, archiveFileSet.getFileName(zipFiles, CONCEPT, contentSubType)));
config.setDescriptionsFile(createTemporaryFile(tempDir, archive, archiveFileSet.getFileName(zipFiles, DESCRIPTION, contentSubType)));
config.setDescriptionsFiles(createTemporaryFile(tempDir, archive, archiveFileSet.getAllFileName(zipFiles, DESCRIPTION, contentSubType)));
config.setRelationshipsFile(createTemporaryFile(tempDir, archive, archiveFileSet.getFileName(zipFiles, RELATIONSHIP, contentSubType)));
config.setLanguageRefSetFile(createTemporaryFile(tempDir, archive, archiveFileSet.getFileName(zipFiles, LANGUAGE_REFERENCE_SET, contentSubType)));
config.setLanguageRefSetFiles(createTemporaryFile(tempDir, archive, archiveFileSet.getAllFileName(zipFiles, LANGUAGE_REFERENCE_SET, contentSubType)));

// These paths might turn out to be empty
config.setStatedRelationshipsFile(createTemporaryFile(tempDir, archive, archiveFileSet.getFileName(zipFiles, STATED_RELATIONSHIP, contentSubType)));
Expand All @@ -233,6 +234,18 @@ public InputStream openStream() throws IOException {
}
return new File("");
}

private Collection<File> createTemporaryFile(final File tmpDir, final ZipFile archive, final Collection<String> entryPaths) throws IOException {
if (!entryPaths.isEmpty()) {
final Collection<File> files = new ArrayList<File>();
for (String entryPath : entryPaths) {
files.add(createTemporaryFile(tmpDir, archive, entryPath));
}
return files;
}
return Collections.emptySet();

}

private RepositoryState loadRepositoryState(RevisionSearcher searcher) throws IOException {
final LongCollection conceptIds = getConceptIds(searcher);
Expand Down Expand Up @@ -337,10 +350,14 @@ public RepositoryState execute(RevisionSearcher searcher) throws IOException {
final URL url = configuration.toURL(configuration.getConceptsFile());
importers.add(new SnomedConceptImporter(context, url.openStream(), configuration.getMappedName(url.getPath())));
}

if (ImportConfiguration.isValidReleaseFile(configuration.getDescriptionsFile())) {
final URL url = configuration.toURL(configuration.getDescriptionsFile());
importers.add(new SnomedDescriptionImporter(context, url.openStream(), configuration.getMappedName(url.getPath()), ComponentImportType.DESCRIPTION));

if (!configuration.getDescriptionsFiles().isEmpty()) {
for (File descriptionFile : configuration.getDescriptionsFiles()) {
if (ImportConfiguration.isValidReleaseFile(descriptionFile)) {
final URL url = configuration.toURL(descriptionFile);
importers.add(new SnomedDescriptionImporter(context, url.openStream(), configuration.getMappedName(url.getPath()), ComponentImportType.DESCRIPTION));
}
}
}

if (ImportConfiguration.isValidReleaseFile(configuration.getTextDefinitionFile())) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,9 +67,10 @@ public static Set<URL> collectUrlFromRelease(final ImportConfiguration configura
// Add reference set URLs from the first wizard page in case they're not present
try {

if (null != configuration.getLanguageRefSetFile()) {
collectedUrlSet.add(configuration.toURL(configuration.getLanguageRefSetFile()));
for (File langFiles : configuration.getLanguageRefSetFiles()) {
collectedUrlSet.add(configuration.toURL(langFiles));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line


if (null != configuration.getDescriptionType()) {
collectedUrlSet.add(configuration.toURL(configuration.getDescriptionType()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -131,7 +131,7 @@ private void parseFilesAndTerminology(URL refSetURL) {
}

// Step 2: Get descriptions for reference set IDs using the description file (if present)
if (configuration.getDescriptionsFile() != null) {
if (!configuration.getDescriptionsFiles().isEmpty()) {
readDescriptionFile(unlabeledRefSetIds, convertedMonitor.newChild(1));
}

Expand Down Expand Up @@ -173,11 +173,15 @@ public void handleRecord(int recordCount, List<String> record) {
subMonitor.setWorkRemaining(LARGE_WORK_REMAINING);
}
};

URL url = configuration.toURL(configuration.getDescriptionsFile());
descriptionReader = new InputStreamReader(url.openStream());
CsvParser parser = new CsvParser(descriptionReader, getFileName(url), CSV_SETTINGS, descriptionParserCallback, DESCRIPTION_FIELD_COUNT);
parser.parse();
if (!configuration.getDescriptionsFiles().isEmpty()) {
for(File descFile : configuration.getDescriptionsFiles()) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

missing space

URL url = configuration.toURL(descFile);
descriptionReader = new InputStreamReader(url.openStream());
CsvParser parser = new CsvParser(descriptionReader, getFileName(url), CSV_SETTINGS, descriptionParserCallback, DESCRIPTION_FIELD_COUNT);
parser.parse();

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line

}
}
} catch (IOException e) {
e.printStackTrace();
} finally {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -137,8 +137,10 @@ private void addReleaseFilesForValidating() throws IOException {
releaseFileValidators.add(new SnomedConceptValidator(configuration, this));
}

if (isValidReleaseFile(configuration.getDescriptionsFile())) {
releaseFileValidators.add(new SnomedDescriptionValidator(configuration, this, configuration.getDescriptionsFile()));
for (File descFile : configuration.getDescriptionsFiles()) {
if (isValidReleaseFile(descFile)) {
releaseFileValidators.add(new SnomedDescriptionValidator(configuration, this, descFile));
}
}

if (isValidReleaseFile(configuration.getTextDefinitionFile())) {
Expand All @@ -162,9 +164,12 @@ private void addRefSetFilesForValidating() throws IOException {

//if the reference file URL set does not contain a language validator yet, specify one
if (!Iterables.any(releaseFileValidators, Predicates.instanceOf(SnomedLanguageRefSetValidator.class))) {

if (isValidReleaseFile(configuration.getLanguageRefSetFile())) {
releaseFileValidators.add(new SnomedLanguageRefSetValidator(configuration, configuration.toURL(configuration.getLanguageRefSetFile()), this));
Collection<File> languageRefSetFiles = configuration.getLanguageRefSetFiles();
for (File langFile : languageRefSetFiles) {
if (isValidReleaseFile(langFile)) {
releaseFileValidators.add(new SnomedLanguageRefSetValidator(configuration, configuration.toURL(langFile), this));
}

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Extra line

}

}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,16 @@
import java.io.File;
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I get the following exception when I open the import wizard in the client (server-client mode):
java.lang.IllegalArgumentException: Could not find property with name descriptionsFile in class class com.b2international.snowowl.snomed.importer.net4j.ImportConfiguration at org.eclipse.core.internal.databinding.beans.BeanPropertyHelper.getPropertyDescriptor(BeanPropertyHelper.java:168) at org.eclipse.core.databinding.beans.PojoProperties.value(PojoProperties.java:119) at org.eclipse.core.databinding.beans.PojoProperties.value(PojoProperties.java:89) at org.eclipse.core.databinding.beans.PojoObservables.observeValue(PojoObservables.java:76) at org.eclipse.core.databinding.beans.PojoObservables.observeValue(PojoObservables.java:56) at com.b2international.snowowl.snomed.importer.ui.wizard.page.ImportDetailsWizardPage.bindTextField(ImportDetailsWizardPage.java:319) at com.b2international.snowowl.snomed.importer.ui.wizard.page.ImportDetailsWizardPage.initDataBinding(ImportDetailsWizardPage.java:236) at com.b2international.snowowl.snomed.importer.ui.wizard.page.AbstractImportWizardPage.createControl(AbstractImportWizardPage.java:67)

import java.io.IOException;
import java.net.URL;
import java.util.Collection;
import java.util.Collections;
import java.util.Map;
import java.util.Set;

import org.eclipse.core.runtime.IPath;
import org.eclipse.core.runtime.Path;

import com.b2international.commons.ZipURLHandler;
import com.b2international.commons.collections.Collections3;
import com.b2international.snowowl.snomed.common.ContentSubType;
import com.b2international.snowowl.snomed.importer.release.ReleaseFileSet;
import com.google.common.collect.Maps;
Expand Down Expand Up @@ -58,10 +61,10 @@ public enum ImportSourceKind {
private File archiveFile;
private File rootFile;
private File conceptsFile;
private File descriptionsFile;
private Collection<File> descriptionsFiles = Collections.emptySet();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the initialization of this collection

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks to this the collection will be initialized still as immutable.

private File relationshipsFile;
private File statedRelationshipsFile;
private File languageRefSetFile;
private Collection<File> languageRefSetFiles = Collections.emptySet();
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please fix the initialization of this collection

private File descriptionType;
private File textDefinitionFile;

Expand Down Expand Up @@ -115,14 +118,14 @@ public void setConceptsFile(final File conceptsFile) {
this.conceptsFile = conceptsFile;
}

public File getDescriptionsFile() {
return descriptionsFile;
public Collection<File> getDescriptionsFiles() {
return descriptionsFiles;
}

public void setDescriptionsFile(final File descriptionsFile) {
this.descriptionsFile = descriptionsFile;
public void setDescriptionsFiles(final Collection<File> descriptionsFiles) {
this.descriptionsFiles = Collections3.toImmutableSet(descriptionsFiles);
}

public File getRelationshipsFile() {
return relationshipsFile;
}
Expand All @@ -131,14 +134,18 @@ public void setRelationshipsFile(final File relationshipsFile) {
this.relationshipsFile = relationshipsFile;
}

public File getLanguageRefSetFile() {
return languageRefSetFile;
public Collection<File> getLanguageRefSetFiles() {
return languageRefSetFiles;
}

public void setLanguageRefSetFile(final File languageRefSetFile) {
this.languageRefSetFile = languageRefSetFile;
public void setLanguageRefSetFiles(final Collection<File> languageRefSetFiles) {
this.languageRefSetFiles = Collections3.toImmutableSet(languageRefSetFiles);
}


public void addLanguageRefSetFiles(final File languageRefSetFile) {
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If I would like to add one language refset file to a collection why the method name addLanguageRefSetFile_s_?

this.languageRefSetFiles.add(languageRefSetFile);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

What happens if I call this add method right after I called setLanguageRefSetFiles(Collection files) ????

}

public ImportSourceKind getSourceKind() {
return sourceKind;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,6 +20,7 @@
import java.io.IOException;
import java.io.InputStream;
import java.net.URL;
import java.util.Collection;

import org.eclipse.net4j.signal.RequestWithMonitoring;
import org.eclipse.net4j.util.io.ExtendedDataInputStream;
Expand Down Expand Up @@ -69,16 +70,23 @@ protected void requesting(final ExtendedDataOutputStream out, final OMMonitor mo
}

out.writeUTF(importConfiguration.getCodeSystemShortName());

final Collection<File> descriptionsFiles = importConfiguration.getDescriptionsFiles();
final Collection<File> languageRefSetFiles = importConfiguration.getLanguageRefSetFiles();
monitor.worked(); // 1
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why is this here? Have you checked how the monitor's work is calculated here?


for (File descfile : descriptionsFiles) {
writeComponent(out, descfile, monitor);
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This is not going to work like this, see how refset URLs or excluded refset ids are sent over the wire.

}

for (File langFile : languageRefSetFiles) {
writeComponent(out, langFile, monitor.fork()); // + 7
}

writeComponent(out, importConfiguration.getConceptsFile(), monitor.fork());
writeComponent(out, importConfiguration.getDescriptionsFile(), monitor.fork());
writeComponent(out, importConfiguration.getTextDefinitionFile(), monitor.fork());
writeComponent(out, importConfiguration.getRelationshipsFile(), monitor.fork());
writeComponent(out, importConfiguration.getStatedRelationshipsFile(), monitor.fork());
writeComponent(out, importConfiguration.getDescriptionType(), monitor.fork());
writeComponent(out, importConfiguration.getLanguageRefSetFile(), monitor.fork()); // + 7
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

That comment is a clue!


out.writeInt(importConfiguration.getRefSetUrls().size());

Expand Down