public static POCO.OntologyMatchStatus GetOntologyMatchStatus(DataConfig providerConfig, RecordToRecordAssociation recassoc, OntologyAssigned ontology) { POCO.OntologyMatchStatus matchStatus = null; // Create a filter to match the Ontology provided List <Filter> filters = new List <Filter>(); Filter pkFilter = new Filter("PartitionKey", ontology.RowKey, "eq"); filters.Add(pkFilter); Filter rkFilter = new Filter("RowKey", recassoc.RowKey, "eq"); filters.Add(rkFilter); switch (providerConfig.ProviderType) { case "azure.tableservice": string combinedFilter = Utils.GenerateAzureFilter(filters); List <AzureOntologyMatchStatus> azs = new List <AzureOntologyMatchStatus>(); AzureTableAdaptor <AzureOntologyMatchStatus> az = new AzureTableAdaptor <AzureOntologyMatchStatus>(); azs = az.ReadTableData(providerConfig, AzureTableNames.OntologyMatchStatus, combinedFilter); if (azs.Count > 0) { matchStatus = azs[0].Value; } return(matchStatus); case "internal.mongodb": var collection = Utils.GetMongoCollection <MongoOntologyMatchStatus>(providerConfig, MongoTableNames.OntologyMatchStatus); FilterDefinition <MongoOntologyMatchStatus> filter = Utils.GenerateMongoFilter <MongoOntologyMatchStatus>(filters); var documents = collection.Find(filter).ToList(); if (documents.Count > 0) { matchStatus = documents[0]; } break; default: throw new ApplicationException("Data provider not recognised: " + providerConfig.ProviderType); } return(matchStatus); }
public static string GetMIMEType(DataConfig providerConfig, POCO.System system, POCO.Record record, RecordToRecordAssociation recordAssocEntity, ILogger logger) { string mimeType = string.Empty; List <DataFactory.Filter> filters = new List <Filter>(); DataFactory.Filter pkFilter = new Filter("PartitionKey", recordAssocEntity.RowKey, "eq"); filters.Add(pkFilter); //DataFactory.Filter rkFilter = new Filter("RowKey", , "eq"); //filters.Add(rkFilter); string nextPageId = string.Empty; string tableName = string.Empty; // Check which System the file is from switch (system.Type) { case SystemType.SharePoint2010: switch (providerConfig.ProviderType) { case "azure.tableservice": tableName = TableNames.Azure.SharePoint.SPFile; break; case "internal.mongodb": tableName = TableNames.Mongo.SharePoint.SPFile; break; } break; case SystemType.SharePoint2013: switch (providerConfig.ProviderType) { case "azure.tableservice": tableName = TableNames.Azure.SharePoint.SPFile; break; case "internal.mongodb": tableName = TableNames.Mongo.SharePoint.SPFile; break; } break; case SystemType.SharePointOnline: case SystemType.SharePointOneDrive: case SystemType.SharePointTeam: switch (providerConfig.ProviderType) { case "azure.tableservice": tableName = TableNames.Azure.SharePointOnline.SPFile; break; case "internal.mongodb": tableName = TableNames.Mongo.SharePointOnline.SPFile; break; } break; case SystemType.NTFSShare: switch (providerConfig.ProviderType) { case "azure.tableservice": tableName = TableNames.Azure.NTFS.NTFSFiles; break; case "internal.mongodb": tableName = TableNames.Mongo.NTFS.NTFSFiles; break; } break; case SystemType.SakaiAlliance: switch (providerConfig.ProviderType) { case "azure.tableservice": tableName = TableNames.Azure.Sakai.SakaiFiles; break; case "internal.mongodb": tableName = TableNames.Mongo.Sakai.SakaiFiles; break; } break; default: throw new NotImplementedException(); break; } List <POCO.CPFileMIMEType> mimetypes = new List <POCO.CPFileMIMEType>(); switch (providerConfig.ProviderType) { case "azure.tableservice": string combinedFilter = Utils.GenerateAzureFilter(filters); List <AzureFileMIMEType> azdata = new List <AzureFileMIMEType>(); AzureTableAdaptor <AzureFileMIMEType> adaptor = new AzureTableAdaptor <AzureFileMIMEType>(); azdata = adaptor.ReadTableData(providerConfig, tableName, combinedFilter); foreach (var doc in azdata) { mimetypes.Add(doc.Value); } break; case "internal.mongodb": var collection = Utils.GetMongoCollection <MongoFileMIMEType>(providerConfig, tableName); FilterDefinition <MongoFileMIMEType> filter = Utils.GenerateMongoFilter <MongoFileMIMEType>(filters); var documents = collection.Find(filter).ToList(); foreach (var doc in documents) { mimetypes.Add(doc); } break; default: throw new ApplicationException("Data provider not recognised: " + providerConfig.ProviderType); } if (mimetypes.Count > 0) { mimeType = mimetypes[0].MIMEType; } return(mimeType); }