Skip to content

Commit

Permalink
Java 21 Cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
docwho2 committed Jul 30, 2024
1 parent d4349f8 commit 737920c
Show file tree
Hide file tree
Showing 52 changed files with 196 additions and 420 deletions.
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import cloud.cleo.chimesma.model.ResponseStartBotConversation.*;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,12 +1,5 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;

/**
* Types that have just a "error" message set
*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package cloud.cleo.chimesma.model;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package cloud.cleo.chimesma.model;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Interface.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Enum.java to edit this template
*/
package cloud.cleo.chimesma.model;

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import cloud.cleo.chimesma.model.ResponsePlayAudio.AudioSource;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;


Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;


Expand Down Expand Up @@ -53,6 +49,7 @@ public static class Parameters implements Serializable {

@JsonProperty(value = "CallId")
private String callId;

@JsonProperty(value = "ParticipantTag")
@Builder.Default
private ParticipantTag participantTag = ParticipantTag.LEG_A;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down Expand Up @@ -78,18 +74,18 @@ public enum TextType {
*/
public enum VoiceId {
Aditi, Adriano, Amy, Andres, Aria, Arlet, Arthur,
Astrid, Ayanda, Bianca, Brian, Camila, Carla, Carmen,
Celine, Chantal, Conchita, Cristiano, Daniel, Danielle, Dora,
Elin, Emma, Enrique, Ewa, Filiz, Gabrielle, Geraint,
Giorgio, Gregory, Gwyneth, Hala, Hannah, Hans, Hiujin,
Ida, Ines, Isabelle, Ivy, Jacek, Jan, Joanna,
Joey, Justin, Kajal, Karl, Kazuha, Kendra, Kevin,
Kimberly, Laura, Lea, Liam, Lisa, Liv, Lotte,
Lucia, Lupe, Mads, Maja, Marlene, Mathieu, Matthew,
Maxim, Mia, Miguel, Mizuki, Naja, Niamh, Nicole,
Ola, Olivia, Pedro, Penelope, Raveena, Remi, Ricardo,
Ruben, Russell, Ruth, Salli, Seoyeon, Sergio, Sofie,
Stephen, Suvi, Takumi, Tatyana, Thiago, Tomoko, Vicki,
Vitoria, Zayd, Zeina, Zhiyu
Astrid, Ayanda, Bianca, Brian, Burcu, Camila, Carla,
Carmen, Celine, Chantal, Conchita, Cristiano, Daniel, Danielle,
Dora, Elin, Emma, Enrique, Ewa, Filiz, Gabrielle,
Geraint, Giorgio, Gregory, Gwyneth, Hala, Hannah, Hans,
Hiujin, Ida, Ines, Isabelle, Ivy, Jacek, Jan,
Joanna, Joey, Justin, Kajal, Karl, Kazuha, Kendra,
Kevin, Kimberly, Laura, Lea, Liam, Lisa, Liv,
Lotte, Lucia, Lupe, Mads, Maja, Marlene, Mathieu,
Matthew, Maxim, Mia, Miguel, Mizuki, Naja, Niamh,
Nicole, Ola, Olivia, Pedro, Penelope, Raveena, Remi,
Ricardo, Ruben, Russell, Ruth, Salli, Seoyeon, Sergio,
Sofie, Stephen, Suvi, Takumi, Tatyana, Thiago, Tomoko,
Vicki, Vitoria, Zayd, Zeina, Zhiyu
}
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import cloud.cleo.chimesma.model.ResponseSpeak.Engine;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonProperty;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.model;

import com.fasterxml.jackson.annotation.JsonInclude;
Expand Down
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.actions;

import static cloud.cleo.chimesma.actions.ReceiveDigitsAction.RECEIVE_DIGITS_ID;
Expand Down Expand Up @@ -63,6 +59,7 @@ public abstract class AbstractFlow implements RequestStreamHandler {
public final static String CURRENT_ACTION_ID_LIST = "CurrentActionIdList";

static {
// AWS could extend inout objects so don't fail when new properties have been added
mapper.configure(DeserializationFeature.FAIL_ON_UNKNOWN_PROPERTIES, false);
}

Expand Down Expand Up @@ -221,11 +218,11 @@ private Action getCurrentAction(SMARequest event) throws CloneNotSupportedExcept

/**
* Java 21 doesn't want to deserialize like 17 did, so we use our own mapper to handle things.
*
*
* @param in
* @param out
* @param cntxt
* @throws IOException
* @throws IOException
*/
@Override
public void handleRequest(InputStream in, OutputStream out, Context cntxt) throws IOException {
Expand All @@ -234,9 +231,10 @@ public void handleRequest(InputStream in, OutputStream out, Context cntxt) throw

/**
* Worked direct in Java 17, but need above for 21.
*
* @param event
* @param cntxt
* @return
* @return
*/
public final SMAResponse handleRequest(SMARequest event, Context cntxt) {
try {
Expand Down Expand Up @@ -291,14 +289,12 @@ public final SMAResponse handleRequest(SMARequest event, Context cntxt) {
break;
}
log.error("Error for " + action.getDebugSummary());
if (event.getActionData() instanceof ErrorTypeMessage) {
final var ad = (ErrorTypeMessage) event.getActionData();
log.error("ErrorType = [" + ad.getErrorType() + "]");
log.error("ErrorMessage = [" + ad.getErrorMessage() + "]");
if (event.getActionData() instanceof ErrorTypeMessage errorTypeMessage) {
log.error("ErrorType = [" + errorTypeMessage.getErrorType() + "]");
log.error("ErrorMessage = [" + errorTypeMessage.getErrorMessage() + "]");
}
if (event.getActionData() instanceof ErrorMessage) {
final var ad = (ErrorMessage) event.getActionData();
log.error("Error = [" + ad.getError() + "]");
if (event.getActionData() instanceof ErrorMessage errorMessage) {
log.error("Error = [" + errorMessage.getError() + "]");
}
if (action.getErrorAction() != null) {
actionList = getActions(action.getErrorAction(), event);
Expand All @@ -313,11 +309,10 @@ public final SMAResponse handleRequest(SMARequest event, Context cntxt) {
final var disconnectedBy = event.getCallDetails().getTransactionAttributes().getOrDefault("Disconnect", "Application");
log.debug("Call Was disconnected by [" + disconnectedBy + "], sending empty response");
action = getCurrentAction(event);
if (action instanceof CallAndBridgeAction) {
if (action instanceof CallAndBridgeAction callAndBridgeAction) {
// Because Call Bridge has 2 call legs in play, delegate respone to the Action since there
// various way to handle things, but the default being once connected a hangup on one leg should drop the other
final var cab = (CallAndBridgeAction) action;
final var nextAction = cab.getHangupAction();
final var nextAction = callAndBridgeAction.getHangupAction();
if (nextAction != null) {
actionList = getActions(nextAction, event);
res = SMAResponse.builder().withTransactionAttributes(actionList.getLast().getTransactionAttributes())
Expand Down Expand Up @@ -416,15 +411,4 @@ private SMAResponse hangupLegB() {
return SMAResponse.builder().withActions(List.of(ResponseHangup.builder().withParameters(ResponseHangup.Parameters.builder().withParticipantTag(ParticipantTag.LEG_B).build()).build())).build();
}

// public void handleRequest(InputStream in, OutputStream out, Context cntxt) throws IOException {
// // Read in JSON Tree
// var json = mapper.readTree(in);
// log.debug("INPUT JSON is " + json.toString());
//
// final var res = handleRequest(JacksonPojoSerializer.getInstance().fromJson(json.toString(), SMAEvent.class), cntxt);
//
// try (Writer w = new OutputStreamWriter(out, "UTF-8")) {
// w.write(mapper.writeValueAsString(res));
// }
// }
}
Original file line number Diff line number Diff line change
@@ -1,7 +1,3 @@
/*
* Click nbfs://nbhost/SystemFileSystem/Templates/Licenses/license-default.txt to change this license
* Click nbfs://nbhost/SystemFileSystem/Templates/Classes/Class.java to edit this template
*/
package cloud.cleo.chimesma.actions;

import static cloud.cleo.chimesma.actions.AbstractFlow.CURRENT_ACTION_ID;
Expand Down
Loading

0 comments on commit 737920c

Please sign in to comment.