-
Notifications
You must be signed in to change notification settings - Fork 9
Expand file tree
/
Copy pathAttachmentHelper.java
More file actions
29 lines (26 loc) · 939 Bytes
/
AttachmentHelper.java
File metadata and controls
29 lines (26 loc) · 939 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
package org.labkey.test.util;
import org.labkey.remoteapi.CommandException;
import org.labkey.remoteapi.CommandResponse;
import org.labkey.remoteapi.SimpleGetCommand;
import org.labkey.test.WebTestHelper;
import java.io.IOException;
public class AttachmentHelper
{
/**
* Tells LabKey to log the first 20 orphaned attachments it detects at the ERROR level. Returns the total number of
* orphaned attachments detected. Must be a root admin (site or app) to call this.
*/
public static int logOrphanedAttachments()
{
SimpleGetCommand command = new SimpleGetCommand("admin", "logOrphanedAttachments");
try
{
CommandResponse response = command.execute(WebTestHelper.getRemoteApiConnection(), "/");
return response.getProperty("count");
}
catch (IOException | CommandException e)
{
throw new RuntimeException(e);
}
}
}