Skip to content
Snippets Groups Projects
Commit a8fc1c7d authored by gakin's avatar gakin
Browse files

SSDM-4594 : OpenbisSync - retrieve file format types

SVN: 37646
parent dfeeb1ad
No related branches found
No related tags found
No related merge requests found
...@@ -51,6 +51,7 @@ import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.DataType; ...@@ -51,6 +51,7 @@ import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.DataType;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IDataSetTypeImmutable; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IDataSetTypeImmutable;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IEntityType; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IEntityType;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IExperimentTypeImmutable; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IExperimentTypeImmutable;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IFileFormatTypeImmutable;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IMasterDataRegistrationTransaction; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IMasterDataRegistrationTransaction;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IMaterialTypeImmutable; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IMaterialTypeImmutable;
import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IPropertyTypeImmutable; import ch.systemsx.cisd.openbis.generic.server.jython.api.v1.IPropertyTypeImmutable;
...@@ -93,6 +94,10 @@ public class MasterDataExtractor ...@@ -93,6 +94,10 @@ public class MasterDataExtractor
Element rootElement = doc.createElement("masterData"); Element rootElement = doc.createElement("masterData");
doc.appendChild(rootElement); doc.appendChild(rootElement);
// append file format types
List<IFileFormatTypeImmutable> fileFormatTypes = masterDataRegistrationTransaction.listFileFormatTypes();
appendFileFormatTypes(doc, rootElement, fileFormatTypes);
// append vocabularies // append vocabularies
List<IVocabularyImmutable> vocabularies = masterDataRegistrationTransaction.listVocabularies(); List<IVocabularyImmutable> vocabularies = masterDataRegistrationTransaction.listVocabularies();
appendVocabularies(doc, rootElement, vocabularies); appendVocabularies(doc, rootElement, vocabularies);
...@@ -126,6 +131,22 @@ public class MasterDataExtractor ...@@ -126,6 +131,22 @@ public class MasterDataExtractor
return writer.toString(); return writer.toString();
} }
private void appendFileFormatTypes(Document doc, Element rootElement, List<IFileFormatTypeImmutable> fileFormatTypes)
{
if (fileFormatTypes.size() > 0)
{
Element fileFormatTypesElement = doc.createElement("fileFormatTypes");
rootElement.appendChild(fileFormatTypesElement);
for (IFileFormatTypeImmutable fileFormatType : fileFormatTypes)
{
Element fileFormatTypeElement = doc.createElement("fileFormatType");
fileFormatTypeElement.setAttribute("code", fileFormatType.getCode());
fileFormatTypeElement.setAttribute("description", fileFormatType.getCode());
fileFormatTypesElement.appendChild(fileFormatTypeElement);
}
}
}
private void appendPropertyTypes(Document doc, Element rootElement, List<IPropertyTypeImmutable> propertyTypes) private void appendPropertyTypes(Document doc, Element rootElement, List<IPropertyTypeImmutable> propertyTypes)
{ {
if (propertyTypes.size() > 0) if (propertyTypes.size() > 0)
...@@ -302,9 +323,8 @@ public class MasterDataExtractor ...@@ -302,9 +323,8 @@ public class MasterDataExtractor
{ {
Element propertyAssignmentElement = doc.createElement("propertyAssignment"); Element propertyAssignmentElement = doc.createElement("propertyAssignment");
propertyAssignmentsElement.appendChild(propertyAssignmentElement); propertyAssignmentsElement.appendChild(propertyAssignmentElement);
propertyAssignmentElement.setAttribute("property_type_code", CodeConverter.tryToBusinessLayer(propAssignment.getPropertyType().getCode(), propertyAssignmentElement.setAttribute("propertyTypeCode", CodeConverter.tryToBusinessLayer(propAssignment.getPropertyType().getCode(),
propAssignment.getPropertyType().isInternalNameSpace())); propAssignment.getPropertyType().isInternalNameSpace()));
// propertyAssigmentElement.setAttribute("data_type_code", propAssignment.getPropertyType().getDataType().toString());
propertyAssignmentElement.setAttribute("ordinal", String.valueOf(propAssignment.getOrdinal())); propertyAssignmentElement.setAttribute("ordinal", String.valueOf(propAssignment.getOrdinal()));
propertyAssignmentElement.setAttribute("section", propAssignment.getSection()); propertyAssignmentElement.setAttribute("section", propAssignment.getSection());
propertyAssignmentElement.setAttribute("showInEdit", String.valueOf(propAssignment.isShowInEditView())); propertyAssignmentElement.setAttribute("showInEdit", String.valueOf(propAssignment.isShowInEditView()));
...@@ -314,13 +334,6 @@ public class MasterDataExtractor ...@@ -314,13 +334,6 @@ public class MasterDataExtractor
return propertyAssignmentsElement; return propertyAssignmentsElement;
} }
// @XmlRootElement
// @XmlAccessorType(XmlAccessType.FIELD)
private static class MasterData
{
// @XmlElement(name = "sampleType")
}
private Map<String, List<PropertyAssignment>> loadDataSetTypesUsingV3WithPropertyAssignments() private Map<String, List<PropertyAssignment>> loadDataSetTypesUsingV3WithPropertyAssignments()
{ {
// We are mixing up v1 and v3 here because using v3 api to get property assignments is easier // We are mixing up v1 and v3 here because using v3 api to get property assignments is easier
......
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