|
22 | 22 | import org.labkey.api.data.Table; |
23 | 23 | import org.labkey.api.data.TableInfo; |
24 | 24 | import org.labkey.api.exp.property.PropertyService; |
| 25 | +import org.labkey.api.module.Module; |
| 26 | +import org.labkey.api.module.ModuleLoader; |
25 | 27 | import org.labkey.api.security.User; |
26 | 28 | import org.labkey.api.studydesign.query.AbstractStudyDesignDomainKind; |
27 | 29 | import org.labkey.api.studydesign.query.StudyDesignQuerySchema; |
|
43 | 45 | public class StudyDesignManager |
44 | 46 | { |
45 | 47 | private static final StudyDesignManager _instance = new StudyDesignManager(); |
| 48 | + public static final String MODULE_NAME = "StudyDesign"; |
46 | 49 |
|
47 | 50 | public static StudyDesignManager get() |
48 | 51 | { |
49 | 52 | return _instance; |
50 | 53 | } |
51 | 54 |
|
| 55 | + public boolean isModuleActive(Container c) |
| 56 | + { |
| 57 | + if (c == null) |
| 58 | + return false; |
| 59 | + |
| 60 | + Module studyDesignModule = ModuleLoader.getInstance().getModule(MODULE_NAME); |
| 61 | + return null != studyDesignModule && c.getActiveModules().contains(studyDesignModule); |
| 62 | + } |
| 63 | + |
52 | 64 | public void deleteStudyDesignData(Container c, Set<TableInfo> deletedTables) |
53 | 65 | { |
54 | 66 | Filter filter = SimpleFilter.createContainerFilter(c); |
@@ -77,6 +89,11 @@ public void deleteStudyDesignData(Container c, Set<TableInfo> deletedTables) |
77 | 89 | deletedTables.add(StudyDesignSchema.getInstance().getTableInfoTreatmentVisitMap()); |
78 | 90 | Table.delete(StudyDesignSchema.getInstance().getTableInfoObjective(), filter); |
79 | 91 | deletedTables.add(StudyDesignSchema.getInstance().getTableInfoObjective()); |
| 92 | + |
| 93 | + Table.delete(StudyDesignSchema.getInstance().getTableInfoAssaySpecimenVisit(), filter); |
| 94 | + deletedTables.add(StudyDesignSchema.getInstance().getTableInfoAssaySpecimenVisit()); |
| 95 | + Table.delete(StudyDesignSchema.getInstance().getTableInfoAssaySpecimen(), filter); |
| 96 | + deletedTables.add(StudyDesignSchema.getInstance().getTableInfoAssaySpecimen()); |
80 | 97 | } |
81 | 98 |
|
82 | 99 | // Proactively create the domains at study creation time to avoid problems with lazy creation, #42641 |
|
0 commit comments