Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ abstract public class AbstractTableCustomizer implements TableCustomizer
* Rely on DefaultSchema's caching of schema creation, and just track the minimum number of DefaultSchemas to
* resolve the requested collection of target containers
*/
private Map<Container, DefaultSchema> _defaultSchemas = new HashMap<>();
private final Map<Container, DefaultSchema> _defaultSchemas = new HashMap<>();

public UserSchema getUserSchema(AbstractTableInfo ti, String name)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -242,7 +242,7 @@ public DataIterator getDataIterator(DataIteratorContext context)
final String containerColName = getContainerFilterColumn();
final KeyManager keyManager = new KeyManager();
final SimpleTranslator it = new SimpleTranslator(input, context);
final Map<String, Integer> inputColMap = new HashMap<String, Integer>();
final Map<String, Integer> inputColMap = new HashMap<>();
for (int idx = 1; idx <= input.getColumnCount(); idx++)
{
ColumnInfo col = input.getColumnInfo(idx);
Expand All @@ -262,15 +262,15 @@ public DataIterator getDataIterator(DataIteratorContext context)

//set the value of the RowId column
ColumnInfo pseudoPkCol = getColumn(_pseudoPk);
it.addColumn(pseudoPkCol, new Callable<Object>()
it.addColumn(pseudoPkCol, new Callable<>()
{
@Override
public Object call()
{
Container c = null;
if (inputColMap.containsKey(containerColName))
{
String containerId = (String)it.getInputColumnValue(inputColMap.get(containerColName));
String containerId = (String) it.getInputColumnValue(inputColMap.get(containerColName));
if (containerId != null)
c = ContainerManager.getForId(containerId);
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@
*/
public class CustomPermissionsTable<SchemaType extends UserSchema> extends SimpleUserSchema.SimpleTable<SchemaType>
{
private Map<Class<? extends Permission>, Class<? extends Permission>> _permMap = new HashMap<>();
private final Map<Class<? extends Permission>, Class<? extends Permission>> _permMap = new HashMap<>();

public CustomPermissionsTable(SchemaType schema, TableInfo table, ContainerFilter cf)
{
Expand Down
10 changes: 5 additions & 5 deletions LDK/api-src/org/labkey/api/ldk/table/QueryCache.java
Original file line number Diff line number Diff line change
Expand Up @@ -46,10 +46,10 @@ public class QueryCache
{
private static final Logger _log = LogManager.getLogger(QueryCache.class);

private Map<String, AssayProtocolSchema> _cachedAssaySchemas = new HashMap<>();
private Map<String, UserSchema> _cachedUserSchemas = new HashMap<>();
private Map<String, TableInfo> _cachedQueries = new HashMap<>();
private Map<String, ColumnInfo> _cachedColumns = new HashMap<>();
private final Map<String, AssayProtocolSchema> _cachedAssaySchemas = new HashMap<>();
private final Map<String, UserSchema> _cachedUserSchemas = new HashMap<>();
private final Map<String, TableInfo> _cachedQueries = new HashMap<>();
private final Map<String, ColumnInfo> _cachedColumns = new HashMap<>();

public QueryCache()
{
Expand Down Expand Up @@ -104,7 +104,7 @@ public TableInfo getTableInfo(Container targetContainer, User u, String schemaPa

List<QueryException> errors = new ArrayList<>();
TableInfo ti = qd.getTable(errors, true);
if (errors.size() > 0)
if (!errors.isEmpty())
{
_log.error("Unable to create tabbed report item for query: " + schemaPath + "." + queryName + " in " + targetContainer.getPath());
for (QueryException e : errors)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
*/
public class SimpleButtonConfigFactory implements ButtonConfigFactory
{
private Module _owner;
private String _text;
private final Module _owner;
private final String _text;
private DetailsURL _url = null;
private String _jsHandler = null;
private Integer _insertPosition = null;
Expand Down
30 changes: 15 additions & 15 deletions LDK/src/org/labkey/ldk/LDKController.java
Original file line number Diff line number Diff line change
Expand Up @@ -111,7 +111,7 @@ public LDKController()
}

@RequiresPermission(ReadPermission.class)
public class GetNotificationsAction extends ReadOnlyApiAction<Object>
public static class GetNotificationsAction extends ReadOnlyApiAction<Object>
{
@Override
public ApiResponse execute(Object form, BindException errors)
Expand All @@ -136,7 +136,7 @@ public ApiResponse execute(Object form, BindException errors)
}

@RequiresPermission(ReadPermission.class)
public class GetFileRootSizesAction extends ReadOnlyApiAction<FileRootSizeForm>
public static class GetFileRootSizesAction extends ReadOnlyApiAction<FileRootSizeForm>
{
@Override
public ApiResponse execute(FileRootSizeForm form, BindException errors) throws Exception
Expand Down Expand Up @@ -212,7 +212,7 @@ public void setIncludeFileCounts(Boolean includeFileCounts)
}

@RequiresPermission(AdminOperationsPermission.class)
public class GetSiteNotificationDetailsAction extends ReadOnlyApiAction<Object>
public static class GetSiteNotificationDetailsAction extends ReadOnlyApiAction<Object>
{
@Override
public ApiResponse execute(Object form, BindException errors) throws Exception
Expand Down Expand Up @@ -242,7 +242,7 @@ public ApiResponse execute(Object form, BindException errors) throws Exception
}

@RequiresPermission(UpdatePermission.class)
public class UpdateNotificationSubscriptionsAction extends MutatingApiAction<UpdateNotificationSubscriptionsForm>
public static class UpdateNotificationSubscriptionsAction extends MutatingApiAction<UpdateNotificationSubscriptionsForm>
{
@Override
public ApiResponse execute(UpdateNotificationSubscriptionsForm form, BindException errors) throws Exception
Expand Down Expand Up @@ -349,7 +349,7 @@ public void setToRemove(Integer[] toRemove)
}

@RequiresPermission(ReadPermission.class)
public class RunNotificationAction extends SimpleViewAction<RunNotificationForm>
public static class RunNotificationAction extends SimpleViewAction<RunNotificationForm>
{
private String _title = null;

Expand Down Expand Up @@ -403,7 +403,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(AdminPermission.class)
public class SendNotificationAction extends MutatingApiAction<RunNotificationForm>
public static class SendNotificationAction extends MutatingApiAction<RunNotificationForm>
{
@Override
public ApiResponse execute(RunNotificationForm form, BindException errors) throws Exception
Expand Down Expand Up @@ -437,7 +437,7 @@ public ApiResponse execute(RunNotificationForm form, BindException errors) throw
}

@RequiresPermission(ReadPermission.class)
public class ValidateContainerScopedTablesAction extends SimpleViewAction<Object>
public static class ValidateContainerScopedTablesAction extends SimpleViewAction<Object>
{
@Override
public ModelAndView getView(Object form, BindException errors) throws Exception
Expand All @@ -459,7 +459,7 @@ public void addNavTrail(NavTree root)
}

@RequiresPermission(AdminPermission.class)
public class GetNotificationSubscriptionsAction extends ReadOnlyApiAction<RunNotificationForm>
public static class GetNotificationSubscriptionsAction extends ReadOnlyApiAction<RunNotificationForm>
{
@Override
public ApiResponse execute(RunNotificationForm form, BindException errors) throws Exception
Expand Down Expand Up @@ -509,7 +509,7 @@ public ApiResponse execute(RunNotificationForm form, BindException errors) throw
}

@RequiresPermission(AdminPermission.class)
public class SetNotificationSettingsAction extends MutatingApiAction<NotificationSettingsForm>
public static class SetNotificationSettingsAction extends MutatingApiAction<NotificationSettingsForm>
{
@Override
public ApiResponse execute(NotificationSettingsForm form, BindException errors)
Expand Down Expand Up @@ -648,7 +648,7 @@ public Predicate<String> allowBindParameter()


@RequiresPermission(ReadPermission.class)
public class LogMetricAction extends MutatingApiAction<LogMetricForm>
public static class LogMetricAction extends MutatingApiAction<LogMetricForm>
{
@Override
public ApiResponse execute(LogMetricForm form, BindException errors) throws Exception
Expand Down Expand Up @@ -822,7 +822,7 @@ public void setKey(String key)
}

@RequiresPermission(ReadPermission.class)
public class UpdateQueryAction extends SimpleViewAction<QueryForm>
public static class UpdateQueryAction extends SimpleViewAction<QueryForm>
{
private QueryForm _form;

Expand Down Expand Up @@ -1019,7 +1019,7 @@ public void setTargetContainer(String targetContainer)
}

@RequiresNoPermission
public class RedirectStartAction extends SimpleViewAction<Object>
public static class RedirectStartAction extends SimpleViewAction<Object>
{
@Override
public ModelAndView getView(Object form, BindException errors) throws Exception
Expand Down Expand Up @@ -1065,7 +1065,7 @@ public void addNavTrail(NavTree root)
public static final String REDIRECT_URL_PROP = "redirectURL";

@RequiresPermission(AdminPermission.class)
public class SetRedirectUrlAction extends MutatingApiAction<SetRedirectUrlForm>
public static class SetRedirectUrlAction extends MutatingApiAction<SetRedirectUrlForm>
{
@Override
public ApiResponse execute(SetRedirectUrlForm form, BindException errors) throws Exception
Expand Down Expand Up @@ -1100,7 +1100,7 @@ public void setUrl(String url)
}

@RequiresPermission(AdminPermission.class)
public class GetRedirectUrlAction extends ReadOnlyApiAction<Object>
public static class GetRedirectUrlAction extends ReadOnlyApiAction<Object>
{
@Override
public ApiResponse execute(Object form, BindException errors) throws Exception
Expand All @@ -1111,7 +1111,7 @@ public ApiResponse execute(Object form, BindException errors) throws Exception

@RequiresPermission(AdminOperationsPermission.class)
@AllowedDuringUpgrade
public class DownloadNaturalizeInstallScriptAction extends ExportAction<Object>
public static class DownloadNaturalizeInstallScriptAction extends ExportAction<Object>
{
@Override
public void export(Object o, HttpServletResponse response, BindException errors) throws Exception
Expand Down
12 changes: 6 additions & 6 deletions LDK/src/org/labkey/ldk/LDKServiceImpl.java
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ public class LDKServiceImpl extends LDKService
private final Set<NotificationSection> _summaryNotificationSections = new HashSet<>();
private final List<List<String>> _containerScopedTables = new ArrayList<>();
private Boolean _isNaturalizeInstalled = null;
private final Map<String, Map<String, List<ButtonConfigFactory>>> _queryButtons = new CaseInsensitiveHashMap<Map<String, List<ButtonConfigFactory>>>();
private final Map<String, Map<String, List<ButtonConfigFactory>>> _queryButtons = new CaseInsensitiveHashMap<>();
private static final String BACKGROUND_USER_PROPNAME = "BackgroundAdminUser";

public LDKServiceImpl()
Expand Down Expand Up @@ -113,7 +113,7 @@ public Map<String, Object> getContainerSizeJson(Container c, User u, boolean inc
//append children
if (includeAllRootTypes)
{
Set<File> paths = new HashSet<File>();
Set<File> paths = new HashSet<>();
for (FileContentService.ContentType type : FileContentService.ContentType.values())
{
File fileRoot = svc.getFileRoot(c, type);
Expand Down Expand Up @@ -268,7 +268,7 @@ public List<String> validateContainerScopedTables(boolean onlyReportErrors)
if (ss.exists())
{
messages.add("ERROR: duplicates found in: " + values.get(0) + "." + values.get(1));
ss.forEach(new Selector.ForEachBlock<ResultSet>()
ss.forEach(new Selector.ForEachBlock<>()
{
@Override
public void exec(ResultSet rs) throws SQLException
Expand Down Expand Up @@ -334,11 +334,11 @@ public void registerQueryButton(ButtonConfigFactory btn, String schema, String q
{
Map<String, List<ButtonConfigFactory>> schemaMap = _queryButtons.get(schema);
if (schemaMap == null)
schemaMap = new CaseInsensitiveHashMap<List<ButtonConfigFactory>>();
schemaMap = new CaseInsensitiveHashMap<>();

List<ButtonConfigFactory> list = schemaMap.get(query);
if (list == null)
list = new ArrayList<ButtonConfigFactory>();
list = new ArrayList<>();

list.add(btn);

Expand All @@ -349,7 +349,7 @@ public void registerQueryButton(ButtonConfigFactory btn, String schema, String q
@Override
public List<ButtonConfigFactory> getQueryButtons(TableInfo ti)
{
List<ButtonConfigFactory> buttons = new ArrayList<ButtonConfigFactory>();
List<ButtonConfigFactory> buttons = new ArrayList<>();

Map<String, List<ButtonConfigFactory>> factories = _queryButtons.get(ti.getPublicSchemaName());
if (factories == null)
Expand Down
2 changes: 1 addition & 1 deletion LDK/src/org/labkey/ldk/notification/NotificationJob.java
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public void execute(JobExecutionContext context) throws JobExecutionException
_log.info("Trying to run notification: " + _notification.getName());

Set<Container> activeContainers = NotificationServiceImpl.get().getActiveContainers(_notification);
if (activeContainers.size() == 0)
if (activeContainers.isEmpty())
{
_log.info("there are no active containers, skipping");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -466,7 +466,8 @@ public Set<UserPrincipal> getRecipients(Notification n, Container c)
TableSelector ts = new TableSelector(t, Collections.singleton("recipient"), filter, null);
if (ts.getRowCount() > 0)
{
ts.forEach(new TableSelector.ForEachBlock<ResultSet>(){
ts.forEach(new TableSelector.ForEachBlock<>()
{
@Override
public void exec(ResultSet rs) throws SQLException
{
Expand Down Expand Up @@ -586,7 +587,7 @@ public void runForContainer(Notification notification, Container c)
}

List<Address> recipients = NotificationServiceImpl.get().getEmails(notification, c);
if (recipients.size() == 0)
if (recipients.isEmpty())
{
_log.info("Notification: " + notification.getName() + " has no recipients, skipping");
return;
Expand All @@ -605,7 +606,7 @@ public void runForContainer(Notification notification, Container c)

mail.setFrom(NotificationServiceImpl.get().getReturnEmail(c));
mail.setSubject(notification.getEmailSubject(c));
mail.addRecipients(Message.RecipientType.TO, recipients.toArray(new Address[recipients.size()]));
mail.addRecipients(Message.RecipientType.TO, recipients.toArray(new Address[0]));

MailHelper.send(mail, u, c);
}
Expand Down
Loading