public GetDatasetLatestMetadataVersion ( System.Int64 datasetId, bool includeCheckouts = false ) : |
||
datasetId | System.Int64 | The dataset whose latest metadata version is returned. |
includeCheckouts | bool | Determines whether the method should return the metadata if the dataset is checked-out. |
return |
public ActionResult Cancel() { //public ActionResult LoadMetadata(long datasetId, bool locked = false, bool created = false, bool fromEditMode = false, bool resetTaskManager = false, XmlDocument newMetadata = null) TaskManager = (CreateTaskmanager)Session["CreateDatasetTaskmanager"]; if (TaskManager != null) { DatasetManager dm = new DatasetManager(); long datasetid = -1; bool resetTaskManager = true; XmlDocument metadata = null; bool editmode = false; bool created = false; if (TaskManager.Bus.ContainsKey(CreateTaskmanager.ENTITY_ID)) { datasetid = Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.ENTITY_ID]); } if (datasetid > -1 && dm.IsDatasetCheckedIn(datasetid)) { metadata = dm.GetDatasetLatestMetadataVersion(datasetid); editmode = true; created = true; } return RedirectToAction("LoadMetadata", "Form", new { area = "DCM", entityId = datasetid, created = created, locked = true, fromEditMode = editmode, resetTaskManager = resetTaskManager, newMetadata = metadata }); } return RedirectToAction("StartMetadataEditor", "Form"); }
public ActionResult Reset() { TaskManager = (CreateTaskmanager)Session["CreateDatasetTaskmanager"]; if (TaskManager != null) { DatasetManager dm = new DatasetManager(); long datasetid = -1; long metadataStructureid = -1; bool resetTaskManager = true; XmlDocument metadata = null; bool edit = true; bool created = false; if (TaskManager.Bus.ContainsKey(CreateTaskmanager.ENTITY_ID)) { datasetid = Convert.ToInt64(TaskManager.Bus[CreateTaskmanager.ENTITY_ID]); } if (datasetid > -1 && dm.IsDatasetCheckedIn(datasetid)) { Dataset dataset = dm.GetDataset(datasetid); metadataStructureid = dataset.MetadataStructure.Id; metadata = dm.GetDatasetLatestMetadataVersion(datasetid); TaskManager.UpdateBus(CreateTaskmanager.METADATA_XML, metadata); } return RedirectToAction("ImportMetadata", "Form", new { area = "DCM", metadataStructureId = metadataStructureid, edit, created }); } return RedirectToAction("StartMetadataEditor", "Form"); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> public void Index() { configureBexisIndexing(true); // there is no need for the metadataAccess class anymore. Talked with David and deleted. 30.18.13. Javad/ compare to the previous version to see the deletions DatasetManager dm = new DatasetManager(); IList<long> ids = dm.GetDatasetLatestIds(); //ToDo only enitities from type dataset should be indexed in this index foreach (var id in ids) { //the values in the dictionary are already xml documents or null. Javad writeBexisIndex(id, dm.GetDatasetLatestMetadataVersion(id)); } indexWriter.Optimize(); autoCompleteIndexWriter.Optimize(); if (!reIndex) { indexWriter.Dispose(); autoCompleteIndexWriter.Dispose(); } }
public void updateSingleDatasetIndex(long datasetId, IndexingAction indAction) { if (!isIndexConfigured) { this.configureBexisIndexing(false); } DatasetManager dm = new DatasetManager(); if (indAction == IndexingAction.CREATE) { Query query = new TermQuery(new Term("doc_id", datasetId.ToString())); TopDocs tds = BexisIndexSearcher.getIndexSearcher().Search(query, 1); if (tds.TotalHits < 1) { writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId)); } else { indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString())); autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString())); writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId)); } } else if (indAction == IndexingAction.DELETE) { indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString())); autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString())); } else if (indAction == IndexingAction.UPDATE) { indexWriter.DeleteDocuments(new Term("doc_id", datasetId.ToString())); autoCompleteIndexWriter.DeleteDocuments(new Term("id", datasetId.ToString())); writeBexisIndex(datasetId, dm.GetDatasetLatestMetadataVersion(datasetId)); } indexWriter.Commit(); autoCompleteIndexWriter.Commit(); BexisIndexSearcher.searcher = new IndexSearcher(indexWriter.GetReader()); BexisIndexSearcher._Reader = indexWriter.GetReader(); BexisIndexSearcher.autoCompleteSearcher = new IndexSearcher(autoCompleteIndexWriter.GetReader()); indexWriter.Dispose(); autoCompleteIndexWriter.Dispose(); }
/// <summary> /// /// </summary> /// <remarks></remarks> /// <seealso cref=""/> public void updateIndex(Dictionary<long, IndexingAction> datasetsToIndex) { if (!isIndexConfigured) { this.configureBexisIndexing(false); } foreach (KeyValuePair<long, IndexingAction> pair in datasetsToIndex) { DatasetManager dm = new DatasetManager(); if (pair.Value == IndexingAction.CREATE) { Query query = new TermQuery(new Term("doc_id", pair.Key.ToString())); TopDocs tds = BexisIndexSearcher.getIndexSearcher().Search(query, 1); if (tds.TotalHits < 1) { writeBexisIndex(pair.Key, dm.GetDatasetLatestMetadataVersion(pair.Key)); } else { indexWriter.DeleteDocuments(new Term("doc_id", pair.Key.ToString())); autoCompleteIndexWriter.DeleteDocuments(new Term("id", pair.Key.ToString())); writeBexisIndex(pair.Key, dm.GetDatasetLatestMetadataVersion(pair.Key)); } } else if (pair.Value == IndexingAction.DELETE) { indexWriter.DeleteDocuments(new Term("doc_id", pair.Key.ToString())); autoCompleteIndexWriter.DeleteDocuments(new Term("id", pair.Key.ToString())); } else if (pair.Value == IndexingAction.UPDATE) { indexWriter.DeleteDocuments(new Term("doc_id", pair.Key.ToString())); autoCompleteIndexWriter.DeleteDocuments(new Term("id", pair.Key.ToString())); writeBexisIndex(pair.Key, dm.GetDatasetLatestMetadataVersion(pair.Key)); } } indexWriter.Commit(); autoCompleteIndexWriter.Commit(); BexisIndexSearcher.searcher = new IndexSearcher(indexWriter.GetReader()); BexisIndexSearcher._Reader = indexWriter.GetReader(); BexisIndexSearcher.autoCompleteSearcher = new IndexSearcher(autoCompleteIndexWriter.GetReader()); autoCompleteIndexWriter.Dispose(); indexWriter.Dispose(); BexisIndexSearcher.searcher = new IndexSearcher(indexWriter.GetReader()); BexisIndexSearcher.autoCompleteSearcher = new IndexSearcher(autoCompleteIndexWriter.GetReader()); }
public StructuredDataStructure GetDataStructureByID(long ID) { DataStructureManager dsm = new DataStructureManager(); StructuredDataStructure structuredDataStructure = dsm.StructuredDataStructureRepo.Get(ID); this.dataStructure = structuredDataStructure; if (this.dataStructure != null) { this.variables = getOrderedVariables(structuredDataStructure); if (this.dataStructure.Datasets == null) { inUse = false; } else { if (this.dataStructure.Datasets.Count > 0) { inUse = true; DatasetListElement datasetListElement = new DatasetListElement(); DatasetManager dm = new DatasetManager(); foreach (Dataset d in structuredDataStructure.Datasets) { if (dm.GetDatasetLatestMetadataVersion(d.Id) != null) datasetListElement = new DatasetListElement(d.Id, XmlDatasetHelper.GetInformation(d, AttributeNames.title)); else datasetListElement = new DatasetListElement(0, ""); datasets.Add(datasetListElement); } } else { inUse = false; } } this.BuildDataTable(); return (structuredDataStructure); } else { this.dataStructure = new StructuredDataStructure(); return (structuredDataStructure); } }