public static XmlDocument GetConvertedMetadata(long datasetId, TransmissionType type, string mappingName, bool storing = true)
{
XmlDocument newXml;
try
{
DatasetManager datasetManager = new DatasetManager();
DatasetVersion datasetVersion = datasetManager.GetDatasetLatestVersion(datasetId);
string mappingFileName = XmlDatasetHelper.GetTransmissionInformation(datasetVersion, type, mappingName);
string pathMappingFile = Path.Combine(AppConfiguration.GetModuleWorkspacePath("DIM"), mappingFileName);
XmlMapperManager xmlMapperManager = new XmlMapperManager(TransactionDirection.InternToExtern);
xmlMapperManager.Load(pathMappingFile, "exporttest");
newXml = xmlMapperManager.Export(datasetVersion.Metadata, datasetVersion.Id, mappingName, true);
string title = XmlDatasetHelper.GetInformation(datasetVersion, NameAttributeValues.title);
// store in content descriptor
if (storing)
{
if(String.IsNullOrEmpty(mappingName) || mappingName.ToLower() == "generic")
storeGeneratedFilePathToContentDiscriptor(datasetId, datasetVersion, "metadata", ".xml");
else
storeGeneratedFilePathToContentDiscriptor(datasetId, datasetVersion, "metadata_"+ mappingName, ".xml");
}
}
catch (Exception ex)
{
throw ex;
}
return newXml;
}