Changed the VoterRegistryMessage to wrap UnsignedBulletinBoardMessage
there is no need to wrap unused basic message when using UnsignedBulletinBoardMessageVoter-Registry
parent
1815863746
commit
dfc5bf4b24
|
@ -1,5 +1,6 @@
|
||||||
package meerkat;
|
package meerkat;
|
||||||
|
|
||||||
|
import meerkat.protobuf.BulletinBoardAPI;
|
||||||
import util.AccurateTimestamp;
|
import util.AccurateTimestamp;
|
||||||
import util.RegistryTags;
|
import util.RegistryTags;
|
||||||
|
|
||||||
|
@ -12,10 +13,10 @@ import java.text.ParseException;
|
||||||
*/
|
*/
|
||||||
public class VoterRegistryMessage {
|
public class VoterRegistryMessage {
|
||||||
|
|
||||||
public ProtobufsMessages.BasicMessage base;
|
public BulletinBoardAPI.UnsignedBulletinBoardMessage base;
|
||||||
|
|
||||||
public VoterRegistryMessage(ProtobufsMessages.BasicMessage message){
|
public VoterRegistryMessage(BulletinBoardAPI.UnsignedBulletinBoardMessage message){
|
||||||
base = ProtobufsMessages.BasicMessage.newBuilder().addAllTag(message.getTagList()).build();
|
base = BulletinBoardAPI.UnsignedBulletinBoardMessage.newBuilder().addAllTag(message.getTagList()).build();
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,9 +25,9 @@ public class VoterRegistryMessage {
|
||||||
* @return string
|
* @return string
|
||||||
*/
|
*/
|
||||||
public String GetWantedTagFromBasicMessage(RegistryTags tagName){
|
public String GetWantedTagFromBasicMessage(RegistryTags tagName){
|
||||||
for (ProtobufsMessages.Tag tag : base.getTagList()) {
|
for (String tag : base.getTagList()) {
|
||||||
if ( tag.getContent().contains(tagName.toString())) {
|
if ( tag.contains(tagName.toString())) {
|
||||||
return tag.getContent();
|
return tag;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
return null;
|
return null;
|
||||||
|
@ -38,9 +39,9 @@ public class VoterRegistryMessage {
|
||||||
* @throws ParseException
|
* @throws ParseException
|
||||||
*/
|
*/
|
||||||
public Timestamp GetBasicMessageActionTimestamp() throws ParseException {
|
public Timestamp GetBasicMessageActionTimestamp() throws ParseException {
|
||||||
for (ProtobufsMessages.Tag tag : base.getTagList()) {
|
for (String tag : base.getTagList()) {
|
||||||
if ( tag.getContent().contains(RegistryTags.ACTION_TIMESTAMP_TAG.toString())) {
|
if ( tag.contains(RegistryTags.ACTION_TIMESTAMP_TAG.toString())) {
|
||||||
String[] tagParts = tag.getContent().split(" ");
|
String[] tagParts = tag.split(" ");
|
||||||
String timestamp = tagParts[tagParts.length - 1];
|
String timestamp = tagParts[tagParts.length - 1];
|
||||||
return AccurateTimestamp.GetTimestampFromString(timestamp);
|
return AccurateTimestamp.GetTimestampFromString(timestamp);
|
||||||
}
|
}
|
||||||
|
@ -54,8 +55,8 @@ public class VoterRegistryMessage {
|
||||||
* @return true when ADD_TO_GROUP_TAG exist else false
|
* @return true when ADD_TO_GROUP_TAG exist else false
|
||||||
*/
|
*/
|
||||||
public boolean IsGroupAdding() {
|
public boolean IsGroupAdding() {
|
||||||
for (ProtobufsMessages.Tag tag : base.getTagList()) {
|
for (String tag : base.getTagList()) {
|
||||||
if ( tag.getContent().contains(RegistryTags.ADD_TO_GROUP_TAG.toString())) {
|
if ( tag.contains(RegistryTags.ADD_TO_GROUP_TAG.toString())) {
|
||||||
return true;
|
return true;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in New Issue