diff --git a/src/main/java/biz/nynja/account/models/Account.java b/src/main/java/biz/nynja/account/models/Account.java index 6920d9d8f2bb71810aedf95da5031a13ec409d71..a5f54e2133569a3a50457691d1562d3316dad099 100644 --- a/src/main/java/biz/nynja/account/models/Account.java +++ b/src/main/java/biz/nynja/account/models/Account.java @@ -29,7 +29,7 @@ public class Account { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private String qrCode; @@ -96,11 +96,11 @@ public class Account { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -354,7 +354,7 @@ public class Account { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getRoles() != null) { for (String role : getRoles()) { diff --git a/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java b/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java index bdfa04f39265090c0f3d7ae95c00aa643285bd2b..92788ccaef19504bd9a28528340f57c9bf9f317b 100644 --- a/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java +++ b/src/main/java/biz/nynja/account/models/AccountByAuthenticationProvider.java @@ -22,7 +22,7 @@ public class AccountByAuthenticationProvider { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -89,11 +89,11 @@ public class AccountByAuthenticationProvider { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -339,7 +339,7 @@ public class AccountByAuthenticationProvider { builder.setQrCode(getQrCode()); } if (avatar != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (contactsInfo != null) { for (ContactInfo c : contactsInfo) { diff --git a/src/main/java/biz/nynja/account/models/AccountByProfileId.java b/src/main/java/biz/nynja/account/models/AccountByProfileId.java index fe37f192bae897b104380175bfcc66cecc0d36c0..adf01aa7f6252371c72fde5d398b8d77fe827820 100644 --- a/src/main/java/biz/nynja/account/models/AccountByProfileId.java +++ b/src/main/java/biz/nynja/account/models/AccountByProfileId.java @@ -23,7 +23,7 @@ public class AccountByProfileId { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -90,11 +90,11 @@ public class AccountByProfileId { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -341,7 +341,7 @@ public class AccountByProfileId { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getContactsInfo() != null) { for (ContactInfo c : contactsInfo) { diff --git a/src/main/java/biz/nynja/account/models/AccountByQrCode.java b/src/main/java/biz/nynja/account/models/AccountByQrCode.java index f80d84f263caaed54a51c501be434a515a3972a2..e2b8f689697bb560a454c568d5aa8d295cea8e29 100644 --- a/src/main/java/biz/nynja/account/models/AccountByQrCode.java +++ b/src/main/java/biz/nynja/account/models/AccountByQrCode.java @@ -21,7 +21,7 @@ public class AccountByQrCode { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -87,11 +87,11 @@ public class AccountByQrCode { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -322,7 +322,7 @@ public class AccountByQrCode { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getRoles() != null) { for (String role : getRoles()) { diff --git a/src/main/java/biz/nynja/account/models/AccountByUsername.java b/src/main/java/biz/nynja/account/models/AccountByUsername.java index ed40828a67ef508733e32e18410c77d9f4711d8a..52a1a12c1c754d9778a47c42cc8845f4619cdfe1 100644 --- a/src/main/java/biz/nynja/account/models/AccountByUsername.java +++ b/src/main/java/biz/nynja/account/models/AccountByUsername.java @@ -22,7 +22,7 @@ public class AccountByUsername { private String authenticationProviderType; private String firstName; private String lastName; - private ByteBuffer avatar; + private String avatar; private String accountName; private String username; private Long creationTimestamp; @@ -89,11 +89,11 @@ public class AccountByUsername { this.lastName = lastName; } - public ByteBuffer getAvatar() { + public String getAvatar() { return avatar; } - public void setAvatar(ByteBuffer avatar) { + public void setAvatar(String avatar) { this.avatar = avatar; } @@ -340,7 +340,7 @@ public class AccountByUsername { builder.setQrCode(getQrCode()); } if (getAvatar() != null) { - builder.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + builder.setAvatar(avatar); } if (getRoles() != null) { for (String role : getRoles()) { diff --git a/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java b/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java index 3254ff1b73434172817e16fac86e184db66537df..38f4bff208bfe3027a2be163255b75c1f537ca8c 100644 --- a/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java +++ b/src/main/java/biz/nynja/account/repositories/AccountRepositoryAdditionalImpl.java @@ -140,7 +140,7 @@ public class AccountRepositoryAdditionalImpl implements AccountRepositoryAdditio newAccount.setAuthenticationProviderType(pendingAccount.getAuthenticationProviderType()); newAccount.setFirstName(request.getFirstName()); newAccount.setLastName(request.getLastName()); - newAccount.setAvatar(request.getAvatar().asReadOnlyByteBuffer()); + newAccount.setAvatar(request.getAvatar()); newAccount.setAccountName(request.getAccountName()); newAccount.setUsername(request.getUsername()); newAccount.setCreationTimestamp(creationTimestamp); @@ -322,7 +322,7 @@ public class AccountRepositoryAdditionalImpl implements AccountRepositoryAdditio private void updateAccountData(CassandraBatchOperations batchOps, UpdateAccountRequest request, Account existingAccount, Long lastUpdateTimestamp) { Account updatedAccount = existingAccount; - updatedAccount.setAvatar(request.getAvatar().asReadOnlyByteBuffer()); + updatedAccount.setAvatar(request.getAvatar()); updatedAccount.setAccountMark(request.getAccountMark()); updatedAccount.setAccountName(request.getAccountName()); updatedAccount.setFirstName(request.getFirstName()); diff --git a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java index 6502596f4762845efb16ceb8bce30ea29570c655..b9fdf4aa5d8a7afca9e494565b0b8eb53e570664 100644 --- a/src/main/java/biz/nynja/account/services/AccountServiceImpl.java +++ b/src/main/java/biz/nynja/account/services/AccountServiceImpl.java @@ -3,7 +3,6 @@ */ package biz.nynja.account.services; -import java.nio.ByteBuffer; import java.util.Optional; import java.util.UUID; @@ -766,13 +765,12 @@ public class AccountServiceImpl extends AccountServiceGrpc.AccountServiceImplBas return; } - private SearchResultDetails buildSearchResultDetails(String id, ByteBuffer avatar, String firstName, - String lastName) { + private SearchResultDetails buildSearchResultDetails(String id, String avatar, String firstName, String lastName) { SearchResultDetails.Builder searchResultDetails = SearchResultDetails.newBuilder(); searchResultDetails.setFirstName(firstName).setLastName(lastName); if (avatar != null) { - searchResultDetails.setAvatar(com.google.protobuf.ByteString.copyFrom(avatar)); + searchResultDetails.setAvatar(avatar); } return searchResultDetails.build(); diff --git a/src/test/java/biz/nynja/account/utils/Util.java b/src/test/java/biz/nynja/account/utils/Util.java index 11d213e1f912972c499dd77bcd81f2d58b997bbf..a55aa71b9545d420ff3c1c64518aad925ef90d53 100644 --- a/src/test/java/biz/nynja/account/utils/Util.java +++ b/src/test/java/biz/nynja/account/utils/Util.java @@ -44,7 +44,7 @@ public class Util { public static final String UPDATED_ACCOUNT_MARK = "PRIVATE"; public static final String AUTHENTICATION_PROVIDER = "Provider"; public static final String AUTHENTICATION_PROVIDER_TYPE = "ProviderType"; - public static final ByteBuffer AVATAR = ByteBuffer.allocate(42); + public static final String AVATAR = "avatar"; public static final String ACCOUNT_NAME = "AccountName"; public static final String ACCOUNT_STATUS = "active"; public static final long CREATION_TIMESTAMP = 45; @@ -283,7 +283,7 @@ public class Util { public AccountByUsername savedResponse() { AccountByUsername response = new AccountByUsername(); response.setAccountId(Util.ACCOUNT_ID); - response.setAvatar(ByteBuffer.wrap(S_AVATAR_STRING.getBytes())); + response.setAvatar(S_AVATAR_STRING); response.setFirstName(Util.S_FIRST_NAME); response.setLastName(Util.S_LAST_NAME); return response; @@ -293,7 +293,7 @@ public class Util { public AccountByAuthenticationProvider savedResponseProvider() { AccountByAuthenticationProvider response = new AccountByAuthenticationProvider(); response.setAccountId(Util.ACCOUNT_ID); - response.setAvatar(ByteBuffer.wrap(S_AVATAR_STRING.getBytes())); + response.setAvatar(S_AVATAR_STRING); response.setFirstName(Util.S_FIRST_NAME); response.setLastName(Util.S_LAST_NAME); return response; @@ -303,7 +303,7 @@ public class Util { public AccountByQrCode savedResponseQrCode() { AccountByQrCode response = new AccountByQrCode(); response.setAccountId(Util.ACCOUNT_ID); - response.setAvatar(ByteBuffer.wrap(S_AVATAR_STRING.getBytes())); + response.setAvatar(S_AVATAR_STRING); response.setFirstName(Util.S_FIRST_NAME); response.setLastName(Util.S_LAST_NAME); response.setQrCode(Util.S_QR_CODE);