Skip to content

Commit f13c7ed

Browse files
committed
- Replaced "Home" button with "Data Folder" link in the success view of RequestDeletionAction.
- Fixed SQLException by updating DatasetStatus handling: - Delete row in DatasetStatus when data is resubmitted and a new Panorama Public copy is created. - Delete row in DatasetStatus when the Panorama Public copy is deleted. - Prevents SQLException from shortUrl FK constraint when deleting Panorama Public copy followed by source data folder, or vice versa. - Cleanup user accounts in PrivateDataReminderTest.
1 parent ffedecd commit f13c7ed

6 files changed

Lines changed: 38 additions & 1 deletion

File tree

panoramapublic/src/org/labkey/panoramapublic/PanoramaPublicController.java

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10548,7 +10548,9 @@ public ModelAndView getSuccessView(ShortUrlForm shortUrlForm)
1054810548
setTitle("Deletion Request Success");
1054910549
return new HtmlView(DIV("A deletion request was successfully submitted for the data at " + _exptAnnotations.getShortUrl().renderShortURL(),
1055010550
BR(),
10551-
DIV(new ButtonBuilder("Home").submit(false).href(AppProps.getInstance().getHomePageActionURL()))
10551+
DIV(
10552+
LinkBuilder.labkeyLink("Data Folder", PageFlowUtil.urlProvider(ProjectUrls.class).getBeginURL(_exptAnnotations.getContainer()))
10553+
)
1055210554
));
1055310555
}
1055410556
}

panoramapublic/src/org/labkey/panoramapublic/pipeline/CopyExperimentFinalTask.java

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -74,6 +74,7 @@
7474
import org.labkey.panoramapublic.proteomexchange.ProteomeXchangeService;
7575
import org.labkey.panoramapublic.proteomexchange.ProteomeXchangeServiceException;
7676
import org.labkey.panoramapublic.query.CatalogEntryManager;
77+
import org.labkey.panoramapublic.query.DatasetStatusManager;
7778
import org.labkey.panoramapublic.query.ExperimentAnnotationsManager;
7879
import org.labkey.panoramapublic.query.JournalManager;
7980
import org.labkey.panoramapublic.query.SubmissionManager;
@@ -150,6 +151,12 @@ private void finishUp(PipelineJob job, CopyExperimentJobSupport jobSupport) thro
150151

151152
// Update the row in panoramapublic.ExperimentAnnotations - set the shortURL and version
152153
ExperimentAnnotations targetExperiment = updateExperimentAnnotations(container, sourceExperiment, js, user, log);
154+
if (previousCopy != null)
155+
{
156+
// If this is a re-copy, a row may exist in DatasetStatus for the short URL associated with the experiment. Remove it now.
157+
// This is a fresh copy, so data status should be reset.
158+
DatasetStatusManager.deleteStatusForExperiment(targetExperiment);
159+
}
153160

154161
// If there is a Panorama Public data catalog entry associated with the previous copy of the experiment, move it to the
155162
// new container.

panoramapublic/src/org/labkey/panoramapublic/query/DatasetStatusManager.java

Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
package org.labkey.panoramapublic.query;
22

33
import org.jetbrains.annotations.Nullable;
4+
import org.labkey.api.data.DbScope;
45
import org.labkey.api.data.SimpleFilter;
56
import org.labkey.api.data.Table;
67
import org.labkey.api.data.TableSelector;
@@ -9,6 +10,7 @@
910
import org.labkey.api.view.ShortURLRecord;
1011
import org.labkey.panoramapublic.PanoramaPublicManager;
1112
import org.labkey.panoramapublic.model.DatasetStatus;
13+
import org.labkey.panoramapublic.model.ExperimentAnnotations;
1214

1315
public class DatasetStatusManager
1416
{
@@ -37,4 +39,16 @@ public static void update(DatasetStatus datasetStatus, User user)
3739
{
3840
Table.update(user, PanoramaPublicManager.getTableInfoDatasetStatus(), datasetStatus, datasetStatus.getId());
3941
}
42+
43+
public static void deleteStatusForExperiment(ExperimentAnnotations expAnnotations)
44+
{
45+
DatasetStatus status = getForShortUrl(expAnnotations.getShortUrl());
46+
if (status == null) return;
47+
48+
try(DbScope.Transaction transaction = PanoramaPublicManager.getSchema().getScope().ensureTransaction())
49+
{
50+
Table.delete(PanoramaPublicManager.getTableInfoDatasetStatus(), new SimpleFilter(FieldKey.fromParts("id"), status.getId()));
51+
transaction.commit();
52+
}
53+
}
4054
}

panoramapublic/src/org/labkey/panoramapublic/query/ExperimentAnnotationsManager.java

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -283,6 +283,10 @@ private static void deleteExperiment(ExperimentAnnotations expAnnotations, User
283283
}
284284
else
285285
{
286+
// Delete the row in DatasetStatus for this experiment. Do this before setting the experiment's shortURL to null
287+
// in SubmissionManager.beforeCopiedExperimentDeleted().
288+
DatasetStatusManager.deleteStatusForExperiment(expAnnotations);
289+
286290
// This experiment is a journal copy (i.e. in the Panorama Public project on PanoramaWeb)
287291
SubmissionManager.beforeCopiedExperimentDeleted(expAnnotations, user);
288292
}

panoramapublic/src/org/labkey/panoramapublic/query/JournalManager.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -162,6 +162,7 @@ public static void delete(Journal journal, User user)
162162
List<ExperimentAnnotations> expAnnotations = getExperimentsForJournal(journal.getId());
163163
for(ExperimentAnnotations expAnnotation: expAnnotations)
164164
{
165+
DatasetStatusManager.deleteStatusForExperiment(expAnnotation);
165166
removeJournalAccess(expAnnotation, journal, user);
166167
}
167168
SubmissionManager.deleteAllSubmissionsForJournal(journal.getId());

panoramapublic/test/src/org/labkey/test/tests/panoramapublic/PrivateDataReminderTest.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
import org.junit.experimental.categories.Category;
55
import org.labkey.test.BaseWebDriverTest;
66
import org.labkey.test.Locator;
7+
import org.labkey.test.TestTimeoutException;
78
import org.labkey.test.categories.External;
89
import org.labkey.test.categories.MacCossLabModules;
910
import org.labkey.test.pages.LabkeyErrorPage;
@@ -381,6 +382,14 @@ private void goToSendRemindersPage(String projectName)
381382
waitForText(projectName, "A reminder message will be sent to the submitters of the selected experiments");
382383
}
383384

385+
@Override
386+
protected void doCleanup(boolean afterTest) throws TestTimeoutException
387+
{
388+
_userHelper.deleteUsers(false,SUBMITTER_1, SUBMITTER_2, SUBMITTER_3, ADMIN_1, ADMIN_2, ADMIN_3);
389+
390+
super.doCleanup(afterTest);
391+
}
392+
384393
private static class DataFolderInfo
385394
{
386395
private final String _sourceFolder;

0 commit comments

Comments
 (0)