Changed the SimpleRegistry and VoterRegistryMessage Documentation
The documentation was partial in part of the methodsVoter-Registry
parent
d4d2d2f5b6
commit
4324bdeecd
|
@ -32,6 +32,11 @@ public class SimpleRegistry {
|
|||
this.communicator = communicator;
|
||||
}
|
||||
|
||||
/**
|
||||
* Creates array of Tags in given length
|
||||
* @param length the length og wanted array
|
||||
* @return Tag.Builder[]
|
||||
*/
|
||||
private Tag.Builder[] GetTagsArrayInLength(int length) {
|
||||
Tag.Builder[] tags = new Tag.Builder[length];
|
||||
|
||||
|
@ -96,18 +101,17 @@ public class SimpleRegistry {
|
|||
private List<VoterRegistryMessage> GetRelevantVoterRegistryMessages(List<Tag> tags) throws InvalidProtocolBufferException {
|
||||
List<BulletinBoardAPI.BulletinBoardMessage> relevantMessages = GetRelevantMessages(tags);
|
||||
List<BasicMessage> messages = CollectionMessagesUtils.GetBasicMessagesFromBulletinBoardMessages(relevantMessages);
|
||||
List<VoterRegistryMessage> voterRegistryMessages = CollectionMessagesUtils.ConvertToVoterRegistryMessages(messages);
|
||||
|
||||
return voterRegistryMessages;
|
||||
return CollectionMessagesUtils.ConvertToVoterRegistryMessages(messages);
|
||||
}
|
||||
|
||||
|
||||
/**
|
||||
* Adds new voter to the bulletin-board
|
||||
*
|
||||
* @param voterID
|
||||
* @param voterID id of the new user
|
||||
* @param personalData for example residence location
|
||||
* @return void
|
||||
* @throws throws CommunicationException
|
||||
* @throws CommunicationException, IOException
|
||||
*/
|
||||
public void AddVoter(String voterID, String personalData) throws CommunicationException, IOException {
|
||||
Tag.Builder[] tags = GetTagsArrayInLength(3);
|
||||
|
@ -124,8 +128,8 @@ public class SimpleRegistry {
|
|||
/**
|
||||
* Adding given voter to given group
|
||||
*
|
||||
* @param voterID
|
||||
* @param groupID
|
||||
* @param voterID the voter id
|
||||
* @param groupID the group id to which we want add the voter
|
||||
* @return true if the adding action succeeded else return false
|
||||
* @throws CommunicationException
|
||||
*/
|
||||
|
@ -145,8 +149,8 @@ public class SimpleRegistry {
|
|||
/**
|
||||
* Removes given voter from given group
|
||||
*
|
||||
* @param voterID
|
||||
* @param groupID
|
||||
* @param voterID the voter id
|
||||
* @param groupID the group from which we want to remove the user
|
||||
* @return true if the removing action succeeded else return false
|
||||
* @throws CommunicationException
|
||||
*/
|
||||
|
@ -190,7 +194,7 @@ public class SimpleRegistry {
|
|||
* @throws CommunicationException, InvalidProtocolBufferException
|
||||
*/
|
||||
public List<String> GetGroups(String id) throws CommunicationException, InvalidProtocolBufferException {
|
||||
List<Tag> GroupsActionsTags = new ArrayList<Tag>();
|
||||
List<Tag> GroupsActionsTags = new ArrayList<>();
|
||||
GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.ID_TAG + " " + id).build());
|
||||
GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.GROUP_ACTION_TAG + " " + RegistryTags.REMOVE_FROM_GROUP_TAG).build());
|
||||
GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.GROUP_ACTION_TAG + " " + RegistryTags.ADD_TO_GROUP_TAG).build());
|
||||
|
@ -213,7 +217,7 @@ public class SimpleRegistry {
|
|||
* @throws CommunicationException
|
||||
*/
|
||||
public List<String> GetPersonIDDetails(String id) throws CommunicationException, InvalidProtocolBufferException, ParseException {
|
||||
List<Tag> GroupsActionsTags = new ArrayList<Tag>();
|
||||
List<Tag> GroupsActionsTags = new ArrayList<>();
|
||||
GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.ID_TAG + " " + id).build());
|
||||
GroupsActionsTags.add(Tag.newBuilder().setContent(RegistryTags.VOTER_ENTRY_TAG.toString()).build());
|
||||
|
||||
|
|
|
@ -20,7 +20,7 @@ public class VoterRegistryMessage {
|
|||
|
||||
/**
|
||||
* Gets the wanted tag from given basic message
|
||||
* @param tagName
|
||||
* @param tagName the name of the tag
|
||||
* @return string
|
||||
*/
|
||||
public String GetWantedTagFromBasicMessage(RegistryTags tagName){
|
||||
|
@ -51,7 +51,7 @@ public class VoterRegistryMessage {
|
|||
|
||||
/**
|
||||
* Checks if the given message have the ADD_TO_GROUP_TAG
|
||||
* @return
|
||||
* @return true when ADD_TO_GROUP_TAG exist else false
|
||||
*/
|
||||
public boolean IsGroupAdding() {
|
||||
for (ProtobufsMessages.Tag tag : base.getTagList()) {
|
||||
|
|
Loading…
Reference in New Issue