Commit f09d5d35 authored by Filipe de Lima Brito's avatar Filipe de Lima Brito Committed by GitHub

Merge pull request #526 from estevanfick/develop

[FIX] Missing name field in Realm database.
parents 7d8390a7 1264e85d
package chat.rocket.persistence.realm.models.ddp;
import java.util.ArrayList;
import java.util.List;
import chat.rocket.core.models.Email;
import chat.rocket.core.models.User;
import io.realm.Realm;
import io.realm.RealmList;
import io.realm.RealmObject;
import io.realm.RealmQuery;
import io.realm.annotations.PrimaryKey;
import java.util.ArrayList;
import java.util.List;
import chat.rocket.core.models.Email;
import chat.rocket.core.models.User;
/**
* RealmUser.
*/
......@@ -19,6 +19,7 @@ import chat.rocket.core.models.User;
public class RealmUser extends RealmObject {
public static final String ID = "_id";
public static final String NAME = "name";
public static final String USERNAME = "username";
public static final String STATUS = "status";
public static final String UTC_OFFSET = "utcOffset";
......@@ -31,6 +32,7 @@ public class RealmUser extends RealmObject {
public static final String STATUS_OFFLINE = "offline";
@PrimaryKey private String _id;
private String name;
private String username;
private String status;
private double utcOffset;
......@@ -57,6 +59,14 @@ public class RealmUser extends RealmObject {
this.username = username;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public String getStatus() {
return status;
}
......@@ -96,6 +106,7 @@ public class RealmUser extends RealmObject {
return User.builder()
.setId(_id)
.setName(name)
.setUsername(username)
.setStatus(status)
.setUtcOffset(utcOffset)
......@@ -108,6 +119,7 @@ public class RealmUser extends RealmObject {
public String toString() {
return "RealmUser{" +
"_id='" + _id + '\'' +
", name='" + name + '\'' +
", username='" + username + '\'' +
", status='" + status + '\'' +
", utcOffset=" + utcOffset +
......@@ -133,6 +145,9 @@ public class RealmUser extends RealmObject {
if (_id != null ? !_id.equals(user._id) : user._id != null) {
return false;
}
if (name != null ? !name.equals(user.name) : user.name != null) {
return false;
}
if (username != null ? !username.equals(user.username) : user.username != null) {
return false;
}
......@@ -151,6 +166,7 @@ public class RealmUser extends RealmObject {
int result;
long temp;
result = _id != null ? _id.hashCode() : 0;
result = 31 * result + (name != null ? name.hashCode() : 0);
result = 31 * result + (username != null ? username.hashCode() : 0);
result = 31 * result + (status != null ? status.hashCode() : 0);
temp = Double.doubleToLongBits(utcOffset);
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment