You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
/// If the dataset is checked out and the <paramref name="rollbackCheckout"/> is
598
+
/// True, the dataset's changes will be roll-backed and then the delete operation takes place, but if the <paramref name="rollbackCheckout"/> is false,
599
+
/// The changes will be checked in as a new version and then the deletion operation is executed.
600
+
/// </summary>
601
+
/// <param name="datasetId">The identifier of the dataset to be checked-in.</param>
602
+
/// <param name="username">The username that performs the check-in, which should be the same as the check-out username.</param>
603
+
/// <param name="rollbackCheckout">Determines whether latest uncommitted changes should be rolled back or checked in before marking the dataset as deleted.</param>
604
+
/// <returns>True if the dataset is deleted, False otherwise.</returns>
/// the dataset must be in CheckedIn state to be deleted
627
+
/// so if it is checked out, the checkout version (working copy) is removed first
628
+
if(entity.Status==DatasetStatus.CheckedOut)
629
+
{
630
+
if(rollbackCheckout==true)
631
+
{
632
+
this.undoCheckout(entity.Id,username,false);// commit and behavior: create|refresh
633
+
}
634
+
else
635
+
{
636
+
thrownewException(string.Format("Dataset {0} is in check out state, which prevents it from being deleted. Rollback the changes or check them in and try again",entity.Id));
637
+
}
638
+
}
639
+
640
+
try
641
+
{
642
+
643
+
// get the latest dataset with data (a)
644
+
entity=datasetRepo.Get(entity.Id);
645
+
varversions=entity.Versions.OrderBy(v =>v.Id);
646
+
647
+
if(versions.Count()<=1)returnfalse;// can not revert if one
648
+
649
+
vartoDeletedDatasetVersion=versions.ElementAt(entity.Versions.Count-1);// select the last version to be deleted
650
+
varlastDatasetVersion=versions.ElementAt(entity.Versions.Count-2);// select the second last version to be the new last version
651
+
652
+
// get all old tuples version that go to the datatuples table
LoggerFactory.LogCustom("entity "+datasetId+" returns from last version status");
739
+
740
+
return(true);
741
+
}
742
+
catch(Exceptionex)
743
+
{
744
+
if(!IsDatasetCheckedIn(datasetId))
745
+
{
746
+
checkInDataset(entity.Id,"Checked-in after failed revert try!",username,false,ViewCreationBehavior.Create|ViewCreationBehavior.Refresh,"",TagType.None);
747
+
}
748
+
returnfalse;
749
+
}
750
+
}
751
+
}
752
+
595
753
/// <summary>
596
754
/// Physically deletes the whole dataset, including its versions and data tuples, from the database.
0 commit comments