From ef70b720271f4479808f3ffb2511e9cc04002498 Mon Sep 17 00:00:00 2001 From: Stoyan Hristov Date: Wed, 12 Dec 2018 17:18:56 +0200 Subject: [PATCH] NY-5816 : add birthday to AccountByQrCode model --- .../nynja/account/models/AccountByQrCode.java | 39 ++++++++++++++----- 1 file changed, 30 insertions(+), 9 deletions(-) diff --git a/src/main/java/biz/nynja/account/models/AccountByQrCode.java b/src/main/java/biz/nynja/account/models/AccountByQrCode.java index a5c65eb..17d0b89 100644 --- a/src/main/java/biz/nynja/account/models/AccountByQrCode.java +++ b/src/main/java/biz/nynja/account/models/AccountByQrCode.java @@ -3,14 +3,15 @@ */ package biz.nynja.account.models; -import java.nio.ByteBuffer; +import java.time.LocalDate; import java.util.Set; import java.util.UUID; import biz.nynja.account.grpc.AccessStatus; import biz.nynja.account.grpc.AccountDetails; -import biz.nynja.account.grpc.Role; import biz.nynja.account.grpc.AccountDetails.Builder; +import biz.nynja.account.grpc.Date; +import biz.nynja.account.grpc.Role; public class AccountByQrCode { @@ -30,6 +31,7 @@ public class AccountByQrCode { private String qrCode; private String accessStatus; private Set roles; + private LocalDate birthday; public UUID getProfileId() { return profileId; @@ -163,13 +165,14 @@ public class AccountByQrCode { public int hashCode() { final int prime = 31; int result = 1; + result = prime * result + ((accessStatus == null) ? 0 : accessStatus.hashCode()); result = prime * result + ((accountId == null) ? 0 : accountId.hashCode()); result = prime * result + ((accountMark == null) ? 0 : accountMark.hashCode()); result = prime * result + ((accountName == null) ? 0 : accountName.hashCode()); - result = prime * result + ((accessStatus == null) ? 0 : accessStatus.hashCode()); result = prime * result + ((authenticationProvider == null) ? 0 : authenticationProvider.hashCode()); result = prime * result + ((authenticationProviderType == null) ? 0 : authenticationProviderType.hashCode()); result = prime * result + ((avatar == null) ? 0 : avatar.hashCode()); + result = prime * result + ((birthday == null) ? 0 : birthday.hashCode()); result = prime * result + ((contactsInfo == null) ? 0 : contactsInfo.hashCode()); result = prime * result + ((creationTimestamp == null) ? 0 : creationTimestamp.hashCode()); result = prime * result + ((firstName == null) ? 0 : firstName.hashCode()); @@ -191,6 +194,11 @@ public class AccountByQrCode { if (getClass() != obj.getClass()) return false; AccountByQrCode other = (AccountByQrCode) obj; + if (accessStatus == null) { + if (other.accessStatus != null) + return false; + } else if (!accessStatus.equals(other.accessStatus)) + return false; if (accountId == null) { if (other.accountId != null) return false; @@ -206,11 +214,6 @@ public class AccountByQrCode { return false; } else if (!accountName.equals(other.accountName)) return false; - if (accessStatus == null) { - if (other.accessStatus != null) - return false; - } else if (!accessStatus.equals(other.accessStatus)) - return false; if (authenticationProvider == null) { if (other.authenticationProvider != null) return false; @@ -226,6 +229,11 @@ public class AccountByQrCode { return false; } else if (!avatar.equals(other.avatar)) return false; + if (birthday == null) { + if (other.birthday != null) + return false; + } else if (!birthday.equals(other.birthday)) + return false; if (contactsInfo == null) { if (other.contactsInfo != null) return false; @@ -284,7 +292,8 @@ public class AccountByQrCode { .append(", username=").append(username).append(", accessStatus=").append(accessStatus) .append(", creationTimestamp=").append(creationTimestamp).append(", lastUpdateTimestamp=") .append(lastUpdateTimestamp).append(", qrCode=").append(qrCode).append(", contactsInfo=") - .append(contactsInfo).append(", roles=").append(roles).append("]").toString(); + .append(contactsInfo).append(", roles=").append(roles).append(", birthday=").append(birthday) + .append("]").toString(); } public AccountDetails toProto() { @@ -337,6 +346,10 @@ public class AccountByQrCode { builder.addContactsInfo(c.toProto()); } } + if (getBirthday() != null) { + builder.setBirthday(Date.newBuilder().setYear(getBirthday().getYear()) + .setMonth(getBirthday().getMonthValue()).setDay(getBirthday().getDayOfMonth()).build()); + } if (getCreationTimestamp() != null) { builder.setCreationTimestamp(getCreationTimestamp()); } @@ -348,4 +361,12 @@ public class AccountByQrCode { } + public LocalDate getBirthday() { + return birthday; + } + + public void setBirthday(LocalDate birthday) { + this.birthday = birthday; + } + } -- GitLab