Created the SimpleRegistry file
SimpleRegistry expose the ability of manging voters information (their groups, and personal data)vote-registry
parent
4aa6c25c0f
commit
070b851203
|
@ -30,7 +30,7 @@ ext {
|
||||||
nexusPassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : ""
|
nexusPassword = project.hasProperty('nexusPassword') ? project.property('nexusPassword') : ""
|
||||||
}
|
}
|
||||||
|
|
||||||
description = "Meerkat Voter Registry application"
|
description = "Meerkat Voter SimpleRegistry application"
|
||||||
|
|
||||||
// Your project version
|
// Your project version
|
||||||
version = "0.0"
|
version = "0.0"
|
||||||
|
|
|
@ -1,13 +0,0 @@
|
||||||
package meerkat;
|
|
||||||
import meerkat.ProtobufsMessages.*;
|
|
||||||
|
|
||||||
/**
|
|
||||||
* Created by Vladimir Eliezer Tokarev on 1/8/2016.
|
|
||||||
*
|
|
||||||
*/
|
|
||||||
public class Registry {
|
|
||||||
|
|
||||||
public boolean TryAddVoter(String voterID, String personalData) throws IllegalArgumentException{
|
|
||||||
private
|
|
||||||
}
|
|
||||||
}
|
|
|
@ -0,0 +1,137 @@
|
||||||
|
package meerkat;
|
||||||
|
import meerkat.ProtobufsMessages.*;
|
||||||
|
import meerkat.comm.CommunicationException;
|
||||||
|
|
||||||
|
import java.util.List;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Created by Vladimir Eliezer Tokarev on 1/8/2016.
|
||||||
|
* Gives the ability to manage voters information
|
||||||
|
* This object is synchronous (which meaning its method blocking)
|
||||||
|
*/
|
||||||
|
public class SimpleRegistry {
|
||||||
|
|
||||||
|
public SimpleRegistry(){
|
||||||
|
// inits the encoding object
|
||||||
|
// inits the connection data
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to add new voter to the bulletin-board
|
||||||
|
* @param voterID
|
||||||
|
* @param personalData for example residence location
|
||||||
|
* @throws throws CommunicationException
|
||||||
|
* @return true if the adding action succeeded else return false
|
||||||
|
*/
|
||||||
|
public boolean AddVoter(String voterID, String personalData) throws CommunicationException {
|
||||||
|
/**
|
||||||
|
* try:
|
||||||
|
* Create basic message for adding new voter
|
||||||
|
* Create bulletin board message using CreateBulletinBoardMessage
|
||||||
|
* use SimpleBulletinBoardClient.PostMessage to send the message
|
||||||
|
* return true
|
||||||
|
* catch exception:
|
||||||
|
* return false
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries adding given voter to given group
|
||||||
|
* @param voterID
|
||||||
|
* @param groupID
|
||||||
|
* @throws CommunicationException
|
||||||
|
* @return true if the adding action succeeded else return false
|
||||||
|
*/
|
||||||
|
public boolean AddToGroup(String voterID, String groupID) throws CommunicationException {
|
||||||
|
/**
|
||||||
|
* try:
|
||||||
|
* Create basic message for adding the given voter to the wanted group
|
||||||
|
* Create bulletin board message using CreateBulletinBoardMessage
|
||||||
|
* use SimpleBulletinBoardClient.PostMessage to send the message
|
||||||
|
* return true
|
||||||
|
* catch exception:
|
||||||
|
* return false
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries remove given voter from given group
|
||||||
|
* @param voterID
|
||||||
|
* @param groupID
|
||||||
|
* @return true if the removing action succeeded else return false
|
||||||
|
* @throws CommunicationException
|
||||||
|
*/
|
||||||
|
public boolean RemoveFromGroup(String voterID, String groupID) throws CommunicationException {
|
||||||
|
/**
|
||||||
|
* try:
|
||||||
|
* Create basic message for removing the given voter from the wanted group
|
||||||
|
* Create bulletin board message using CreateBulletinBoardMessage
|
||||||
|
* use SimpleBulletinBoardClient.PostMessage to send the message
|
||||||
|
* return true
|
||||||
|
* catch exception:
|
||||||
|
* return false
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Tries to set that the voter have voted
|
||||||
|
* @param id
|
||||||
|
* @return true if the set voted succeded else false
|
||||||
|
* @throws CommunicationException
|
||||||
|
*/
|
||||||
|
public boolean SetVoted(String id) throws CommunicationException {
|
||||||
|
/**
|
||||||
|
* try:
|
||||||
|
* Create basic message set voted
|
||||||
|
* Create bulletin board message using CreateBulletinBoardMessage
|
||||||
|
* use SimpleBulletinBoardClient.PostMessage to send the message
|
||||||
|
* return true
|
||||||
|
* catch exception:
|
||||||
|
* return false
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Craetes bulletin board message from basic message (with the signatures parts)
|
||||||
|
* @param basicMessage array of bytes
|
||||||
|
* @return
|
||||||
|
*/
|
||||||
|
private byte[] CreateBulletinBoardMessage(byte[] basicMessage) {
|
||||||
|
/**
|
||||||
|
* encode the basic message
|
||||||
|
* create bulletin board message
|
||||||
|
* put the basic message in bulletin board message
|
||||||
|
* put the encoded messages signature into the bulletin board message
|
||||||
|
* return the bulletin board message
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Requests all the groups that the given id voter is in
|
||||||
|
* @param ID
|
||||||
|
* @return list of groups ids (or names), if the method fails its empty
|
||||||
|
* @throws CommunicationException
|
||||||
|
*/
|
||||||
|
public List<String> GetGroups(String ID) throws CommunicationException {
|
||||||
|
/**
|
||||||
|
* Retrieve all List<BulletinBoardMessage> that contains this id
|
||||||
|
* creates new list of strings with the names of the group
|
||||||
|
* Returns the created list
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Retreives list of strings that represents voter
|
||||||
|
* @param id
|
||||||
|
* @return list of strings (empty list if the lookup failed)
|
||||||
|
* @throws CommunicationException
|
||||||
|
*/
|
||||||
|
public List<String> GetPersonIDDetails(String id) throws CommunicationException {
|
||||||
|
/**
|
||||||
|
* Retreive all List<BulletinBoardMessage> that contains this id
|
||||||
|
* search for message with the wanted personal data
|
||||||
|
* Create list with personal data
|
||||||
|
* return the list
|
||||||
|
*/
|
||||||
|
}
|
||||||
|
}
|
Loading…
Reference in New Issue