Eliminated all warnings.

This commit is contained in:
2024-07-19 12:38:02 -05:00
parent f9af2ba983
commit 912e40fe0b
87 changed files with 257 additions and 166 deletions

View File

@ -1388,7 +1388,7 @@ public class ApiImplementation
List<Serializable> criteriaValues;
if(selectedOperator.noOfValues == null)
{
criteriaValues = Arrays.asList(value.split(","));
criteriaValues = Arrays.stream(value.split(",")).map(Serializable.class::cast).toList();
}
else if(selectedOperator.noOfValues == 1)
{
@ -1404,7 +1404,7 @@ public class ApiImplementation
}
else if(selectedOperator.noOfValues == 2)
{
criteriaValues = Arrays.asList(value.split(","));
criteriaValues = Arrays.stream(value.split(",")).map(Serializable.class::cast).toList();
if(criteriaValues.size() != 2)
{
throw (new QBadRequestException("Operator " + selectedOperator.prefix + " for field " + name + " requires 2 values (received " + criteriaValues.size() + ")"));

View File

@ -92,7 +92,9 @@ public class RenderSavedReportProcessApiMetaDataEnricher
ApiFieldMetaDataContainer apiFieldMetaDataContainer = new ApiFieldMetaDataContainer().withDefaultApiFieldMetaData(defaultApiFieldMetaData);
if(example instanceof List)
{
defaultApiFieldMetaData.withExample(new ExampleWithListValue().withValue((List<String>) example));
@SuppressWarnings("unchecked")
List<String> stringList = (List<String>) example;
defaultApiFieldMetaData.withExample(new ExampleWithListValue().withValue(stringList));
}
else
{

View File

@ -62,6 +62,7 @@ public class ApiProcessSummaryListOutput implements ApiProcessOutputInterface
@Override
public HttpStatus.Code getSuccessStatusCode(RunProcessInput runProcessInput, RunProcessOutput runProcessOutput)
{
@SuppressWarnings("unchecked")
List<ProcessSummaryLineInterface> processSummaryLineInterfaces = (List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get("processResults");
if(processSummaryLineInterfaces.isEmpty())
{
@ -134,7 +135,9 @@ public class ApiProcessSummaryListOutput implements ApiProcessOutputInterface
{
try
{
ArrayList<Serializable> apiOutput = new ArrayList<>();
ArrayList<Serializable> apiOutput = new ArrayList<>();
@SuppressWarnings("unchecked")
List<ProcessSummaryLineInterface> processSummaryLineInterfaces = (List<ProcessSummaryLineInterface>) runProcessOutput.getValues().get("processResults");
for(ProcessSummaryLineInterface processSummaryLineInterface : processSummaryLineInterfaces)
{

View File

@ -230,7 +230,9 @@ class ApiImplementationTest extends BaseTest
// query for persons - make sure custom method ran //
/////////////////////////////////////////////////////
Map<String, Serializable> queryResult = ApiImplementation.query(apiInstanceMetaData, TestUtils.CURRENT_API_VERSION, "person", Collections.emptyMap());
assertEquals("value from prepareToProduceApiValues", ((List<Map<String, Object>>) queryResult.get("records")).get(0).get("lastName"));
@SuppressWarnings("unchecked")
List<Map<String, Object>> records = (List<Map<String, Object>>) queryResult.get("records");
assertEquals("value from prepareToProduceApiValues", records.get(0).get("lastName"));
assertEquals(queryResult.get("count"), PersonLastNameBulkApiValueCustomizer.prepareWasCalledWithThisNoOfRecords);
}

View File

@ -311,6 +311,7 @@ class ApiScriptUtilsTest extends BaseTest
Serializable result = apiScriptUtils.runProcess(TestUtils.PROCESS_NAME_TRANSFORM_PEOPLE, JsonUtils.toJson(Map.of("id", "1,2,3")));
assertThat(result).isInstanceOf(List.class);
@SuppressWarnings("unchecked")
List<Map<String, Object>> resultList = (List<Map<String, Object>>) result;
assertEquals(3, resultList.size());
@ -332,6 +333,7 @@ class ApiScriptUtilsTest extends BaseTest
Serializable asyncResult = apiScriptUtils.runProcess(TestUtils.PROCESS_NAME_TRANSFORM_PEOPLE, JsonUtils.toJson(Map.of("id", "1,2,3", "async", true)));
assertThat(asyncResult).isInstanceOf(Map.class);
@SuppressWarnings("unchecked")
String jobId = ValueUtils.getValueAsString(((Map<String, ?>) asyncResult).get("jobId"));
assertNotNull(jobId);
@ -350,6 +352,7 @@ class ApiScriptUtilsTest extends BaseTest
}
assertThat(result).isInstanceOf(List.class);
@SuppressWarnings("unchecked")
List<Map<String, Object>> resultList = (List<Map<String, Object>>) result;
assertEquals(3, resultList.size());