public CreateContentDescriptor ( string name, string mimeType, string uri, |
||
name | string | A friendly name for the resource, mainly used in the UI |
mimeType | string | The type of the resource. Used in the methods that transfer and/or process the resource |
uri | string | The URI of the resource, may contain protocol, access method, authorization information , etc. |
orderNo | The order of the resource in the list of all resources associated to the same dataset version. | |
datasetVersion | ||
return |
private static void storeGeneratedFilePathToContentDiscriptor(long datasetId, DatasetVersion datasetVersion, string title, string ext) { string name = ""; string mimeType = ""; if (ext.Contains("xml")) { name = "metadata"; mimeType = "text/xml"; } // create the generated FileStream and determine its location string dynamicPath = OutputDatasetManager.GetDynamicDatasetStorePath(datasetId, datasetVersion.Id, title, ext); //Register the generated data FileStream as a resource of the current dataset version //ContentDescriptor generatedDescriptor = new ContentDescriptor() //{ // OrderNo = 1, // Name = name, // MimeType = mimeType, // URI = dynamicPath, // DatasetVersion = datasetVersion, //}; DatasetManager dm = new DatasetManager(); if (datasetVersion.ContentDescriptors.Count(p => p.Name.Equals(name)) > 0) { // remove the one contentdesciptor foreach (ContentDescriptor cd in datasetVersion.ContentDescriptors) { if (cd.Name == name) { cd.URI = dynamicPath; dm.UpdateContentDescriptor(cd); } } } else { // add current contentdesciptor to list //datasetVersion.ContentDescriptors.Add(generatedDescriptor); dm.CreateContentDescriptor(name, mimeType, dynamicPath, 1, datasetVersion); } //dm.EditDatasetVersion(datasetVersion, null, null, null); }