Skip to content
Snippets Groups Projects
Commit 1d36a266 authored by vkovtun's avatar vkovtun
Browse files

SSDM-13256: Added missing columns for data set types.

parent c96c1d14
No related branches found
No related tags found
1 merge request!40SSDM-13578 : 2PT : Database and V3 Implementation - include the new AFS "free"...
...@@ -17,6 +17,10 @@ package ch.ethz.sis.openbis.generic.server.xls.export.helper; ...@@ -17,6 +17,10 @@ package ch.ethz.sis.openbis.generic.server.xls.export.helper;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.CODE; import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.CODE;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.DESCRIPTION; import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.DESCRIPTION;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.DISALLOW_DELETION;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.MAIN_DATA_SET_PATH;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.MAIN_DATA_SET_PATTERN;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.MODIFICATION_DATE;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.VALIDATION_SCRIPT; import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.VALIDATION_SCRIPT;
import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.VERSION; import static ch.ethz.sis.openbis.generic.server.xls.export.Attribute.VERSION;
...@@ -70,7 +74,8 @@ public class XLSDataSetTypeExportHelper extends AbstractXLSEntityTypeExportHelpe ...@@ -70,7 +74,8 @@ public class XLSDataSetTypeExportHelper extends AbstractXLSEntityTypeExportHelpe
@Override @Override
protected Attribute[] getAttributes(final DataSetType entityType) protected Attribute[] getAttributes(final DataSetType entityType)
{ {
return new Attribute[] { VERSION, CODE, DESCRIPTION, VALIDATION_SCRIPT }; return new Attribute[] { VERSION, CODE, DESCRIPTION, VALIDATION_SCRIPT, MAIN_DATA_SET_PATTERN, MAIN_DATA_SET_PATH, DISALLOW_DELETION,
MODIFICATION_DATE };
} }
@Override @Override
...@@ -78,6 +83,10 @@ public class XLSDataSetTypeExportHelper extends AbstractXLSEntityTypeExportHelpe ...@@ -78,6 +83,10 @@ public class XLSDataSetTypeExportHelper extends AbstractXLSEntityTypeExportHelpe
{ {
switch (attribute) switch (attribute)
{ {
case VERSION:
{
return String.valueOf(VersionUtils.getStoredVersion(allVersions, ImportTypes.DATASET_TYPE, null, dataSetType.getCode()));
}
case CODE: case CODE:
{ {
return dataSetType.getCode(); return dataSetType.getCode();
...@@ -92,9 +101,21 @@ public class XLSDataSetTypeExportHelper extends AbstractXLSEntityTypeExportHelpe ...@@ -92,9 +101,21 @@ public class XLSDataSetTypeExportHelper extends AbstractXLSEntityTypeExportHelpe
return validationPlugin != null ? (validationPlugin.getName() != null ? validationPlugin.getName() + ".py" : "") : ""; return validationPlugin != null ? (validationPlugin.getName() != null ? validationPlugin.getName() + ".py" : "") : "";
} }
case VERSION: case MAIN_DATA_SET_PATTERN:
{ {
return String.valueOf(VersionUtils.getStoredVersion(allVersions, ImportTypes.DATASET_TYPE, null, dataSetType.getCode())); return dataSetType.getMainDataSetPattern();
}
case MAIN_DATA_SET_PATH:
{
return dataSetType.getMainDataSetPath();
}
case DISALLOW_DELETION:
{
return dataSetType.isDisallowDeletion().toString().toUpperCase();
}
case MODIFICATION_DATE:
{
return DATE_FORMAT.format(dataSetType.getModificationDate());
} }
default: default:
{ {
......
...@@ -16,7 +16,9 @@ ...@@ -16,7 +16,9 @@
package ch.ethz.sis.openbis.generic.server.xls.export; package ch.ethz.sis.openbis.generic.server.xls.export;
import java.util.Arrays; import java.util.Arrays;
import java.util.Calendar;
import java.util.Collections; import java.util.Collections;
import java.util.Date;
import java.util.List; import java.util.List;
import org.jmock.Expectations; import org.jmock.Expectations;
...@@ -38,6 +40,11 @@ class DataSetTypeExpectations extends Expectations ...@@ -38,6 +40,11 @@ class DataSetTypeExpectations extends Expectations
public DataSetTypeExpectations(final IApplicationServerApi api, final boolean exportReferred) public DataSetTypeExpectations(final IApplicationServerApi api, final boolean exportReferred)
{ {
final Calendar calendar = Calendar.getInstance();
calendar.set(2023, Calendar.MARCH, 10, 17, 23, 44);
final Date modificationDate = calendar.getTime();
allowing(api).getDataSetTypes(with(XLSExportTest.SESSION_TOKEN), with(new CollectionMatcher<>( allowing(api).getDataSetTypes(with(XLSExportTest.SESSION_TOKEN), with(new CollectionMatcher<>(
Collections.singletonList( Collections.singletonList(
new EntityTypePermId("ATTACHMENT", EntityKind.DATA_SET)))), new EntityTypePermId("ATTACHMENT", EntityKind.DATA_SET)))),
...@@ -58,6 +65,10 @@ class DataSetTypeExpectations extends Expectations ...@@ -58,6 +65,10 @@ class DataSetTypeExpectations extends Expectations
dataSetType.setCode("ATTACHMENT"); dataSetType.setCode("ATTACHMENT");
dataSetType.setDescription("Attachment"); dataSetType.setDescription("Attachment");
dataSetType.setPropertyAssignments(getPropertyAssignments(fetchOptions)); dataSetType.setPropertyAssignments(getPropertyAssignments(fetchOptions));
dataSetType.setMainDataSetPattern(".*\\.jpg");
dataSetType.setMainDataSetPath("original/images/");
dataSetType.setDisallowDeletion(false);
dataSetType.setModificationDate(modificationDate);
return Collections.singletonMap(new EntityTypePermId("ATTACHMENT"), dataSetType); return Collections.singletonMap(new EntityTypePermId("ATTACHMENT"), dataSetType);
} }
......
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