diff options
author | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-01 15:07:20 +0100 |
---|---|---|
committer | Daniel Gultsch <daniel.gultsch@rwth-aachen.de> | 2014-02-01 15:07:20 +0100 |
commit | 53d9c9997a508985f0e19aba928bfa25c80ba23e (patch) | |
tree | 5e79bfe04db8d51091bcf9b94baa979217e9d542 /src/de/gultsch/chat/entities | |
parent | 43531113b798cda6b2f76257641f38b0af986437 (diff) |
more cleanup. more listeners
Diffstat (limited to '')
-rw-r--r-- | src/de/gultsch/chat/entities/AbstractEntity.java | 4 | ||||
-rw-r--r-- | src/de/gultsch/chat/entities/Conversation.java | 10 | ||||
-rw-r--r-- | src/de/gultsch/chat/entities/Message.java | 7 |
3 files changed, 20 insertions, 1 deletions
diff --git a/src/de/gultsch/chat/entities/AbstractEntity.java b/src/de/gultsch/chat/entities/AbstractEntity.java index d62385a6..31a19fc0 100644 --- a/src/de/gultsch/chat/entities/AbstractEntity.java +++ b/src/de/gultsch/chat/entities/AbstractEntity.java @@ -18,4 +18,8 @@ public abstract class AbstractEntity implements Serializable { public abstract ContentValues getContentValues(); + public boolean equals(AbstractEntity entity) { + return this.getUuid().equals(entity.getUuid()); + } + } diff --git a/src/de/gultsch/chat/entities/Conversation.java b/src/de/gultsch/chat/entities/Conversation.java index 10eb7079..ca359477 100644 --- a/src/de/gultsch/chat/entities/Conversation.java +++ b/src/de/gultsch/chat/entities/Conversation.java @@ -32,11 +32,13 @@ public class Conversation extends AbstractEntity { private long created; private transient List<Message> messages = null; + private transient Account account = null; public Conversation(String name, String profilePhoto, Account account, String contactJid) { this(java.util.UUID.randomUUID().toString(), name, profilePhoto, account.getUuid(), contactJid, System .currentTimeMillis(), STATUS_AVAILABLE); + this.account = account; } public Conversation(String uuid, String name, String profilePhoto, @@ -93,7 +95,15 @@ public class Conversation extends AbstractEntity { public String getAccountUuid() { return this.accountUuid; } + + public Account getAccount() { + return this.account; + } + public void setAccount(Account account) { + this.account = account; + } + public String getContactJid() { return this.contactJid; } diff --git a/src/de/gultsch/chat/entities/Message.java b/src/de/gultsch/chat/entities/Message.java index 130435b9..530a4db4 100644 --- a/src/de/gultsch/chat/entities/Message.java +++ b/src/de/gultsch/chat/entities/Message.java @@ -39,7 +39,12 @@ public class Message extends AbstractEntity { Message.STATUS_UNSEND); this.conversation = conversation; } - + + public Message(Conversation conversation, String counterpart, String body, int encryption, int status) { + this(java.util.UUID.randomUUID().toString(), conversation.getUuid(),counterpart, body, System.currentTimeMillis(), encryption,status); + this.conversation = conversation; + } + public Message(String uuid, String conversationUUid, String counterpart, String body, long timeSent, int encryption, int status) { this.uuid = uuid; |