@@ -114,11 +114,6 @@ public String getEmailSubject(Container c)
114114 return "Daily Admin Alerts: " + getDateTimeFormat (c ).format (new Date ());
115115 }
116116
117- public DateFormat getDateFormat (Container c )
118- {
119- return new SimpleDateFormat (LookAndFeelProperties .getInstance (c ).getDefaultDateFormat ());
120- }
121-
122117 public DateFormat getDateTimeFormat (Container c )
123118 {
124119 return new SimpleDateFormat (LookAndFeelProperties .getInstance (c ).getDefaultDateTimeFormat ());
@@ -150,7 +145,7 @@ private String getLastSaveString(Container c, Map<String, String> map)
150145 return getDateTimeFormat (c ).format (new Date (lastSaveMills ));
151146 }
152147
153- private void saveValues (Container c , Map <String , String > saved , Map < String , String > newValues )
148+ private void saveValues (Container c , Map <String , String > newValues )
154149 {
155150 WritablePropertyMap map = PropertyManager .getWritableProperties (c , PROP_CATEGORY , true );
156151
@@ -190,13 +185,13 @@ public String getMessageBodyHTML(Container c, User u)
190185 StringBuilder msg = new StringBuilder ();
191186 StringBuilder alerts = new StringBuilder ();
192187
193- getSiteUsageStats (c , u , msg , alerts , saved , newValues );
188+ getSiteUsageStats (c , u , msg );
194189
195190 getTableSizeStats (c , u , msg , alerts , saved , newValues );
196191
197192 getFileRootSizes (c , u , msg , alerts , saved , newValues );
198193
199- validateContainerScopedTables (c , u , msg , alerts );
194+ validateContainerScopedTables (c , msg , alerts );
200195
201196 //allow registering of additional sections
202197 Set <NotificationSection > sections = ((LDKServiceImpl )LDKServiceImpl .get ()).getSiteSummaryNotificationSections ();
@@ -219,15 +214,15 @@ public String getMessageBodyHTML(Container c, User u)
219214
220215 msg .insert (0 , "This email contains a series of alerts designed for site admins. It was run on: " + getDateTimeFormat (c ).format (new Date ()) + ". Runtime: " + DurationFormatUtils .formatDurationWords ((new Date ()).getTime () - start .getTime (), true , true ) + "<p>" );
221216
222- saveValues (c , saved , newValues );
217+ saveValues (c , newValues );
223218
224219 return msg .toString ();
225220 }
226221
227222 /**
228223 * summarize site usage in the past 7 days
229224 */
230- private void siteUsage (Container c , User u , final StringBuilder msg , final StringBuilder alerts , Map < String , String > saved , Map < String , String > toSave )
225+ private void siteUsage (final StringBuilder msg )
231226 {
232227 //different behavior depending on whether audit data has migrated
233228 AuditTypeProvider ap = AuditLogService .get ().getAuditProvider ("UserAuditEvent" );
@@ -274,35 +269,6 @@ public void exec(ResultSet rs) throws SQLException
274269 }
275270 }
276271
277- /**
278- * we print some stats on data entry
279- */
280- private void dataEntryStatus (Container c , User u , final StringBuilder msg )
281- {
282- msg .append ("<b>Data Entry Stats:</b><p>" );
283-
284- Calendar cal = Calendar .getInstance ();
285- cal .setTime (new Date ());
286- cal .add (Calendar .DATE , -1 );
287- SQLFragment sql = new SQLFragment ("SELECT t.formtype, count(*) as total FROM ehr.tasks t WHERE cast(t.created as date) = " ).appendValue (new SimpleDateFormat ("yyyy-MM-dd" ).format (cal .getTime ())).append (" GROUP BY t.formtype ORDER BY t.formtype" );
288-
289- UserSchema us = QueryService .get ().getUserSchema (u , c , "core" );
290- SqlSelector ss = new SqlSelector (us .getDbSchema (), sql );
291-
292- msg .append ("Number of Forms Created Yesterday: <br>\n " );
293-
294- ss .forEach (new Selector .ForEachBlock <>()
295- {
296- @ Override
297- public void exec (ResultSet rs ) throws SQLException
298- {
299- msg .append (rs .getString ("formtype" ) + ": " + rs .getInt ("total" ) + "<br>\n " );
300- }
301- });
302-
303- msg .append ("<p>\n " );
304- }
305-
306272 private void getStudySizeSummary (Container c , User u , final StringBuilder msg , final StringBuilder alerts , Map <String , String > saved , Map <String , String > toSave )
307273 {
308274 Set <? extends Study > studies = StudyService .get ().getAllStudies (ContainerManager .getRoot (), u );
@@ -362,7 +328,7 @@ private String getPctChange(Long oldVal, Long newVal, double threshold, String m
362328
363329 }
364330
365- private void getPipelineJobCount (Container c , User u , final StringBuilder msg , final StringBuilder alerts , Map < String , String > saved , Map < String , String > toSave )
331+ private void getPipelineJobCount (Container c , User u , final StringBuilder msg )
366332 {
367333 TableInfo jobs = PipelineService .get ().getJobsTable (u , c );
368334 SimpleFilter filter = new SimpleFilter (FieldKey .fromString ("modified" ), "-1d" , CompareType .DATE_GTE );
@@ -372,7 +338,7 @@ private void getPipelineJobCount(Container c, User u, final StringBuilder msg, f
372338 msg .append ("Pipeline jobs created/modified in the past 24 hours: " + count + "<br>" );
373339 }
374340
375- private void validateContainerScopedTables (Container c , User u , final StringBuilder msg , final StringBuilder alerts )
341+ private void validateContainerScopedTables (Container c , final StringBuilder msg , final StringBuilder alerts )
376342 {
377343 LDKServiceImpl service = (LDKServiceImpl )LDKServiceImpl .get ();
378344 List <String > errors = service .validateContainerScopedTables (true );
@@ -459,15 +425,15 @@ private void getFileRootSizes(Container c, User u, final StringBuilder msg, fina
459425 toSave .put (fileRootCounts , new JSONObject (newValueMapCounts ).toString ());
460426 }
461427
462- private void getSiteUsageStats (Container c , User u , final StringBuilder msg , final StringBuilder alerts , Map < String , String > saved , Map < String , String > toSave )
428+ private void getSiteUsageStats (Container c , User u , final StringBuilder msg )
463429 {
464430 msg .append ("<br>The following items are designed to give a summary of recent site usage:<br><br>" );
465431
466- siteUsage (c , u , msg , alerts , saved , toSave );
432+ siteUsage (msg );
467433
468434 msg .append ("<b>Other Misc Statistics:</b><br><br>" );
469435
470- getPipelineJobCount (c , u , msg , alerts , saved , toSave );
436+ getPipelineJobCount (c , u , msg );
471437
472438 msg .append ("<hr>" );
473439 }
@@ -514,15 +480,15 @@ public void exec(ResultSet object) throws SQLException
514480 if (!newValueMap .isEmpty ())
515481 toSave .put (tableSizes , new JSONObject (newValueMap ).toString ());
516482
517- getDBSize (c , u , msg , alerts , saved , toSave );
483+ getDBSize (msg );
518484 getStudySizeSummary (c , u , msg , alerts , saved , toSave );
519485 getAssayRunSummary (c , u , msg , alerts , saved , toSave );
520486 getListSummary (c , u , msg , alerts , saved , toSave );
521487
522488 msg .append ("<hr>" );
523489 }
524490
525- private void getDBSize (Container c , User u , final StringBuilder msg , final StringBuilder alerts , Map < String , String > saved , Map < String , String > toSave )
491+ private void getDBSize (final StringBuilder msg )
526492 {
527493 SqlSelector ss = new SqlSelector (DbScope .getLabKeyScope (), new SQLFragment ("SELECT pg_database_size(?) As size" , DbScope .getLabKeyScope ().getDatabaseName ()));
528494 Map <String , Object >[] maps = ss .getMapArray ();
0 commit comments