Skip to content
Snippets Groups Projects
Commit 3e6b33e7 authored by izabel's avatar izabel
Browse files

[LMS-1373] group -> space (yeastx; group still accepted)

SVN: 14919
parent 9912155d
No related merge requests found
......@@ -58,7 +58,7 @@ public class BatchDataSetInfoExtractor implements IDataSetInfoExtractor
info.setComplete(true);
info.setDataSetProperties(plainInfo.getProperties());
setSampleOrExperiment(openbisService, log, plainInfo, info);
info.setGroupCode(plainInfo.getGroupCode());
info.setGroupCode(plainInfo.getSpaceOrGroupCode());
MLConversionType conversion = getConversion(plainInfo.getConversion());
info.setConversion(conversion);
String parentDataSetCodes = plainInfo.getParentDataSetCodes();
......
......@@ -49,6 +49,8 @@ public class DataSetMappingInformation
private List<NewProperty> properties;
private String spaceCode;
public String getFileName()
{
return fileName;
......@@ -107,15 +109,32 @@ public class DataSetMappingInformation
this.projectCode = StringUtils.trimToNull(projectCode);
}
// TODO 2010-02-23, IA: migrate to getSpaceCode after transition period (group->space)
public String getSpaceOrGroupCode()
{
return spaceCode == null ? groupCode : spaceCode;
}
public String getGroupCode()
{
return groupCode;
}
@BeanProperty(label = "group")
@BeanProperty(label = "group", optional = true)
public void setGroupCode(String groupCode)
{
this.groupCode = groupCode;
this.groupCode = StringUtils.trimToNull(groupCode);
}
public String getSpaceCode()
{
return spaceCode;
}
@BeanProperty(label = "space", optional = true)
public void setSpaceCode(String spaceCode)
{
this.spaceCode = StringUtils.trimToNull(spaceCode);
}
public String getConversion()
......
......@@ -180,7 +180,7 @@ class DatasetMappingResolver
tryGetExperimentIdentifier(mapping, experimentPropertyCodeOrNull);
ListSamplesByPropertyCriteria criteria =
new ListSamplesByPropertyCriteria(samplePropertyCodeOrNull, sampleCodeOrLabel,
mapping.getGroupCode(), experimentIdentifier);
mapping.getSpaceOrGroupCode(), experimentIdentifier);
return criteria;
}
......@@ -207,6 +207,23 @@ class DatasetMappingResolver
public boolean isMappingCorrect(DataSetMappingInformation mapping, LogUtils log)
{
if (mapping.getSpaceOrGroupCode() == null)
{
log
.datasetMappingError(
mapping,
"mandatory property 'space' (previously called 'group') not specified. "
+ "Note: the name 'group' may still be used but will be forbidden in the future.");
return false;
} else if (mapping.getSpaceCode() != null && mapping.getGroupCode() != null)
{
log
.datasetMappingError(
mapping,
"either 'space' or 'group' should be specified - but not both. "
+ "Note: the name 'group' may still be used but will be forbidden in the future.");
return false;
}
if (isExperimentColumnCorrect(mapping, log) == false)
{
return false;
......@@ -277,7 +294,8 @@ class DatasetMappingResolver
String experimentCode = mapping.getExperimentName();
if (project != null && experimentCode != null)
{
return new ExperimentIdentifier(null, mapping.getGroupCode(), project, experimentCode);
return new ExperimentIdentifier(null, mapping.getSpaceOrGroupCode(), project,
experimentCode);
} else
{
return null;
......@@ -350,8 +368,8 @@ class DatasetMappingResolver
private SampleIdentifier createSampleIdentifier(String sampleCode,
DataSetMappingInformation mapping)
{
return new SampleIdentifier(new GroupIdentifier((String) null, mapping.getGroupCode()),
sampleCode);
return new SampleIdentifier(new GroupIdentifier((String) null, mapping
.getSpaceOrGroupCode()), sampleCode);
}
private boolean isExperimentColumnCorrect(DataSetMappingInformation mapping, LogUtils log)
......
......@@ -53,7 +53,7 @@ public class DataSetInformationParserTest extends AbstractFileSystemTestCase
List<DataSetMappingInformation> list = tryParse(indexFile);
AssertJUnit.assertEquals(1, list.size());
DataSetMappingInformation elem = list.get(0);
AssertJUnit.assertEquals("group1", elem.getGroupCode());
AssertJUnit.assertEquals("group1", elem.getSpaceOrGroupCode());
AssertJUnit.assertEquals("parentCode", elem.getParentDataSetCodes());
AssertJUnit.assertEquals("sample1", elem.getSampleCodeOrLabel());
AssertJUnit.assertEquals("data.txt", elem.getFileName());
......@@ -72,7 +72,7 @@ public class DataSetInformationParserTest extends AbstractFileSystemTestCase
List<DataSetMappingInformation> list = tryParse(indexFile);
AssertJUnit.assertEquals(1, list.size());
DataSetMappingInformation elem = list.get(0);
AssertJUnit.assertEquals("group2", elem.getGroupCode());
AssertJUnit.assertEquals("group2", elem.getSpaceOrGroupCode());
AssertJUnit.assertEquals("sample2", elem.getSampleCodeOrLabel());
AssertJUnit.assertEquals("data2.txt", elem.getFileName());
}
......@@ -99,8 +99,8 @@ public class DataSetInformationParserTest extends AbstractFileSystemTestCase
AssertJUnit.assertNull("error during parsing expected", result);
List<String> logLines = readLogFile();
AssertJUnit.assertEquals(2, logLines.size());
AssertionUtil.assertContains("Mandatory column(s) 'group', 'file_name' are missing",
logLines.get(1));
AssertionUtil
.assertContains("Mandatory column(s) 'file_name' are missing", logLines.get(1));
}
private List<DataSetMappingInformation> tryParse(File indexFile)
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment