diff --git a/.github/workflows/pr.yml b/.github/workflows/pr.yml new file mode 100644 index 0000000..8be8d54 --- /dev/null +++ b/.github/workflows/pr.yml @@ -0,0 +1,28 @@ +name: PR Check + +on: + pull_request: + branches: [ main, dev ] + +env: + QUARKUS_CONTAINER_IMAGE_USERNAME: ${{ secrets.DOCKER_HUB_LOGIN }} + QUARKUS_CONTAINER_IMAGE_PASSWORD: ${{ secrets.DOCKER_HUB_PWD }} + +jobs: + pr_check: + runs-on: ubuntu-latest + steps: + - name: Checkout gh-repo + uses: actions/checkout@v3 + + - name: Set up JDK 17 + uses: actions/setup-java@v3 + with: + java-version: 17 + distribution: temurin + cache: maven + + - name: Clean and spotless + run: | + # Skipping Docker image build for PR verification + mvn clean spotless:check \ No newline at end of file diff --git a/README.md b/README.md index d1c29e1..93a7932 100644 --- a/README.md +++ b/README.md @@ -3,7 +3,10 @@ Client tools for building Quarkus java DIDcomm Verifiable Credential powered conversational service (Chatbots) with [2060.io Service Agent](https://github.com/2060-io/2060-service-agent/blob/main/doc/service-agent-api.md) ## How to use -On dev mode use the command `mvn clean install -Dgpg.skip` to run the project +On dev mode use the command `mvn clean verify install -Dgpg.skip` to run the project + +## Before PR +Please run `mvn clean spotless:check` command before uploading changes to verify the syntax ## Releases diff --git a/eclipse-formatter.xml b/eclipse-formatter.xml new file mode 100644 index 0000000..1c7074a --- /dev/null +++ b/eclipse-formatter.xml @@ -0,0 +1,20 @@ + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/pom.xml b/pom.xml index 4d64d02..1df50de 100644 --- a/pom.xml +++ b/pom.xml @@ -124,6 +124,60 @@ + + net.revelc.code.formatter + formatter-maven-plugin + 2.19.0 + + eclipse-formatter.xml + LF + + + + + format + + + + + + net.revelc.code + impsort-maven-plugin + 1.8.0 + + java.,javax.,org.,com. + java,* + true + + + + sort-imports + + sort + + + + + + com.diffplug.spotless + spotless-maven-plugin + 2.43.0 + + + + ${basedir}/eclipse-formatter.xml + + + + + diff --git a/src/main/java/io/twentysixty/sa/client/enums/Mrz.java b/src/main/java/io/twentysixty/sa/client/enums/Mrz.java index 85abaf3..c4315b5 100644 --- a/src/main/java/io/twentysixty/sa/client/enums/Mrz.java +++ b/src/main/java/io/twentysixty/sa/client/enums/Mrz.java @@ -15,69 +15,69 @@ @Setter @ToString public class Mrz { - public enum Format { - @JsonProperty("TD1") - TD1, - @JsonProperty("TD2") - TD2, - @JsonProperty("TD3") - TD3, - @JsonProperty("FRENCH_NATIONAL_ID") - FRENCH_NATIONAL_ID, - @JsonProperty("FRENCH_DRIVING_LICENSE") - FRENCH_DRIVING_LICENSE, - @JsonProperty("SWISS_DRIVING_LICENSE") - SWISS_DRIVING_LICENSE; - } + public enum Format { + @JsonProperty("TD1") + TD1, + @JsonProperty("TD2") + TD2, + @JsonProperty("TD3") + TD3, + @JsonProperty("FRENCH_NATIONAL_ID") + FRENCH_NATIONAL_ID, + @JsonProperty("FRENCH_DRIVING_LICENSE") + FRENCH_DRIVING_LICENSE, + @JsonProperty("SWISS_DRIVING_LICENSE") + SWISS_DRIVING_LICENSE; + } - public enum FieldName { - @JsonProperty("administrativeCode") - ADMINISTRATIVE_CODE, - @JsonProperty("administrativeCode2") - ADMINISTRATIVE_CODE2, - @JsonProperty("birthDate") - BIRTH_DATE, - @JsonProperty("birthDateCheckDigit") - BIRTH_DATE_CHECK_DIGIT, - @JsonProperty("compositeCheckDigit") - COMPOSITE_CHECK_DIGIT, - @JsonProperty("documentNumber") - DOCUMENT_NUMBER, - @JsonProperty("documentNumberCheckDigit") - DOCUMENT_NUMBER_CHECK_DIGIT, - @JsonProperty("documentCode") - DOCUMENT_CODE, - @JsonProperty("expirationDate") - EXPIRATION_DATE, - @JsonProperty("expirationDateCheckDigit") - EXPIRATION_DATE_CHECK_DIGIT, - @JsonProperty("firstName") - FIRST_NAME, - @JsonProperty("issueDate") - ISSUE_DATE, - @JsonProperty("issuingState") - ISSUING_STATE, - @JsonProperty("languageCode") - LANGUAGE_CODE, - @JsonProperty("lastName") - LAST_NAME, - @JsonProperty("nationality") - NATIONALITY, - @JsonProperty("optional") - OPTIONAL, - @JsonProperty("optional1") - OPTIONAL1, - @JsonProperty("optional2") - OPTIONAL2, - @JsonProperty("personalNumber") - PERSONAL_NUMBER, - @JsonProperty("personalNumberCheckDigit") - PERSONAL_NUMBER_CHECK_DIGIT, - @JsonProperty("pinCode") - PIN_CODE, - @JsonProperty("sex") - SEX, - @JsonProperty("versionNumber") - VERSION_NUMBER; - } + public enum FieldName { + @JsonProperty("administrativeCode") + ADMINISTRATIVE_CODE, + @JsonProperty("administrativeCode2") + ADMINISTRATIVE_CODE2, + @JsonProperty("birthDate") + BIRTH_DATE, + @JsonProperty("birthDateCheckDigit") + BIRTH_DATE_CHECK_DIGIT, + @JsonProperty("compositeCheckDigit") + COMPOSITE_CHECK_DIGIT, + @JsonProperty("documentNumber") + DOCUMENT_NUMBER, + @JsonProperty("documentNumberCheckDigit") + DOCUMENT_NUMBER_CHECK_DIGIT, + @JsonProperty("documentCode") + DOCUMENT_CODE, + @JsonProperty("expirationDate") + EXPIRATION_DATE, + @JsonProperty("expirationDateCheckDigit") + EXPIRATION_DATE_CHECK_DIGIT, + @JsonProperty("firstName") + FIRST_NAME, + @JsonProperty("issueDate") + ISSUE_DATE, + @JsonProperty("issuingState") + ISSUING_STATE, + @JsonProperty("languageCode") + LANGUAGE_CODE, + @JsonProperty("lastName") + LAST_NAME, + @JsonProperty("nationality") + NATIONALITY, + @JsonProperty("optional") + OPTIONAL, + @JsonProperty("optional1") + OPTIONAL1, + @JsonProperty("optional2") + OPTIONAL2, + @JsonProperty("personalNumber") + PERSONAL_NUMBER, + @JsonProperty("personalNumberCheckDigit") + PERSONAL_NUMBER_CHECK_DIGIT, + @JsonProperty("pinCode") + PIN_CODE, + @JsonProperty("sex") + SEX, + @JsonProperty("versionNumber") + VERSION_NUMBER; + } } diff --git a/src/main/java/io/twentysixty/sa/client/jms/AbstractConsumer.java b/src/main/java/io/twentysixty/sa/client/jms/AbstractConsumer.java index bef9940..a4a4cd3 100644 --- a/src/main/java/io/twentysixty/sa/client/jms/AbstractConsumer.java +++ b/src/main/java/io/twentysixty/sa/client/jms/AbstractConsumer.java @@ -1,13 +1,17 @@ package io.twentysixty.sa.client.jms; - import java.util.HashMap; import java.util.Map; -import java.util.Set; import java.util.UUID; import java.util.concurrent.ExecutorService; import java.util.concurrent.Executors; +import org.jboss.logging.Logger; + +import com.fasterxml.jackson.core.JsonProcessingException; + +import io.smallrye.mutiny.Uni; +import io.twentysixty.sa.client.util.JsonUtil; import jakarta.jms.ConnectionFactory; import jakarta.jms.JMSConsumer; import jakarta.jms.JMSContext; @@ -16,42 +20,27 @@ import jakarta.jms.Queue; import jakarta.jms.Session; -import org.jboss.logging.Logger; - -import com.fasterxml.jackson.core.JsonProcessingException; - -import io.smallrye.mutiny.Uni; -import io.twentysixty.sa.client.model.message.BaseMessage; -import io.twentysixty.sa.client.util.JsonUtil; - - -public class AbstractConsumer implements ConsumerInterface { +public class AbstractConsumer implements ConsumerInterface { private ConnectionFactory connectionFactory; - private Long exDelay; private String queueName; private Integer threads; private Boolean debug; - - private static final Logger logger = Logger.getLogger(AbstractConsumer.class); - private Map lockObjs = new HashMap(); - private Map runnings = new HashMap(); - private Map starteds = new HashMap(); - private Map contexts = new HashMap(); - + private Map lockObjs = new HashMap(); + private Map runnings = new HashMap(); + private Map starteds = new HashMap(); + private Map contexts = new HashMap(); private static ExecutorService executor = Executors.newCachedThreadPool(); - protected void _onStart() { - - for (int i=0; i consumer(UUID uuid) { runnings.put(uuid, true); } - long now = System.currentTimeMillis(); - /*synchronized (lockObj) { - try { - lockObj.wait(10000l); - } catch (InterruptedException e) { - - } - } + /* + * synchronized (lockObj) { try { lockObj.wait(10000l); } catch (InterruptedException e) { + * + * } } */ while (true) { Boolean started = null; - synchronized(starteds) { + synchronized (starteds) { started = starteds.get(uuid); } @@ -211,13 +184,13 @@ public Uni consumer(UUID uuid) { break; } + if (debug) + logger.info("consumer: running " + uuid); - if (debug) logger.info("consumer: running " + uuid); - - try { - - if (debug) logger.info("consumer " + queueName + ": create session " + uuid ); + try { + if (debug) + logger.info("consumer " + queueName + ": create session " + uuid); if (context == null) { context = getConnectionFactory().createContext(Session.SESSION_TRANSACTED); @@ -227,13 +200,14 @@ public Uni consumer(UUID uuid) { } - - if (debug) logger.info("consumer " + queueName + ": session created " + uuid ); + if (debug) + logger.info("consumer " + queueName + ": session created " + uuid); if (queue == null) { queue = context.createQueue(queueName); } - if (debug) logger.info("consumer " + queueName + ": create consumer " + uuid ); + if (debug) + logger.info("consumer " + queueName + ": create consumer " + uuid); JMSConsumer consumer = null; String messageSelector = getMessageSelector(); @@ -243,42 +217,39 @@ public Uni consumer(UUID uuid) { consumer = context.createConsumer(queue); } - - - if (debug) logger.info("consumer " + queueName + ": waiting for message... " + uuid); - + if (debug) + logger.info("consumer " + queueName + ": waiting for message... " + uuid); while (true) { started = null; - synchronized(starteds) { + synchronized (starteds) { started = starteds.get(uuid); - + } if ((started == null) || (!started)) { break; } - now = System.currentTimeMillis(); - if (debug) - logger.info("consumer: waiting for message... " + uuid + " " + (System.currentTimeMillis() - now)); + if (debug) + logger.info( + "consumer: waiting for message... " + uuid + " " + (System.currentTimeMillis() - now)); Message message = consumer.receive(); if (message != null) { - if (debug) - logger.info("consumer: received message " + uuid + " " + (System.currentTimeMillis() - now)); - + if (debug) + logger.info( + "consumer: received message " + uuid + " " + (System.currentTimeMillis() - now)); - - //BaseMessage baseMessage = null; + // BaseMessage baseMessage = null; if (message instanceof ObjectMessage) { ObjectMessage objMsg = (ObjectMessage) message; - //baseMessage = (BaseMessage) objMsg.getObject(); + // baseMessage = (BaseMessage) objMsg.getObject(); if (debug) { try { @@ -290,53 +261,58 @@ public Uni consumer(UUID uuid) { try { M baseMessage = (M) objMsg.getObject(); this.receiveMessage(baseMessage); - //messageResource.sendMessage(baseMessage); - + // messageResource.sendMessage(baseMessage); context.commit(); - if (debug) - logger.info("consumer: " + queueName + " after commit "+ uuid + " " + (System.currentTimeMillis() - now)); - + if (debug) + logger.info("consumer: " + queueName + " after commit " + uuid + " " + + (System.currentTimeMillis() - now)); } catch (Exception e) { try { - logger.warn("consumer: " + queueName + " "+ uuid + " " + (System.currentTimeMillis() - now)+ ": exception " + JsonUtil.serialize(objMsg, false), e); + logger.warn("consumer: " + queueName + " " + uuid + " " + + (System.currentTimeMillis() - now) + ": exception " + + JsonUtil.serialize(objMsg, false), e); } catch (JsonProcessingException e1) { - logger.warn("consumer: " + queueName + " "+ uuid + " " + (System.currentTimeMillis() - now)+ ": exception", e); + logger.warn("consumer: " + queueName + " " + uuid + " " + + (System.currentTimeMillis() - now) + ": exception", e); } context.rollback(); - //if (debug) - logger.info("consumer: " + queueName + " after rollback "+ uuid + " " + (System.currentTimeMillis() - now)); + // if (debug) + logger.info("consumer: " + queueName + " after rollback " + uuid + " " + + (System.currentTimeMillis() - now)); - } + } } else { - if (debug) logger.info("consumer " + queueName + " "+ uuid + " " + (System.currentTimeMillis() - now)+ ": unkown event " + message); + if (debug) + logger.info("consumer " + queueName + " " + uuid + " " + + (System.currentTimeMillis() - now) + ": unkown event " + message); context.commit(); } - - } else { - if (debug) - logger.info("consumer: no delivered message " + uuid + " " + (System.currentTimeMillis() - now)); + } else { + if (debug) + logger.info("consumer: no delivered message " + uuid + " " + + (System.currentTimeMillis() - now)); synchronized (lockObj) { try { - if (debug) logger.info("consumer: waiting thread " + uuid + " " + (System.currentTimeMillis() - now)); + if (debug) + logger.info("consumer: waiting thread " + uuid + " " + + (System.currentTimeMillis() - now)); lockObj.wait(1000); } catch (InterruptedException e1) { } } } - - } consumer.close(); context.close(); consumer = null; context = null; } catch (Exception e) { - + logger.error("", e); try { @@ -347,8 +323,6 @@ public Uni consumer(UUID uuid) { context = null; queue = null; - - synchronized (lockObj) { try { lockObj.wait(exDelay); @@ -397,12 +371,10 @@ public ConnectionFactory getConnectionFactory() { public void setConnectionFactory(ConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; } + @Override public String getMessageSelector() { return null; } - - - -} \ No newline at end of file +} diff --git a/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java b/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java index a560813..81e0050 100644 --- a/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java +++ b/src/main/java/io/twentysixty/sa/client/jms/AbstractProducer.java @@ -3,70 +3,65 @@ import java.io.Serializable; import java.util.HashMap; import java.util.Map; -import java.util.UUID; - -import jakarta.jms.ConnectionFactory; -import jakarta.jms.JMSContext; -import jakarta.jms.JMSProducer; -import jakarta.jms.ObjectMessage; -import jakarta.jms.Queue; -import jakarta.jms.Session; import org.graalvm.collections.Pair; import org.jboss.logging.Logger; import com.fasterxml.jackson.core.JsonProcessingException; -import io.twentysixty.sa.client.model.message.BaseMessage; import io.twentysixty.sa.client.util.JsonUtil; - +import jakarta.jms.ConnectionFactory; +import jakarta.jms.JMSContext; +import jakarta.jms.JMSProducer; +import jakarta.jms.ObjectMessage; +import jakarta.jms.Queue; +import jakarta.jms.Session; public abstract class AbstractProducer implements ProducerInterface { - + private Integer producerId = 0; private Integer producerCount = 8; - - private Map producers = new HashMap(); - private Map contexts = new HashMap(); - + + private Map producers = new HashMap(); + private Map contexts = new HashMap(); + private static final Logger logger = Logger.getLogger(AbstractProducer.class); private Object contextLockObj = new Object(); - - + private Map queues = new HashMap(); - + private ConnectionFactory connectionFactory; - + private Long exDelay; private String queueName; private Integer threads; private Boolean debug; - + int id = 0; - - - protected Pair> getProducer(ConnectionFactory connectionFactory, boolean debug) { - JMSProducer producer = null; - JMSContext context = null; - int id = 0; - - synchronized (contextLockObj) { + + protected Pair> getProducer(ConnectionFactory connectionFactory, + boolean debug) { + JMSProducer producer = null; + JMSContext context = null; + int id = 0; + + synchronized (contextLockObj) { if (debug) { - logger.info("spool: with use contexts/producer #" + producerId); - } + logger.info("spool: with use contexts/producer #" + producerId); + } context = contexts.get(producerId); if (context == null) { context = connectionFactory.createContext(Session.CLIENT_ACKNOWLEDGE); contexts.put(producerId, context); - + } - + producer = producers.get(producerId); if (producer == null) { producer = context.createProducer(); producers.put(producerId, producer); - + } id = producerId; producerId++; @@ -74,109 +69,107 @@ protected Pair> getProducer(ConnectionFac producerId = 0; } } - return Pair.create(id, Pair.create(context, producer)); - } - - protected void purgeAllProducers() { - - synchronized (contextLockObj) { - - for (int id=0; id> jms = getProducer(connectionFactory, debug); - - producer = jms.getRight().getRight(); - context = jms.getRight().getLeft(); - id = jms.getLeft(); - - - //if (sms.getEndpoint() != null) { - - //logger.info("context.createObjectMessage(sms) "); - ObjectMessage message = context.createObjectMessage(sms); - //logger.info("context.createObjectMessage(sms) 2 "); - - synchronized (producer) { - queue = this.getQueue(context, queueName); - - producer.send(queue, message); - message.acknowledge(); - - } - - if (debug) { - try { - logger.info("spool: Object spooled to " + queue.getQueueName() + " " + JsonUtil.serialize(sms, false)); - } catch (JsonProcessingException e) { - logger.info("spool: Object spooled to " + queue.getQueueName() + " ", e); - - } - } - - - - - } catch (Exception e) { - - this.purgeAllProducers(); - logger.error("error", e); - attempt++; - if (attempt> jms = getProducer(connectionFactory, debug); + + producer = jms.getRight().getRight(); + context = jms.getRight().getLeft(); + id = jms.getLeft(); + + // if (sms.getEndpoint() != null) { + + // logger.info("context.createObjectMessage(sms) "); + ObjectMessage message = context.createObjectMessage(sms); + // logger.info("context.createObjectMessage(sms) 2 "); + + synchronized (producer) { + queue = this.getQueue(context, queueName); + + producer.send(queue, message); + message.acknowledge(); + + } + + if (debug) { + try { + logger.info( + "spool: Object spooled to " + queue.getQueueName() + " " + JsonUtil.serialize(sms, false)); + } catch (JsonProcessingException e) { + logger.info("spool: Object spooled to " + queue.getQueueName() + " ", e); + + } + } + + } catch (Exception e) { + + this.purgeAllProducers(); + logger.error("error", e); + attempt++; + if (attempt < threads) { + logger.info("spool: will retry attempt #" + attempt); + retry = true; + } else { + throw (e); + } + } + + if (retry) + this.spool(sms, attempt); + + } + + private Queue getQueue(JMSContext context, String conn) { Queue queue = queues.get(conn); if (queue == null) { queue = context.createQueue(queueName); queues.put(conn, queue); } return queue; - } + } public void setExDelay(Long exDelay) { this.exDelay = exDelay; @@ -197,12 +190,11 @@ public void setDebug(Boolean debug) { @Override public void sendMessage(M message) throws Exception { // TODO Auto-generated method stub - + } public void setConnectionFactory(ConnectionFactory connectionFactory) { this.connectionFactory = connectionFactory; } - } diff --git a/src/main/java/io/twentysixty/sa/client/jms/ConsumerInterface.java b/src/main/java/io/twentysixty/sa/client/jms/ConsumerInterface.java index 5c8fb25..f85e066 100644 --- a/src/main/java/io/twentysixty/sa/client/jms/ConsumerInterface.java +++ b/src/main/java/io/twentysixty/sa/client/jms/ConsumerInterface.java @@ -1,17 +1,17 @@ package io.twentysixty.sa.client.jms; -import io.twentysixty.sa.client.model.message.BaseMessage; - - public interface ConsumerInterface { public void setExDelay(Long exDelay); + public void setQueueName(String queueName); + public void setThreads(Integer threads); + public void setDebug(boolean debug); + public String getMessageSelector(); - + public void receiveMessage(M message) throws Exception; - - + } diff --git a/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java b/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java index 1e21a68..6b1a0f5 100644 --- a/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java +++ b/src/main/java/io/twentysixty/sa/client/jms/ProducerInterface.java @@ -4,14 +4,14 @@ public interface ProducerInterface { - public void setExDelay(Long exDelay); + public void setQueueName(String queueName); + public void setThreads(Integer threads); + public void setDebug(Boolean debug); - + public void sendMessage(M message) throws Exception; - - - + } diff --git a/src/main/java/io/twentysixty/sa/client/model/credential/CredentialType.java b/src/main/java/io/twentysixty/sa/client/model/credential/CredentialType.java index 37f51fa..3a20d5d 100644 --- a/src/main/java/io/twentysixty/sa/client/model/credential/CredentialType.java +++ b/src/main/java/io/twentysixty/sa/client/model/credential/CredentialType.java @@ -9,44 +9,51 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) public class CredentialType { - + private String name; private String version; private List attributes; private String schemaId; private String id; + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public String getVersion() { return version; } + public void setVersion(String version) { this.version = version; } + public List getAttributes() { return attributes; } + public void setAttributes(List attributes) { this.attributes = attributes; } + public String getSchemaId() { return schemaId; } + public void setSchemaId(String schemaId) { this.schemaId = schemaId; } + public String getId() { return id; } + public void setId(String id) { this.id = id; } - - - } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/ConnectionStateUpdated.java b/src/main/java/io/twentysixty/sa/client/model/event/ConnectionStateUpdated.java index a1b205e..4fe15e4 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/ConnectionStateUpdated.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/ConnectionStateUpdated.java @@ -9,8 +9,8 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class ConnectionStateUpdated extends Event implements Serializable { - +public class ConnectionStateUpdated extends Event implements Serializable { + private static final long serialVersionUID = -2518124661250013725L; private UUID connectionId; private DidExchangeState state; @@ -19,18 +19,23 @@ public class ConnectionStateUpdated extends Event implements Serializable { public UUID getInvitationId() { return invitationId; } + public void setInvitationId(UUID invitationId) { this.invitationId = invitationId; } + public UUID getConnectionId() { return connectionId; } + public void setConnectionId(UUID connectionId) { this.connectionId = connectionId; } + public DidExchangeState getState() { return state; } + public void setState(DidExchangeState state) { this.state = state; } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/CredentialReceptionState.java b/src/main/java/io/twentysixty/sa/client/model/event/CredentialReceptionState.java index d9a57e5..457f072 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/CredentialReceptionState.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/CredentialReceptionState.java @@ -1,47 +1,47 @@ package io.twentysixty.sa.client.model.event; - import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonValue; -public enum CredentialReceptionState implements Serializable { +public enum CredentialReceptionState implements Serializable { /* - Done = "done", - Declined = "declined", - Abandoned = "abandoned", - */ - - + * Done = "done", Declined = "declined", Abandoned = "abandoned", + */ + DONE("done"), - DECLINED("declined"), - ABANDONED("abandoned"); - - private CredentialReceptionState(String index){ + DECLINED("declined"), + ABANDONED("abandoned"); + + private CredentialReceptionState(String index) { this.index = index; } private String index; - public String getIndex(){ + public String getIndex() { return this.index; } - public static CredentialReceptionState getEnum(String index){ + public static CredentialReceptionState getEnum(String index) { if (index == null) - return null; + return null; + + if (index.equals("done")) + return DONE; + else if (index.equals("declined")) + return DECLINED; + else if (index.equals("abandoned")) + return ABANDONED; + else + return null; - if (index.equals("done")) return DONE; - else if (index.equals("declined")) return DECLINED; - else if (index.equals("abandoned")) return ABANDONED; - else return null; - } - - @JsonValue + + @JsonValue public String getValue() { return index; } - + } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java b/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java index e9057fe..43b5366 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/DidExchangeState.java @@ -1,27 +1,17 @@ package io.twentysixty.sa.client.model.event; - import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonValue; -public enum DidExchangeState implements Serializable { +public enum DidExchangeState implements Serializable { /* - export enum DidExchangeState { - Start = 'start', - InvitationSent = 'invitation-sent', - InvitationReceived = 'invitation-received', - RequestSent = 'request-sent', - RequestReceived = 'request-received', - ResponseSent = 'response-sent', - ResponseReceived = 'response-received', - Abandoned = 'abandoned', - Completed = 'completed', - } - */ - - + * export enum DidExchangeState { Start = 'start', InvitationSent = 'invitation-sent', InvitationReceived = + * 'invitation-received', RequestSent = 'request-sent', RequestReceived = 'request-received', ResponseSent = + * 'response-sent', ResponseReceived = 'response-received', Abandoned = 'abandoned', Completed = 'completed', } + */ + START("start"), INVITATION_SENT("invitation-sent"), INVITATION_RECEIVED("invitation-received"), @@ -32,40 +22,51 @@ export enum DidExchangeState { ABANDONED("abandoned"), COMPLETED("completed"), TERMINATED("terminated"), - + ; - - private DidExchangeState(String index){ + + private DidExchangeState(String index) { this.index = index; } private String index; - public String getIndex(){ + public String getIndex() { return this.index; } - public static DidExchangeState getEnum(String index){ + public static DidExchangeState getEnum(String index) { if (index == null) - return null; + return null; + + if (index.equals("start")) + return START; + else if (index.equals("invitation-sent")) + return INVITATION_SENT; + else if (index.equals("invitation-received")) + return INVITATION_RECEIVED; + else if (index.equals("request-sent")) + return REQUEST_SENT; + else if (index.equals("request-received")) + return REQUEST_RECEIVED; + else if (index.equals("response-sent")) + return RESPONSE_SENT; + else if (index.equals("response-received")) + return RESPONSE_RECEIVED; + else if (index.equals("abandoned")) + return ABANDONED; + else if (index.equals("completed")) + return COMPLETED; + else if (index.equals("terminated")) + return TERMINATED; + else + return null; - if (index.equals("start")) return START; - else if (index.equals("invitation-sent")) return INVITATION_SENT; - else if (index.equals("invitation-received")) return INVITATION_RECEIVED; - else if (index.equals("request-sent")) return REQUEST_SENT; - else if (index.equals("request-received")) return REQUEST_RECEIVED; - else if (index.equals("response-sent")) return RESPONSE_SENT; - else if (index.equals("response-received")) return RESPONSE_RECEIVED; - else if (index.equals("abandoned")) return ABANDONED; - else if (index.equals("completed")) return COMPLETED; - else if (index.equals("terminated")) return TERMINATED; - else return null; - } - - @JsonValue + + @JsonValue public String getValue() { return index; } - + } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/Event.java b/src/main/java/io/twentysixty/sa/client/model/event/Event.java index d5ef3e8..9e653e4 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/Event.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/Event.java @@ -19,15 +19,14 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) @JsonTypeInfo(use = Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") -@JsonSubTypes({ -@Type(value = ConnectionStateUpdated.class, name ="connection-state-updated"), -@Type(value = MessageStateUpdated.class, name ="message-state-updated"), -@Type(value = MessageReceived.class, name ="message-received"), +@JsonSubTypes({@Type(value = ConnectionStateUpdated.class, name = "connection-state-updated"), + @Type(value = MessageStateUpdated.class, name = "message-state-updated"), + @Type(value = MessageReceived.class, name = "message-received"), }) public class Event implements Serializable { - + private static final long serialVersionUID = -3403163200817960597L; private String type; @@ -35,7 +34,7 @@ public class Event implements Serializable { @JsonSerialize(using = InstantSerializer.class) @JsonDeserialize(using = InstantDeserializer.class) private Instant timestamp; - + public String getType() { return type; } @@ -51,8 +50,5 @@ public Instant getTimestamp() { public void setTimestamp(Instant timestamp) { this.timestamp = timestamp; } - - - } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/EventType.java b/src/main/java/io/twentysixty/sa/client/model/event/EventType.java index 3bb937a..61a101c 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/EventType.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/EventType.java @@ -1,47 +1,48 @@ package io.twentysixty.sa.client.model.event; - import com.fasterxml.jackson.annotation.JsonValue; public enum EventType { /* - ConnectionState = 'connection-state-updated', - MessageStateUpdated = 'message-state-updated', - MessageReceived = 'message-received', - */ - - + * ConnectionState = 'connection-state-updated', MessageStateUpdated = 'message-state-updated', MessageReceived = + * 'message-received', + */ + CONNECTION_STATE_UPDATED("connection-state-updated"), MESSAGE_STATE_UPDATED("message-state-updated"), MESSAGE_RECEIVED("message-received"), - + ; - - private EventType(String index){ + + private EventType(String index) { this.index = index; } private String index; - public String getIndex(){ + public String getIndex() { return this.index; } - public static EventType getEnum(String index){ + public static EventType getEnum(String index) { if (index == null) - return null; + return null; + + if (index.equals("connection-state-updated")) + return CONNECTION_STATE_UPDATED; + else if (index.equals("message-state-updated")) + return MESSAGE_STATE_UPDATED; + else if (index.equals("message-received")) + return MESSAGE_RECEIVED; + else + return null; - if (index.equals("connection-state-updated")) return CONNECTION_STATE_UPDATED; - else if (index.equals("message-state-updated")) return MESSAGE_STATE_UPDATED; - else if (index.equals("message-received")) return MESSAGE_RECEIVED; - else return null; - } - - @JsonValue + + @JsonValue public String getValue() { return index; } - + } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java b/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java index bc83b07..3cb4370 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/MessageReceived.java @@ -10,9 +10,8 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MessageReceived extends Event implements Serializable { - - +public class MessageReceived extends Event implements Serializable { + private static final long serialVersionUID = 8579005132408573827L; private BaseMessage message; @@ -23,6 +22,5 @@ public BaseMessage getMessage() { public void setMessage(BaseMessage message) { this.message = message; } - } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/MessageState.java b/src/main/java/io/twentysixty/sa/client/model/event/MessageState.java index ed61ce1..14db292 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/MessageState.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/MessageState.java @@ -1,55 +1,55 @@ package io.twentysixty.sa.client.model.event; - import java.io.Serializable; import com.fasterxml.jackson.annotation.JsonValue; -public enum MessageState implements Serializable { +public enum MessageState implements Serializable { /* - Created = "created", - Submitted = "submitted", - Received = "received", - Viewed = "viewed", - Deleted = "deleted" - */ - - + * Created = "created", Submitted = "submitted", Received = "received", Viewed = "viewed", Deleted = "deleted" + */ + CREATED("created"), SUBMITTED("submitted"), RECEIVED("received"), VIEWED("viewed"), DELETED("deleted"), - + ; - - private MessageState(String index){ + + private MessageState(String index) { this.index = index; } private String index; - public String getIndex(){ + public String getIndex() { return this.index; } - public static MessageState getEnum(String index){ + public static MessageState getEnum(String index) { if (index == null) - return null; - - if (index.equals("created")) return CREATED; - else if (index.equals("submitted")) return SUBMITTED; - else if (index.equals("received")) return RECEIVED; - else if (index.equals("viewed")) return VIEWED; - else if (index.equals("deleted")) return DELETED; - else return null; - + return null; + + if (index.equals("created")) + return CREATED; + else if (index.equals("submitted")) + return SUBMITTED; + else if (index.equals("received")) + return RECEIVED; + else if (index.equals("viewed")) + return VIEWED; + else if (index.equals("deleted")) + return DELETED; + else + return null; + } - - @JsonValue + + @JsonValue public String getValue() { return index; } - + } diff --git a/src/main/java/io/twentysixty/sa/client/model/event/MessageStateUpdated.java b/src/main/java/io/twentysixty/sa/client/model/event/MessageStateUpdated.java index 7f2b835..a88bf44 100644 --- a/src/main/java/io/twentysixty/sa/client/model/event/MessageStateUpdated.java +++ b/src/main/java/io/twentysixty/sa/client/model/event/MessageStateUpdated.java @@ -9,33 +9,34 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MessageStateUpdated extends Event implements Serializable { - +public class MessageStateUpdated extends Event implements Serializable { + private UUID messageId; private UUID connectionId; private MessageState state; - - + public UUID getMessageId() { return messageId; } + public void setMessageId(UUID messageId) { this.messageId = messageId; } + public MessageState getState() { return state; } + public void setState(MessageState state) { this.state = state; } + public UUID getConnectionId() { return connectionId; } + public void setConnectionId(UUID connectionId) { this.connectionId = connectionId; } - - - } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java index 2ea6241..4a3dc04 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/BaseMessage.java @@ -26,31 +26,28 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) @JsonTypeInfo(use = Id.NAME, include = JsonTypeInfo.As.PROPERTY, property = "type") -@JsonSubTypes({ - @Type(value = ContextualMenuRequest.class, name ="contextual-menu-request"), - @Type(value = ContextualMenuSelect.class, name ="contextual-menu-select"), - @Type(value = ContextualMenuUpdate.class, name ="contextual-menu-update"), - @Type(value = CredentialIssuanceMessage.class, name ="credential-issuance"), - @Type(value = CredentialRequestMessage.class, name ="credential-request"), - @Type(value = CredentialReceptionMessage.class, name ="credential-reception"), - @Type(value = IdentityProofRequestMessage.class, name ="identity-proof-request"), - @Type(value = IdentityProofResultMessage.class, name ="identity-proof-result"), - @Type(value = IdentityProofSubmitMessage.class, name ="identity-proof-submit"), - @Type(value = MediaMessage.class, name ="media"), - @Type(value = MenuDisplayMessage.class, name ="menu-display"), - @Type(value = MenuSelectMessage.class, name ="menu-select"), - @Type(value = ReceiptsMessage.class, name ="receipts"), - @Type(value = TextMessage.class, name ="text"), - @Type(value = InvitationMessage.class, name ="invitation"), - @Type(value = ProfileMessage.class, name ="profile"), - @Type(value = TerminateConnectionMessage.class, name ="terminate-connection"), - @Type(value = CallAcceptRequestMessage.class, name ="call-accept"), - @Type(value = CallEndRequestMessage.class, name ="call-end"), - @Type(value = CallOfferRequestMessage.class, name ="call-offer"), - @Type(value = CallRejectRequestMessage.class, name ="call-reject"), - @Type(value = MrzDataRequestMessage.class, name ="mrz-data-request"), - @Type(value = MrzDataSubmitMessage.class, name ="mrz-data-submit") -}) +@JsonSubTypes({@Type(value = ContextualMenuRequest.class, name = "contextual-menu-request"), + @Type(value = ContextualMenuSelect.class, name = "contextual-menu-select"), + @Type(value = ContextualMenuUpdate.class, name = "contextual-menu-update"), + @Type(value = CredentialIssuanceMessage.class, name = "credential-issuance"), + @Type(value = CredentialRequestMessage.class, name = "credential-request"), + @Type(value = CredentialReceptionMessage.class, name = "credential-reception"), + @Type(value = IdentityProofRequestMessage.class, name = "identity-proof-request"), + @Type(value = IdentityProofResultMessage.class, name = "identity-proof-result"), + @Type(value = IdentityProofSubmitMessage.class, name = "identity-proof-submit"), + @Type(value = MediaMessage.class, name = "media"), + @Type(value = MenuDisplayMessage.class, name = "menu-display"), + @Type(value = MenuSelectMessage.class, name = "menu-select"), + @Type(value = ReceiptsMessage.class, name = "receipts"), @Type(value = TextMessage.class, name = "text"), + @Type(value = InvitationMessage.class, name = "invitation"), + @Type(value = ProfileMessage.class, name = "profile"), + @Type(value = TerminateConnectionMessage.class, name = "terminate-connection"), + @Type(value = CallAcceptRequestMessage.class, name = "call-accept"), + @Type(value = CallEndRequestMessage.class, name = "call-end"), + @Type(value = CallOfferRequestMessage.class, name = "call-offer"), + @Type(value = CallRejectRequestMessage.class, name = "call-reject"), + @Type(value = MrzDataRequestMessage.class, name = "mrz-data-request"), + @Type(value = MrzDataSubmitMessage.class, name = "mrz-data-submit")}) public abstract class BaseMessage implements Serializable { private static final long serialVersionUID = 8573230287869630604L; @@ -62,7 +59,6 @@ public abstract class BaseMessage implements Serializable { private Instant timestamp = null; private UUID threadId = null; - private SerializableObject lockObj = new SerializableObject(); public UUID getId() { @@ -74,15 +70,19 @@ public UUID getId() { return id; } + public void setId(UUID id) { this.id = id; } + public String getType() { return type; } + public void setType(String type) { this.type = type; } + public Instant getTimestamp() { synchronized (lockObj) { if (timestamp == null) { @@ -91,12 +91,15 @@ public Instant getTimestamp() { } return timestamp; } + public void setTimestamp(Instant timestamp) { this.timestamp = timestamp; } + public UUID getThreadId() { return threadId; } + public void setThreadId(UUID threadId) { this.threadId = threadId; } @@ -104,9 +107,9 @@ public void setThreadId(UUID threadId) { public UUID getConnectionId() { return connectionId; } + public void setConnectionId(UUID connectionId) { this.connectionId = connectionId; } - } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/Ciphering.java b/src/main/java/io/twentysixty/sa/client/model/message/Ciphering.java index f838f55..570dbfd 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/Ciphering.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/Ciphering.java @@ -2,31 +2,31 @@ import java.io.Serializable; -public class Ciphering implements Serializable { +public class Ciphering implements Serializable { - private static final long serialVersionUID = -8660299956191649637L; + private static final long serialVersionUID = -8660299956191649637L; private String algorithm; - private Parameters parameters; + private Parameters parameters; - public String getAlgorithm() { - return algorithm; - } + public String getAlgorithm() { + return algorithm; + } - public void setAlgorithm(String algorithm) { - this.algorithm = algorithm; - } + public void setAlgorithm(String algorithm) { + this.algorithm = algorithm; + } - public Parameters getParameters() { - return parameters; - } + public Parameters getParameters() { + return parameters; + } - public void setParameters(Parameters parameters) { - this.parameters = parameters; - } + public void setParameters(Parameters parameters) { + this.parameters = parameters; + } - @Override - public String toString() { - return "Ciphering [algorithm=" + algorithm + ", parameters=" + parameters + "]"; - } + @Override + public String toString() { + return "Ciphering [algorithm=" + algorithm + ", parameters=" + parameters + "]"; + } } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/Claim.java b/src/main/java/io/twentysixty/sa/client/model/message/Claim.java index 142827f..af59729 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/Claim.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/Claim.java @@ -8,31 +8,35 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class Claim implements Serializable { +public class Claim implements Serializable { private static final long serialVersionUID = -4617363940212616313L; private String name; private String mimeType; private String value; + public String getName() { return name; } + public void setName(String name) { this.name = name; } + public String getMimeType() { return mimeType; } + public void setMimeType(String mimeType) { this.mimeType = mimeType; } + public String getValue() { return value; } + public void setValue(String value) { this.value = value; } - - } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuItem.java b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuItem.java index 81e401a..cda1f88 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuItem.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuItem.java @@ -8,7 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class ContextualMenuItem implements Serializable { +public class ContextualMenuItem implements Serializable { private static final long serialVersionUID = 2236423396630045255L; private String id; @@ -18,18 +18,23 @@ public class ContextualMenuItem implements Serializable { public String getTitle() { return title; } + public void setTitle(String title) { this.title = title; } + public String getDescription() { return description; } + public void setDescription(String description) { this.description = description; } + public String getId() { return id; } + public void setId(String id) { this.id = id; } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuRequest.java b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuRequest.java index e70b439..c3a0cab 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuRequest.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuRequest.java @@ -8,7 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class ContextualMenuRequest extends BaseMessage implements Serializable { +public class ContextualMenuRequest extends BaseMessage implements Serializable { private static final long serialVersionUID = 6901833429017318747L; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuSelect.java b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuSelect.java index 777a979..9cb313b 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuSelect.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuSelect.java @@ -8,8 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class ContextualMenuSelect extends BaseMessage implements Serializable { - +public class ContextualMenuSelect extends BaseMessage implements Serializable { private static final long serialVersionUID = -4666174067446573357L; private String selectionId; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuUpdate.java b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuUpdate.java index b58dcff..afdba70 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuUpdate.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/ContextualMenuUpdate.java @@ -10,7 +10,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class ContextualMenuUpdate extends BaseMessage implements Serializable { +public class ContextualMenuUpdate extends BaseMessage implements Serializable { private static final long serialVersionUID = 391973108938300769L; private String title; @@ -51,7 +51,7 @@ public ContextualMenuUpdate clone() { if (options != null) { List clonedOptions = new ArrayList<>(); - for (ContextualMenuItem i: options) { + for (ContextualMenuItem i : options) { ContextualMenuItem ci = new ContextualMenuItem(); ci.setDescription(i.getDescription()); ci.setId(i.getId()); diff --git a/src/main/java/io/twentysixty/sa/client/model/message/CredentialIssuanceMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/CredentialIssuanceMessage.java index 233e800..309c3cf 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/CredentialIssuanceMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/CredentialIssuanceMessage.java @@ -9,23 +9,26 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class CredentialIssuanceMessage extends BaseMessage implements Serializable { +public class CredentialIssuanceMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = 2516235892249987546L; private String credentialDefinitionId; private List claims; + public String getCredentialDefinitionId() { return credentialDefinitionId; } + public void setCredentialDefinitionId(String credentialDefinitionId) { this.credentialDefinitionId = credentialDefinitionId; } + public List getClaims() { return claims; } + public void setClaims(List claims) { this.claims = claims; } - } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/CredentialReceptionMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/CredentialReceptionMessage.java index 1be934a..29214de 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/CredentialReceptionMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/CredentialReceptionMessage.java @@ -10,7 +10,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class CredentialReceptionMessage extends BaseMessage implements Serializable { +public class CredentialReceptionMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = 9137654378945678321L; private CredentialReceptionState state; @@ -18,6 +18,7 @@ public class CredentialReceptionMessage extends BaseMessage implements Serializ public CredentialReceptionState getState() { return state; } + public void setState(CredentialReceptionState state) { this.state = state; } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/CredentialRequestMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/CredentialRequestMessage.java index 2e96dec..eae33aa 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/CredentialRequestMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/CredentialRequestMessage.java @@ -10,20 +10,24 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class CredentialRequestMessage extends BaseMessage implements Serializable { +public class CredentialRequestMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = 5136530051273882680L; private UUID credentialDefinitionId; private List claims; + public UUID getCredentialDefinitionId() { return credentialDefinitionId; } + public void setCredentialDefinitionId(UUID credentialDefinitionId) { this.credentialDefinitionId = credentialDefinitionId; } + public List getClaims() { return claims; } + public void setClaims(List claims) { this.claims = claims; } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/IdMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/IdMessage.java index a703bd0..e81d222 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/IdMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/IdMessage.java @@ -8,7 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class IdMessage implements Serializable { +public class IdMessage implements Serializable { private static final long serialVersionUID = 8231578543615143747L; private String id; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofRequestMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofRequestMessage.java index f5fad27..21d41a9 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofRequestMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofRequestMessage.java @@ -9,7 +9,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class IdentityProofRequestMessage extends BaseMessage implements Serializable { +public class IdentityProofRequestMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = 184932976790362365L; private List requestedProofItems; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofResultMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofResultMessage.java index 883da4b..2152f78 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofResultMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofResultMessage.java @@ -8,7 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class IdentityProofResultMessage extends BaseMessage implements Serializable { +public class IdentityProofResultMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = -2840211856886973672L; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofSubmitMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofSubmitMessage.java index c2da93e..a73d4db 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofSubmitMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/IdentityProofSubmitMessage.java @@ -9,7 +9,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class IdentityProofSubmitMessage extends BaseMessage implements Serializable { +public class IdentityProofSubmitMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = -5772627818716475038L; private List submittedProofItems; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/InvitationMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/InvitationMessage.java index d9881df..02f21f1 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/InvitationMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/InvitationMessage.java @@ -8,33 +8,38 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class InvitationMessage extends BaseMessage implements Serializable { +public class InvitationMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = 2414948709300337368L; private String label; private String imageUrl; private String did; - public String getLabel() { - return label; - } - public void setLabel(String label) { - this.label = label; - } - public String getImageUrl() { - return imageUrl; - } - public void setImageUrl(String imageUrl) { - this.imageUrl = imageUrl; - } - - @Override - public String toString() { - return "InvitationMessage [label=" + label + ", imageUrl=" + imageUrl + "]"; - } + public String getLabel() { + return label; + } + + public void setLabel(String label) { + this.label = label; + } + + public String getImageUrl() { + return imageUrl; + } + + public void setImageUrl(String imageUrl) { + this.imageUrl = imageUrl; + } + + @Override + public String toString() { + return "InvitationMessage [label=" + label + ", imageUrl=" + imageUrl + "]"; + } + public String getDid() { return did; } + public void setDid(String did) { this.did = did; } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MediaItem.java b/src/main/java/io/twentysixty/sa/client/model/message/MediaItem.java index 325214b..b129f1b 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MediaItem.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MediaItem.java @@ -8,7 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MediaItem implements Serializable { +public class MediaItem implements Serializable { private static final long serialVersionUID = -2718519112111712736L; private String id; @@ -149,9 +149,9 @@ public void setscreenOrientaton(String screenOrientaton) { @Override public String toString() { - return "MediaItem [description=" + description + ", mimeType=" + mimeType + ", uri=" + uri - + ", preview=" + preview + ", width=" + width + ", height=" + height + ", duration=" + duration - + ", title=" + title + ", icon=" + icon + ", openingMode=" + openingMode + ", screenOrientaton=" + screenOrientaton + "]"; + return "MediaItem [description=" + description + ", mimeType=" + mimeType + ", uri=" + uri + ", preview=" + + preview + ", width=" + width + ", height=" + height + ", duration=" + duration + ", title=" + title + + ", icon=" + icon + ", openingMode=" + openingMode + ", screenOrientaton=" + screenOrientaton + "]"; } } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MediaMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/MediaMessage.java index 81eb349..22ca7fc 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MediaMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MediaMessage.java @@ -9,7 +9,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MediaMessage extends BaseMessage implements Serializable { +public class MediaMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = -4859703743672351029L; private String description; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MenuDisplayMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/MenuDisplayMessage.java index aafb8b6..19db3f3 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MenuDisplayMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MenuDisplayMessage.java @@ -10,7 +10,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MenuDisplayMessage extends BaseMessage implements Serializable { +public class MenuDisplayMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = 815738354220531775L; @@ -41,7 +41,7 @@ public MenuDisplayMessage clone() { if (this.getMenuItems() != null) { List cloneMenuItems = new ArrayList<>(this.getMenuItems().size()); - for (MenuItem i: this.getMenuItems()) { + for (MenuItem i : this.getMenuItems()) { MenuItem ci = new MenuItem(); ci.setAction(i.getAction()); ci.setId(i.getId()); @@ -54,7 +54,5 @@ public MenuDisplayMessage clone() { return clone; - - } } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MenuItem.java b/src/main/java/io/twentysixty/sa/client/model/message/MenuItem.java index b0543f2..3182934 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MenuItem.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MenuItem.java @@ -8,27 +8,33 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MenuItem implements Serializable { +public class MenuItem implements Serializable { private static final long serialVersionUID = -5234451638176689315L; private String id; private String text; private String action; + public String getId() { return id; } + public void setId(String id) { this.id = id; } + public String getText() { return text; } + public void setText(String text) { this.text = text; } + public String getAction() { return action; } + public void setAction(String action) { this.action = action; } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MenuItemSelection.java b/src/main/java/io/twentysixty/sa/client/model/message/MenuItemSelection.java index 10b5cc0..a7edd8c 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MenuItemSelection.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MenuItemSelection.java @@ -8,7 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MenuItemSelection implements Serializable { +public class MenuItemSelection implements Serializable { private static final long serialVersionUID = -6326294105243347432L; private String id; @@ -21,5 +21,4 @@ public void setId(String id) { this.id = id; } - } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MenuSelectMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/MenuSelectMessage.java index 270d37c..dd0d57d 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MenuSelectMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MenuSelectMessage.java @@ -9,7 +9,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MenuSelectMessage extends BaseMessage implements Serializable { +public class MenuSelectMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = 2315457851863067424L; private List menuItems; @@ -24,10 +24,10 @@ public void setMenuItems(List menuItems) { } public String getContent() { - return content; - } + return content; + } - public void setContent(String content) { - this.content = content; - } + public void setContent(String content) { + this.content = content; + } } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MessageReceiptOptions.java b/src/main/java/io/twentysixty/sa/client/model/message/MessageReceiptOptions.java index 03d0a19..eb7c8da 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MessageReceiptOptions.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MessageReceiptOptions.java @@ -12,7 +12,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MessageReceiptOptions implements Serializable { +public class MessageReceiptOptions implements Serializable { private static final long serialVersionUID = 449398087181657974L; private UUID messageId; @@ -22,18 +22,23 @@ public class MessageReceiptOptions implements Serializable { public UUID getMessageId() { return messageId; } + public void setMessageId(UUID messageId) { this.messageId = messageId; } + public MessageState getState() { return state; } + public void setState(MessageState state) { this.state = state; } + public Instant getTimestamp() { return timestamp; } + public void setTimestamp(Instant timestamp) { this.timestamp = timestamp; } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/MessageResponse.java b/src/main/java/io/twentysixty/sa/client/model/message/MessageResponse.java index c28c39e..0b99425 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/MessageResponse.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/MessageResponse.java @@ -8,7 +8,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class MessageResponse implements Serializable { +public class MessageResponse implements Serializable { private static final long serialVersionUID = 8147209590286984384L; String message; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/Parameters.java b/src/main/java/io/twentysixty/sa/client/model/message/Parameters.java index 6ed22c7..ef45a76 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/Parameters.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/Parameters.java @@ -2,28 +2,31 @@ import java.io.Serializable; -public class Parameters implements Serializable { +public class Parameters implements Serializable { - private static final long serialVersionUID = -3591319454008944749L; + private static final long serialVersionUID = -3591319454008944749L; private String key; - private String iv; - - public String getKey() { - return key; - } - public void setKey(String key) { - this.key = key; - } - public String getIv() { - return iv; - } - public void setIv(String iv) { - this.iv = iv; - } - - @Override - public String toString() { - return "Parameters [key=" + key + ", iv=" + iv + "]"; - } + private String iv; + + public String getKey() { + return key; + } + + public void setKey(String key) { + this.key = key; + } + + public String getIv() { + return iv; + } + + public void setIv(String iv) { + this.iv = iv; + } + + @Override + public String toString() { + return "Parameters [key=" + key + ", iv=" + iv + "]"; + } } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResult.java b/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResult.java index fe69003..d753ef8 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResult.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResult.java @@ -9,7 +9,7 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class ProofItemResult implements Serializable { +public class ProofItemResult implements Serializable { private static final long serialVersionUID = 60618296968339124L; private UUID id; @@ -19,18 +19,23 @@ public class ProofItemResult implements Serializable { public UUID getId() { return id; } + public void setId(UUID id) { this.id = id; } + public String getType() { return type; } + public void setType(String type) { this.type = type; } + public ProofItemResultValue getValue() { return value; } + public void setValue(ProofItemResultValue value) { this.value = value; } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResultValue.java b/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResultValue.java index 58f260f..bea61a8 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResultValue.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/ProofItemResultValue.java @@ -2,7 +2,7 @@ import java.io.Serializable; -public class ProofItemResultValue implements Serializable { +public class ProofItemResultValue implements Serializable { private static final long serialVersionUID = 6301649105435215111L; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/ReceiptsMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/ReceiptsMessage.java index 58a4dea..653f778 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/ReceiptsMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/ReceiptsMessage.java @@ -3,7 +3,7 @@ import java.io.Serializable; import java.util.List; -public class ReceiptsMessage extends BaseMessage implements Serializable { +public class ReceiptsMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = -7697839170763910025L; public List receipts; diff --git a/src/main/java/io/twentysixty/sa/client/model/message/RequestedProofItem.java b/src/main/java/io/twentysixty/sa/client/model/message/RequestedProofItem.java index 28a8be1..01be42f 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/RequestedProofItem.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/RequestedProofItem.java @@ -4,49 +4,57 @@ import java.util.List; import java.util.UUID; -public class RequestedProofItem implements Serializable { +public class RequestedProofItem implements Serializable { private static final long serialVersionUID = -3420017005051480727L; private UUID id; private String type; - + private String description; private String credentialDefinitionId; private List attributes; + public UUID getId() { if (id == null) { id = UUID.randomUUID(); } return id; } + public void setId(UUID id) { this.id = id; } + public String getType() { return type; } + public void setType(String type) { this.type = type; } + public String getDescription() { - return description; - } - public void setDescription(String description) { - this.description = description; - } + return description; + } + + public void setDescription(String description) { + this.description = description; + } + public String getCredentialDefinitionId() { return credentialDefinitionId; } + public void setCredentialDefinitionId(String credentialDefinitionId) { this.credentialDefinitionId = credentialDefinitionId; } + public List getAttributes() { return attributes; } + public void setAttributes(List attributes) { this.attributes = attributes; } - - } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/SubmitProofItem.java b/src/main/java/io/twentysixty/sa/client/model/message/SubmitProofItem.java index e9c4f63..e41ad38 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/SubmitProofItem.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/SubmitProofItem.java @@ -10,37 +10,44 @@ @JsonInclude(Include.NON_NULL) @JsonIgnoreProperties(ignoreUnknown = true) -public class SubmitProofItem implements Serializable { +public class SubmitProofItem implements Serializable { private static final long serialVersionUID = 2574481615814359423L; private UUID proofExchangeId; private String type; private Boolean verified; private List claims; + public UUID getProofExchangeId() { return proofExchangeId; } + public void setProofExchangeId(UUID proofExchangeId) { this.proofExchangeId = proofExchangeId; } + public String getType() { return type; } + public void setType(String type) { this.type = type; } + public Boolean getVerified() { return verified; } + public void setVerified(Boolean verified) { this.verified = verified; } + public List getClaims() { return claims; } + public void setClaims(List claims) { this.claims = claims; } - } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/TextMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/TextMessage.java index 512768b..696d7ad 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/TextMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/TextMessage.java @@ -3,8 +3,7 @@ import java.io.Serializable; import java.util.UUID; - -public class TextMessage extends BaseMessage implements Serializable { +public class TextMessage extends BaseMessage implements Serializable { private static final long serialVersionUID = -1511458961424773105L; private String content; @@ -33,9 +32,7 @@ public static TextMessage build(UUID connectionId, UUID threadId, String text) { textMessage.setId(UUID.randomUUID()); textMessage.setThreadId(threadId); - return textMessage; - } } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallAcceptRequestMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallAcceptRequestMessage.java index 6400023..e7a83f4 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallAcceptRequestMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallAcceptRequestMessage.java @@ -18,6 +18,6 @@ public class CallAcceptRequestMessage extends BaseMessage { private static final long serialVersionUID = -2840211856886973682L; - private Map parameters; - + private Map parameters; + } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallEndRequestMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallEndRequestMessage.java index 7268c32..52e0d59 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallEndRequestMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallEndRequestMessage.java @@ -11,5 +11,5 @@ public class CallEndRequestMessage extends BaseMessage { private static final long serialVersionUID = -2840211856886973682L; - + } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallOfferRequestMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallOfferRequestMessage.java index 4f17e5f..e3505ec 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallOfferRequestMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallOfferRequestMessage.java @@ -18,6 +18,6 @@ public class CallOfferRequestMessage extends BaseMessage { private static final long serialVersionUID = -2840211856886973682L; - private Map parameters; - + private Map parameters; + } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallRejectRequestMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallRejectRequestMessage.java index 03ae809..cffb2b4 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/calls/CallRejectRequestMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/calls/CallRejectRequestMessage.java @@ -11,5 +11,5 @@ public class CallRejectRequestMessage extends BaseMessage { private static final long serialVersionUID = -2840211856886973682L; - + } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java index 6efb10f..7c3c6d3 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzData.java @@ -23,23 +23,23 @@ public class MrzData implements Serializable { private static final long serialVersionUID = -5234275638176689315L; private Object raw; - private ParsedData parsed; + private ParsedData parsed; public String getRaw() { - if (raw instanceof List) { - return String.join(",", (List) raw); - } else if (raw instanceof String) { - return (String) raw; - } - return null; - } + if (raw instanceof List) { + return String.join(",", (List) raw); + } else if (raw instanceof String) { + return (String) raw; + } + return null; + } @Getter @Setter @ToString public static class ParsedData { - private Mrz.Format format; - private Map fields; - private boolean valid; - } + private Mrz.Format format; + private Map fields; + private boolean valid; + } } diff --git a/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java index 46ccff7..a4035fe 100644 --- a/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java +++ b/src/main/java/io/twentysixty/sa/client/model/message/mrtd/MrzDataSubmitMessage.java @@ -19,5 +19,5 @@ public class MrzDataSubmitMessage extends BaseMessage { private static final long serialVersionUID = -2840411856886673672L; private MrzData mrzData; - + } diff --git a/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java b/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java index e72b764..0316b03 100644 --- a/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/c/CredentialTypeInterface.java @@ -2,26 +2,22 @@ import java.util.List; +import io.twentysixty.sa.client.model.credential.CredentialType; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import io.twentysixty.sa.client.model.credential.CredentialType; - public interface CredentialTypeInterface { @POST @Path("/credential-types") @Produces("application/json") public void createCredentialType(CredentialType credentialType); - - + @GET @Path("/credential-types") @Produces("application/json") public List getAllCredentialTypes(); - - - + } diff --git a/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java b/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java index e51f8e5..02aa946 100644 --- a/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/c/MessageInterface.java @@ -1,13 +1,12 @@ package io.twentysixty.sa.client.res.c; +import io.twentysixty.sa.client.model.message.BaseMessage; +import io.twentysixty.sa.client.model.message.IdMessage; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import io.twentysixty.sa.client.model.message.BaseMessage; -import io.twentysixty.sa.client.model.message.IdMessage; - -public interface MessageInterface { //cambiar void +public interface MessageInterface { // cambiar void @POST @Path("/message") diff --git a/src/main/java/io/twentysixty/sa/client/res/c/v1/CredentialTypeInterface.java b/src/main/java/io/twentysixty/sa/client/res/c/v1/CredentialTypeInterface.java index 7761604..8b8c270 100644 --- a/src/main/java/io/twentysixty/sa/client/res/c/v1/CredentialTypeInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/c/v1/CredentialTypeInterface.java @@ -2,13 +2,12 @@ import java.util.List; +import io.twentysixty.sa.client.model.credential.CredentialType; import jakarta.ws.rs.GET; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import io.twentysixty.sa.client.model.credential.CredentialType; - @Path("") public interface CredentialTypeInterface { @@ -16,13 +15,10 @@ public interface CredentialTypeInterface { @Path("/v1/credential-types") @Produces("application/json") public void createCredentialType(CredentialType credentialType); - - + @GET @Path("/v1/credential-types") @Produces("application/json") public List getAllCredentialTypes(); - - - + } diff --git a/src/main/java/io/twentysixty/sa/client/res/c/v1/MessageInterface.java b/src/main/java/io/twentysixty/sa/client/res/c/v1/MessageInterface.java index cd25bba..653ea22 100644 --- a/src/main/java/io/twentysixty/sa/client/res/c/v1/MessageInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/c/v1/MessageInterface.java @@ -1,14 +1,13 @@ package io.twentysixty.sa.client.res.c.v1; +import io.twentysixty.sa.client.model.message.BaseMessage; +import io.twentysixty.sa.client.model.message.IdMessage; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; -import io.twentysixty.sa.client.model.message.BaseMessage; -import io.twentysixty.sa.client.model.message.IdMessage; - @Path("") -public interface MessageInterface { //cambiar void +public interface MessageInterface { // cambiar void @POST @Path("/v1/message") diff --git a/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java b/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java index f968f71..0517895 100644 --- a/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/s/ConnectionEventInterface.java @@ -1,13 +1,12 @@ package io.twentysixty.sa.client.res.s; +import io.twentysixty.sa.client.model.event.ConnectionStateUpdated; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Response; -import io.twentysixty.sa.client.model.event.ConnectionStateUpdated; - public interface ConnectionEventInterface { @POST diff --git a/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java b/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java index 7109231..c587dcc 100644 --- a/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java +++ b/src/main/java/io/twentysixty/sa/client/res/s/MessageEventInterface.java @@ -1,14 +1,13 @@ package io.twentysixty.sa.client.res.s; +import io.twentysixty.sa.client.model.event.MessageReceived; +import io.twentysixty.sa.client.model.event.MessageStateUpdated; import jakarta.ws.rs.Consumes; import jakarta.ws.rs.POST; import jakarta.ws.rs.Path; import jakarta.ws.rs.Produces; import jakarta.ws.rs.core.Response; -import io.twentysixty.sa.client.model.event.MessageReceived; -import io.twentysixty.sa.client.model.event.MessageStateUpdated; - public interface MessageEventInterface { @POST @@ -16,12 +15,11 @@ public interface MessageEventInterface { @Produces("application/json") @Consumes("application/json") public Response messageReceived(MessageReceived event); - + @POST @Path("/message-state-updated") @Produces("application/json") @Consumes("application/json") public Response messageStateUpdated(MessageStateUpdated event); - - + } diff --git a/src/main/java/io/twentysixty/sa/client/util/Aes256cbc.java b/src/main/java/io/twentysixty/sa/client/util/Aes256cbc.java index a27aa4a..9769919 100644 --- a/src/main/java/io/twentysixty/sa/client/util/Aes256cbc.java +++ b/src/main/java/io/twentysixty/sa/client/util/Aes256cbc.java @@ -1,51 +1,45 @@ package io.twentysixty.sa.client.util; import javax.crypto.Cipher; +import javax.crypto.spec.IvParameterSpec; import javax.crypto.spec.SecretKeySpec; import org.jboss.logging.Logger; -import io.twentysixty.sa.client.jms.AbstractConsumer; +public class Aes256cbc { -import javax.crypto.spec.IvParameterSpec; + private final static String alg = "AES"; + private final static String cI = "AES/CBC/PKCS5Padding"; + private static final Logger logger = Logger.getLogger(Aes256cbc.class); + public static byte[] encrypt(String key, String iv, byte[] bytes) throws Exception { + Cipher cipher = Cipher.getInstance(cI); + SecretKeySpec skeySpec = new SecretKeySpec(ISOUtil.hex2byte(key), alg); + IvParameterSpec ivParameterSpec = new IvParameterSpec(ISOUtil.hex2byte(iv)); + // logger.info("encrypt: key: " + key + " iv: " + iv + " bytes: " + bytes); + cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivParameterSpec); + byte[] encrypted = cipher.doFinal(bytes); + return encrypted; + } + + public static byte[] encrypt(String key, String iv, String cleartext) throws Exception { + Cipher cipher = Cipher.getInstance(cI); + SecretKeySpec skeySpec = new SecretKeySpec(ISOUtil.hex2byte(key), alg); + IvParameterSpec ivParameterSpec = new IvParameterSpec(ISOUtil.hex2byte(iv)); + cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivParameterSpec); + byte[] encrypted = cipher.doFinal(cleartext.getBytes()); + return encrypted; + } + + public static byte[] decrypt(String key, String iv, byte[] encrypted) throws Exception { + Cipher cipher = Cipher.getInstance(cI); + // SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), alg); + SecretKeySpec skeySpec = new SecretKeySpec(ISOUtil.hex2byte(key), alg); + // IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes(), 0, 16); + IvParameterSpec ivParameterSpec = new IvParameterSpec(ISOUtil.hex2byte(iv)); + cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivParameterSpec); + byte[] decrypted = cipher.doFinal(encrypted); + return decrypted; + } -public class Aes256cbc { - - private final static String alg = "AES"; - private final static String cI = "AES/CBC/PKCS5Padding"; - private static final Logger logger = Logger.getLogger(Aes256cbc.class); - - - - public static byte[] encrypt(String key, String iv, byte[] bytes) throws Exception { - Cipher cipher = Cipher.getInstance(cI); - SecretKeySpec skeySpec = new SecretKeySpec(ISOUtil.hex2byte(key), alg); - IvParameterSpec ivParameterSpec = new IvParameterSpec(ISOUtil.hex2byte(iv)); - // logger.info("encrypt: key: " + key + " iv: " + iv + " bytes: " + bytes); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivParameterSpec); - byte[] encrypted = cipher.doFinal(bytes); - return encrypted; - } - - public static byte[] encrypt(String key, String iv, String cleartext) throws Exception { - Cipher cipher = Cipher.getInstance(cI); - SecretKeySpec skeySpec = new SecretKeySpec(ISOUtil.hex2byte(key), alg); - IvParameterSpec ivParameterSpec = new IvParameterSpec(ISOUtil.hex2byte(iv)); - cipher.init(Cipher.ENCRYPT_MODE, skeySpec, ivParameterSpec); - byte[] encrypted = cipher.doFinal(cleartext.getBytes()); - return encrypted; - } - - public static byte[] decrypt(String key, String iv, byte[] encrypted) throws Exception { - Cipher cipher = Cipher.getInstance(cI); - // SecretKeySpec skeySpec = new SecretKeySpec(key.getBytes(), alg); - SecretKeySpec skeySpec = new SecretKeySpec(ISOUtil.hex2byte(key), alg); - // IvParameterSpec ivParameterSpec = new IvParameterSpec(iv.getBytes(), 0, 16); - IvParameterSpec ivParameterSpec = new IvParameterSpec(ISOUtil.hex2byte(iv)); - cipher.init(Cipher.DECRYPT_MODE, skeySpec, ivParameterSpec); - byte[] decrypted = cipher.doFinal(encrypted); - return decrypted; - } - } diff --git a/src/main/java/io/twentysixty/sa/client/util/ISOUtil.java b/src/main/java/io/twentysixty/sa/client/util/ISOUtil.java index 2ceaa25..a412415 100644 --- a/src/main/java/io/twentysixty/sa/client/util/ISOUtil.java +++ b/src/main/java/io/twentysixty/sa/client/util/ISOUtil.java @@ -2,149 +2,178 @@ import java.util.regex.Pattern; - - public class ISOUtil { private static final Pattern HEX_CHARACTERS = Pattern.compile("[0-9a-fA-F]+"); - + + /** + * converts a byte array to hex string (suitable for dumps and ASCII packaging of Binary fields + * + * @param b + * - byte array + * @return String representation + */ + public static String hexString(byte[] b) { + return hexString(b, 0, b.length); + } + + public static String hexString(byte[] b, int offset, int len) { + StringBuffer d = new StringBuffer(b.length * 2); + for (int i = 0; i < len; i++) { + char hi = Character.forDigit((b[offset + i] >> 4) & 0x0F, 16); + char lo = Character.forDigit(b[offset + i] & 0x0F, 16); + d.append(Character.toUpperCase(hi)); + d.append(Character.toUpperCase(lo)); + } + return d.toString(); + } + + /** + * @param b + * source byte array + * @param offset + * starting offset + * @param len + * number of bytes in destination (processes len*2) + * @return byte[len] + */ + public static byte[] hex2byte(byte[] b, int offset, int len) { + byte[] d = new byte[len]; + for (int i = 0; i < len * 2; i++) { + int shift = i % 2 == 1 ? 0 : 4; + d[i >> 1] |= Character.digit((char) b[offset + i], 16) << shift; + } + return d; + } + /** - * converts a byte array to hex string - * (suitable for dumps and ASCII packaging of Binary fields - * @param b - byte array - * @return String representation - */ - public static String hexString(byte[] b) { - return hexString(b, 0, b.length); - } + * @param s + * source string (with Hex representation) + * @return byte array + */ + public static byte[] hex2byte(String s) { + if (s.length() % 2 == 0) { + return hex2byte(s.getBytes(), 0, s.length() >> 1); + } else { + throw new RuntimeException(); + } + } - public static String hexString(byte[] b, int offset, int len) { - StringBuffer d = new StringBuffer(b.length * 2); - for (int i=0; i> 4) & 0x0F, 16); - char lo = Character.forDigit (b[offset+i] & 0x0F, 16); - d.append(Character.toUpperCase(hi)); - d.append(Character.toUpperCase(lo)); - } - return d.toString(); - } - /** - * @param b source byte array - * @param offset starting offset - * @param len number of bytes in destination (processes len*2) - * @return byte[len] - */ - public static byte[] hex2byte (byte[] b, int offset, int len) { - byte[] d = new byte[len]; - for (int i=0; i>1] |= Character.digit((char) b[offset+i], 16) << shift; - } - return d; - } - /** - * @param s source string (with Hex representation) - * @return byte array - */ - public static byte[] hex2byte (String s) { - if (s.length() % 2 == 0) { - return hex2byte (s.getBytes(), 0, s.length() >> 1); - } else { - throw new RuntimeException(); - } - } - - /** - * converts a byte array to printable characters - * @param b - byte array - * @return String representation - */ - public static String dumpString(byte[] b) { - StringBuffer d = new StringBuffer(b.length * 2); - for (int i=0; i> 4) & 0x0F, 16); - char lo = Character.forDigit (b[i] & 0x0F, 16); - d.append('['); - d.append(Character.toUpperCase(hi)); - d.append(Character.toUpperCase(lo)); - d.append(']'); - break; - } - } - else - d.append (c); + /** + * converts a byte array to printable characters + * + * @param b + * - byte array + * @return String representation + */ + public static String dumpString(byte[] b) { + StringBuffer d = new StringBuffer(b.length * 2); + for (int i = 0; i < b.length; i++) { + char c = (char) b[i]; + if (Character.isISOControl(c)) { + // TODO: complete list of control characters, + // use a String[] instead of this weird switch + switch (c) { + case '\r' : + d.append("{CR}"); + break; + case '\n' : + d.append("{LF}"); + break; + case '\000' : + d.append("{NULL}"); + break; + case '\001' : + d.append("{SOH}"); + break; + case '\002' : + d.append("{STX}"); + break; + case '\003' : + d.append("{ETX}"); + break; + case '\004' : + d.append("{EOT}"); + break; + case '\005' : + d.append("{ENQ}"); + break; + case '\006' : + d.append("{ACK}"); + break; + case '\007' : + d.append("{BEL}"); + break; + case '\020' : + d.append("{DLE}"); + break; + case '\025' : + d.append("{NAK}"); + break; + case '\026' : + d.append("{SYN}"); + break; + case '\034' : + d.append("{FS}"); + break; + case '\036' : + d.append("{RS}"); + break; + default : + char hi = Character.forDigit((b[i] >> 4) & 0x0F, 16); + char lo = Character.forDigit(b[i] & 0x0F, 16); + d.append('['); + d.append(Character.toUpperCase(hi)); + d.append(Character.toUpperCase(lo)); + d.append(']'); + break; + } + } else + d.append(c); + + } + return d.toString(); + } + + public static boolean isValidHexString(String s) { + return HEX_CHARACTERS.matcher(s).matches(); + } + + /** + * Swaps nibbles of all bytes in an input array + * + * @param value + * @return + */ + public static byte[] swapNibbles(byte[] value) { + byte[] output = new byte[value.length]; + + for (int i = 0; i < output.length; i++) { + int nibble0 = (value[i] << 4) & 0xf0; + int nibble1 = (value[i] >>> 4) & 0x0f; + output[i] = (byte) ((nibble0 | nibble1)); + } + // System.out.println(ISOUtil.hexString(output)); + return output; + } - } - return d.toString(); - } - - public static boolean isValidHexString(String s) { - return HEX_CHARACTERS.matcher(s).matches(); - } - - /** - * Swaps nibbles of all bytes in an input array - * - * @param value - * @return - */ - public static byte [] swapNibbles(byte [] value) { - byte [] output = new byte[value.length]; - - for (int i = 0 ; i < output.length ; i++) { - int nibble0 = (value[i] << 4) & 0xf0; - int nibble1 = (value[i] >>> 4) & 0x0f; - output[i] = (byte)((nibble0 | nibble1)); - } - //System.out.println(ISOUtil.hexString(output)); - return output; - } - - public static String swapNibblesAndUnpad(byte [] value) { - byte[] output = swapNibbles(value); - String outputStr = hexString(output); - if (outputStr.endsWith("F")) { - return outputStr.substring(0, outputStr.length() - 1); - } - return outputStr; - } - - - - public static byte [] padAndSwapNibbles(String value) { - String paddedValue = new String(value); + public static String swapNibblesAndUnpad(byte[] value) { + byte[] output = swapNibbles(value); + String outputStr = hexString(output); + if (outputStr.endsWith("F")) { + return outputStr.substring(0, outputStr.length() - 1); + } + return outputStr; + } + + public static byte[] padAndSwapNibbles(String value) { + String paddedValue = new String(value); if (paddedValue.length() % 2 != 0) paddedValue += "F"; - return swapNibbles(hex2byte(paddedValue - .replace("*", "A") - .replace("#", "B"))); - } - - public static byte [] swapNibbles(String value) { - return swapNibbles(hex2byte(value)); - } + return swapNibbles(hex2byte(paddedValue.replace("*", "A").replace("#", "B"))); + } + + public static byte[] swapNibbles(String value) { + return swapNibbles(hex2byte(value)); + } - - - } \ No newline at end of file diff --git a/src/main/java/io/twentysixty/sa/client/util/InstantDeserializer.java b/src/main/java/io/twentysixty/sa/client/util/InstantDeserializer.java index 9aff8e6..860f6c0 100644 --- a/src/main/java/io/twentysixty/sa/client/util/InstantDeserializer.java +++ b/src/main/java/io/twentysixty/sa/client/util/InstantDeserializer.java @@ -9,12 +9,13 @@ import com.fasterxml.jackson.databind.JsonDeserializer; public class InstantDeserializer extends JsonDeserializer { - @Override - public Instant deserialize(JsonParser arg0, DeserializationContext arg1) throws IOException, JsonProcessingException { - String date = arg0.getText(); - date = date.replace(" ", "T"); - date = date.replace("NaN", "00"); - Instant result = Instant.parse(date); - return result; - } + @Override + public Instant deserialize(JsonParser arg0, DeserializationContext arg1) + throws IOException, JsonProcessingException { + String date = arg0.getText(); + date = date.replace(" ", "T"); + date = date.replace("NaN", "00"); + Instant result = Instant.parse(date); + return result; + } } \ No newline at end of file diff --git a/src/main/java/io/twentysixty/sa/client/util/InstantSerializer.java b/src/main/java/io/twentysixty/sa/client/util/InstantSerializer.java index 786aa65..f19fd05 100644 --- a/src/main/java/io/twentysixty/sa/client/util/InstantSerializer.java +++ b/src/main/java/io/twentysixty/sa/client/util/InstantSerializer.java @@ -9,21 +9,18 @@ import com.fasterxml.jackson.databind.SerializerProvider; public class InstantSerializer extends JsonSerializer { - @Override - public void serialize(Instant arg0, JsonGenerator arg1, SerializerProvider arg2) throws IOException, JsonProcessingException { - - String result = arg0.toString(); - /*if (result.length()==24) { - result = result.replace("Z", "000Z"); - } else if (result.length()==25) { - result = result.replace("Z", "00Z"); - } else if (result.length()==26) { - result = result.replace("Z", "0Z"); - }*/ - - arg1.writeString(result); - - } + @Override + public void serialize(Instant arg0, JsonGenerator arg1, SerializerProvider arg2) + throws IOException, JsonProcessingException { + + String result = arg0.toString(); + /* + * if (result.length()==24) { result = result.replace("Z", "000Z"); } else if (result.length()==25) { result = + * result.replace("Z", "00Z"); } else if (result.length()==26) { result = result.replace("Z", "0Z"); } + */ + + arg1.writeString(result); + + } - } \ No newline at end of file diff --git a/src/main/java/io/twentysixty/sa/client/util/JsonUtil.java b/src/main/java/io/twentysixty/sa/client/util/JsonUtil.java index 9adcee8..3a3cf8d 100644 --- a/src/main/java/io/twentysixty/sa/client/util/JsonUtil.java +++ b/src/main/java/io/twentysixty/sa/client/util/JsonUtil.java @@ -9,59 +9,45 @@ public class JsonUtil { public static String serialize(Object obj, boolean pretty) throws JsonProcessingException { - ObjectMapper mapper = JsonMapper.builder() - .findAndAddModules() - - .build(); - mapper.registerModule(new JavaTimeModule()); - mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); + ObjectMapper mapper = JsonMapper.builder().findAndAddModules() - - - if (pretty) { - return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj); - } else { - return mapper.writeValueAsString(obj); - } + .build(); + mapper.registerModule(new JavaTimeModule()); + mapper.configure(SerializationFeature.FAIL_ON_EMPTY_BEANS, false); - - } - - /*public static Object deserialize(String json) throws JsonParseException, JsonMappingException, IOException { - - ObjectMapper mapper = new ObjectMapper(); - Request request = mapper.readValue(json, Request.class); - return - - } - - - public class RawJsonDeserializer extends JsonDeserializer { - - @Override - public String deserialize(JsonParser jp, DeserializationContext ctxt) - throws IOException, JsonProcessingException { - - ObjectMapper mapper = (ObjectMapper) jp.getCodec(); - JsonNode node = mapper.readTree(jp); - return mapper.writeValueAsString(node); - } - } - - public class Request { - - @JsonDeserialize(using = RawJsonDeserializer.class) - private String text; - - public String getText() { - return text; - } - - public void setText(String text) { - this.text = text; + if (pretty) { + return mapper.writerWithDefaultPrettyPrinter().writeValueAsString(obj); + } else { + return mapper.writeValueAsString(obj); } + } - // Getters and setters omitted - }*/ + /* + * public static Object deserialize(String json) throws JsonParseException, JsonMappingException, IOException { + * + * ObjectMapper mapper = new ObjectMapper(); Request request = mapper.readValue(json, Request.class); return + * + * } + * + * + * public class RawJsonDeserializer extends JsonDeserializer { + * + * @Override public String deserialize(JsonParser jp, DeserializationContext ctxt) throws IOException, + * JsonProcessingException { + * + * ObjectMapper mapper = (ObjectMapper) jp.getCodec(); JsonNode node = mapper.readTree(jp); return + * mapper.writeValueAsString(node); } } + * + * public class Request { + * + * @JsonDeserialize(using = RawJsonDeserializer.class) private String text; + * + * public String getText() { return text; } + * + * public void setText(String text) { this.text = text; } + * + * + * // Getters and setters omitted } + */ } diff --git a/src/main/java/io/twentysixty/sa/client/util/TokenGenerator.java b/src/main/java/io/twentysixty/sa/client/util/TokenGenerator.java index b0c2969..03ea37d 100644 --- a/src/main/java/io/twentysixty/sa/client/util/TokenGenerator.java +++ b/src/main/java/io/twentysixty/sa/client/util/TokenGenerator.java @@ -6,23 +6,23 @@ public class TokenGenerator { - public static String generateSHA256Token(String data) { + public static String generateSHA256Token(String data) { + + try { + MessageDigest digest = MessageDigest.getInstance("SHA-256"); + byte[] encodedhash = digest.digest(data.getBytes(StandardCharsets.UTF_8)); + StringBuilder hexString = new StringBuilder(2 * encodedhash.length); + for (byte b : encodedhash) { + String hex = Integer.toHexString(0xff & b); + if (hex.length() == 1) { + hexString.append('0'); + } + hexString.append(hex); + } + return hexString.toString(); + } catch (NoSuchAlgorithmException e) { + return null; + } + } - try { - MessageDigest digest = MessageDigest.getInstance("SHA-256"); - byte[] encodedhash = digest.digest(data.getBytes(StandardCharsets.UTF_8)); - StringBuilder hexString = new StringBuilder(2 * encodedhash.length); - for (byte b : encodedhash) { - String hex = Integer.toHexString(0xff & b); - if (hex.length() == 1) { - hexString.append('0'); - } - hexString.append(hex); - } - return hexString.toString(); - } catch (NoSuchAlgorithmException e) { - return null; - } - } - } diff --git a/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java b/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java index 2d50c23..4574a32 100644 --- a/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java +++ b/src/main/java/io/twentysixty/sa/client/util/testing/Tryme.java @@ -13,13 +13,13 @@ public class Tryme { public static void main(String[] args) throws JsonProcessingException { TextMessage textMessage = new TextMessage(); - + textMessage.setConnectionId(UUID.randomUUID()); textMessage.setId(UUID.randomUUID()); textMessage.setThreadId(UUID.randomUUID()); textMessage.setTimestamp(Instant.now()); - System.out.println(JsonUtil.serialize((BaseMessage)textMessage, true)); - + System.out.println(JsonUtil.serialize((BaseMessage) textMessage, true)); + } }