Skip to content

Commit 94e7cb6

Browse files
authored
appendNavTrail() to addNavTrail() migration (#31)
1 parent 0f7bd7c commit 94e7cb6

32 files changed

+199
-13
lines changed

LDK/api-src/org/labkey/api/ldk/notification/AbstractNotification.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -44,6 +44,7 @@ public AbstractNotification(Module owner)
4444
_owner = owner;
4545
}
4646

47+
@Override
4748
public boolean isAvailable(Container c)
4849
{
4950
return c.getActiveModules().contains(_owner);

LDK/src/org/labkey/ldk/LDKController.java

Lines changed: 19 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ public class RunNotificationAction extends SimpleViewAction<RunNotificationForm>
352352
{
353353
private String _title = null;
354354

355+
@Override
355356
public ModelAndView getView(RunNotificationForm form, BindException errors) throws Exception
356357
{
357358
if (form.getKey() == null)
@@ -393,15 +394,17 @@ public ModelAndView getView(RunNotificationForm form, BindException errors) thro
393394
return new HtmlView(sb.toString());
394395
}
395396

396-
public NavTree appendNavTrail(NavTree root)
397+
@Override
398+
public void addNavTrail(NavTree root)
397399
{
398-
return root.addChild(_title == null ? "Notification" : _title);
400+
root.addChild(_title == null ? "Notification" : _title);
399401
}
400402
}
401403

402404
@RequiresPermission(AdminPermission.class)
403405
public class SendNotificationAction extends MutatingApiAction<RunNotificationForm>
404406
{
407+
@Override
405408
public ApiResponse execute(RunNotificationForm form, BindException errors) throws Exception
406409
{
407410
Map<String, Object> result = new HashMap<>();
@@ -435,6 +438,7 @@ public ApiResponse execute(RunNotificationForm form, BindException errors) throw
435438
@RequiresPermission(ReadPermission.class)
436439
public class ValidateContainerScopedTablesAction extends SimpleViewAction<Object>
437440
{
441+
@Override
438442
public ModelAndView getView(Object form, BindException errors) throws Exception
439443
{
440444
LDKServiceImpl service = (LDKServiceImpl)LDKServiceImpl.get();
@@ -447,15 +451,17 @@ public ModelAndView getView(Object form, BindException errors) throws Exception
447451
return new HtmlView(sb.toString());
448452
}
449453

450-
public NavTree appendNavTrail(NavTree root)
454+
@Override
455+
public void addNavTrail(NavTree root)
451456
{
452-
return root.addChild("Validate Container Scoped Tables");
457+
root.addChild("Validate Container Scoped Tables");
453458
}
454459
}
455460

456461
@RequiresPermission(AdminPermission.class)
457462
public class GetNotificationSubscriptionsAction extends ReadOnlyApiAction<RunNotificationForm>
458463
{
464+
@Override
459465
public ApiResponse execute(RunNotificationForm form, BindException errors) throws Exception
460466
{
461467
Map<String, Object> result = new HashMap<>();
@@ -505,6 +511,7 @@ public ApiResponse execute(RunNotificationForm form, BindException errors) throw
505511
@RequiresPermission(AdminPermission.class)
506512
public class SetNotificationSettingsAction extends MutatingApiAction<NotificationSettingsForm>
507513
{
514+
@Override
508515
public ApiResponse execute(NotificationSettingsForm form, BindException errors)
509516
{
510517
try
@@ -812,6 +819,7 @@ public class UpdateQueryAction extends SimpleViewAction<QueryForm>
812819
{
813820
private QueryForm _form;
814821

822+
@Override
815823
public ModelAndView getView(QueryForm form, BindException errors) throws Exception
816824
{
817825
ensureQueryExists(form);
@@ -861,7 +869,8 @@ public ModelAndView getView(QueryForm form, BindException errors) throws Excepti
861869
return qwp;
862870
}
863871

864-
public NavTree appendNavTrail(NavTree root)
872+
@Override
873+
public void addNavTrail(NavTree root)
865874
{
866875
TableInfo ti = null;
867876
try
@@ -874,7 +883,6 @@ public NavTree appendNavTrail(NavTree root)
874883
}
875884

876885
root.addChild(ti == null ? _form.getQueryName() : ti.getTitle(), _form.urlFor(QueryAction.executeQuery));
877-
return root;
878886
}
879887

880888
protected void ensureQueryExists(QueryForm form)
@@ -941,6 +949,7 @@ public ModelAndView getConfirmView(MoveWorkbookForm form, BindException errors)
941949
return new HtmlView(sb.toString());
942950
}
943951

952+
@Override
944953
public boolean handlePost(MoveWorkbookForm form, BindException errors) throws Exception
945954
{
946955
Container toMove = getContainer();
@@ -1046,6 +1055,7 @@ public void setTargetContainer(String targetContainer)
10461055
@RequiresNoPermission
10471056
public class RedirectStartAction extends SimpleViewAction<Object>
10481057
{
1058+
@Override
10491059
public ModelAndView getView(Object form, BindException errors) throws Exception
10501060
{
10511061
if (getContainer().hasPermission(getUser(), AdminPermission.class))
@@ -1078,9 +1088,10 @@ public ModelAndView getView(Object form, BindException errors) throws Exception
10781088
}
10791089
}
10801090

1081-
public NavTree appendNavTrail(NavTree root)
1091+
@Override
1092+
public void addNavTrail(NavTree root)
10821093
{
1083-
return root.addChild("Home");
1094+
root.addChild("Home");
10841095
}
10851096
}
10861097

LDK/src/org/labkey/ldk/LDKServiceImpl.java

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -67,16 +67,19 @@ public LDKServiceImpl()
6767

6868
}
6969

70+
@Override
7071
public TableCustomizer getDefaultTableCustomizer()
7172
{
7273
return new DefaultTableCustomizer();
7374
}
7475

76+
@Override
7577
public TableCustomizer getDefaultTableCustomizer(MultiValuedMap<String, String> props)
7678
{
7779
return new DefaultTableCustomizer(props);
7880
}
7981

82+
@Override
8083
public TableCustomizer getBuiltInColumnsCustomizer(boolean disableFacetingForNumericCols)
8184
{
8285
BuiltInColumnsCustomizer ret = new BuiltInColumnsCustomizer();
@@ -85,11 +88,13 @@ public TableCustomizer getBuiltInColumnsCustomizer(boolean disableFacetingForNum
8588
return ret;
8689
}
8790

91+
@Override
8892
public TableCustomizer getColumnsOrderCustomizer()
8993
{
9094
return new ColumnOrderCustomizer();
9195
}
9296

97+
@Override
9398
public Map<String, Object> getContainerSizeJson(Container c, User u, boolean includeAllRootTypes, boolean includeFileCount)
9499
{
95100
FileContentService svc = FileContentService.get();
@@ -170,16 +175,19 @@ private int getFileCount(File file)
170175
return count;
171176
}
172177

178+
@Override
173179
public void applyNaturalSort(AbstractTableInfo ti, String colName)
174180
{
175181
DefaultTableCustomizer.applyNaturalSort(ti, colName);
176182
}
177183

184+
@Override
178185
public void appendCalculatedDateColumns(AbstractTableInfo ti, String dateColName, String enddateColName)
179186
{
180187
DefaultTableCustomizer.appendCalculatedDateColumns(ti, dateColName, enddateColName);
181188
}
182189

190+
@Override
183191
public void registerSiteSummaryNotification(NotificationSection ns)
184192
{
185193
_summaryNotificationSections.add(ns);
@@ -190,6 +198,7 @@ public Set<NotificationSection> getSiteSummaryNotificationSections()
190198
return Collections.unmodifiableSet(_summaryNotificationSections);
191199
}
192200

201+
@Override
193202
public boolean isNaturalizeInstalled()
194203
{
195204
if (_isNaturalizeInstalled != null)
@@ -215,6 +224,7 @@ public boolean isNaturalizeInstalled()
215224
}
216225
}
217226

227+
@Override
218228
public void registerContainerScopedTable(String dbSchemaName, String tableName, String pseudoPk)
219229
{
220230
_containerScopedTables.add(Arrays.asList(dbSchemaName, tableName, pseudoPk));
@@ -276,6 +286,7 @@ public void exec(ResultSet rs) throws SQLException
276286
return messages;
277287
}
278288

289+
@Override
279290
public void logPerfMetric(Container c, User u, String metricName, String comment, Double value)
280291
{
281292
PerfMetricModel model = new PerfMetricModel();
@@ -317,6 +328,7 @@ public void logPerfMetric(Container c, User u, PerfMetricModel model)
317328
Table.insert(u, t, map);
318329
}
319330

331+
@Override
320332
public void registerQueryButton(ButtonConfigFactory btn, String schema, String query)
321333
{
322334
Map<String, List<ButtonConfigFactory>> schemaMap = _queryButtons.get(schema);
@@ -491,6 +503,7 @@ public void setBrowser(String browser)
491503
}
492504
}
493505

506+
@Override
494507
public User getBackgroundAdminUser()
495508
{
496509
Module m = ModuleLoader.getInstance().getModule(LDKModule.NAME);

LDK/src/org/labkey/ldk/notification/NotificationJob.java

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -39,6 +39,7 @@ public class NotificationJob implements Job
3939
private static final Logger _log = Logger.getLogger(NotificationJob.class);
4040
private Notification _notification;
4141

42+
@Override
4243
public void execute(JobExecutionContext context) throws JobExecutionException
4344
{
4445
String key = context.getMergedJobDataMap().getString("notificationName");

LDK/src/org/labkey/ldk/notification/NotificationServiceImpl.java

Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ private Set<Container> getEnabledContainers()
116116
return containers;
117117
}
118118

119+
@Override
119120
public void registerNotification(Notification notification)
120121
{
121122
_log.info("Registering notification: " + notification.getName());
@@ -156,6 +157,7 @@ private static String getConfigProperty(Container c, String key)
156157
return PropertyManager.getProperties(c, CONFIG_PROPERTY_DOMAIN).get(key);
157158
}
158159

160+
@Override
159161
public boolean isServiceEnabled()
160162
{
161163
String prop = getConfigProperty(ContainerManager.getRoot(), ENABLED_PROP);
@@ -172,6 +174,7 @@ public void setServiceEnabled(Boolean status)
172174
pm.save();
173175
}
174176

177+
@Override
175178
public Set<Notification> getNotifications(Container c, boolean includeAll)
176179
{
177180
Set<Notification> notifications = new HashSet<>();
@@ -197,6 +200,7 @@ else if (n.isAvailable(c))
197200
return Collections.unmodifiableSet(notifications);
198201
}
199202

203+
@Override
200204
public Notification getNotification(String key)
201205
{
202206
for (Notification n : _notifications)
@@ -207,6 +211,7 @@ public Notification getNotification(String key)
207211
return null;
208212
}
209213

214+
@Override
210215
public Address getReturnEmail(Container c)
211216
{
212217
String email = getConfigProperty(c, RETURN_EMAIL);
@@ -319,6 +324,7 @@ public String getKey(Notification n)
319324
return n.getClass().getCanonicalName();
320325
}
321326

327+
@Override
322328
public long getLastRun(Notification n)
323329
{
324330
Map<String, String> m = PropertyManager.getProperties(NotificationServiceImpl.TIMESTAMP_PROPERTY_DOMAIN);
@@ -344,6 +350,7 @@ public void setLastRun(Notification n, Long lastRun)
344350
pm.save();
345351
}
346352

353+
@Override
347354
public boolean isActive(Notification n, Container c)
348355
{
349356
Map<String, String> m = PropertyManager.getProperties(c, NotificationServiceImpl.STATUS_PROPERTY_DOMAIN);
@@ -362,6 +369,7 @@ public void setActive(Notification n, Container c, boolean active)
362369
pm.save();
363370
}
364371

372+
@Override
365373
@NotNull
366374
public List<Address> getEmailsForPrincipal(UserPrincipal user) throws ValidEmail.InvalidEmailException
367375
{
@@ -442,11 +450,13 @@ else if (entry.getKey().startsWith("text/"))
442450
return null;
443451
}
444452

453+
@Override
445454
public User getUser(Notification n, Container c)
446455
{
447456
return getUser(c);
448457
}
449458

459+
@Override
450460
public Set<UserPrincipal> getRecipients(Notification n, Container c)
451461
{
452462
final Set<UserPrincipal> recipients = new HashSet<>();
@@ -457,6 +467,7 @@ public Set<UserPrincipal> getRecipients(Notification n, Container c)
457467
if (ts.getRowCount() > 0)
458468
{
459469
ts.forEach(new TableSelector.ForEachBlock<ResultSet>(){
470+
@Override
460471
public void exec(ResultSet rs) throws SQLException
461472
{
462473
int userId = rs.getInt("recipient");
@@ -504,6 +515,7 @@ public Set<Container> getActiveContainers(Notification n)
504515
return containers;
505516
}
506517

518+
@Override
507519
public Date getNextFireTime(Notification n)
508520
{
509521
Trigger trigger = _triggerMap.get(n);

LDK/src/org/labkey/ldk/notification/SiteSummaryNotification.java

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -84,26 +84,31 @@ public class SiteSummaryNotification implements Notification
8484

8585
private static final String PROP_CATEGORY = "ldk.SiteSummaryNotification";
8686

87+
@Override
8788
public String getName()
8889
{
8990
return "Site Summary Notification";
9091
}
9192

93+
@Override
9294
public String getCategory()
9395
{
9496
return "Admin";
9597
}
9698

99+
@Override
97100
public boolean isAvailable(Container c)
98101
{
99102
return c.isRoot();
100103
}
101104

105+
@Override
102106
public String getDescription()
103107
{
104108
return "This runs every day at 5AM and sends an email summarizing various events about the site, including usage";
105109
}
106110

111+
@Override
107112
public String getEmailSubject(Container c)
108113
{
109114
return "Daily Admin Alerts: " + getDateTimeFormat(c).format(new Date());
@@ -125,6 +130,7 @@ public String getCronString()
125130
return "0 0 5 * * ?";
126131
}
127132

133+
@Override
128134
public String getScheduleDescription()
129135
{
130136
return "daily at 5AM";

0 commit comments

Comments
 (0)