SOA
© 2004 SoS Group
All Rights Reserved

sos.koa
Class ImportCandidatesAdapter

java.lang.Object
  extended bysos.koa.Task
      extended bysos.koa.ImportCandidatesAdapter
All Implemented Interfaces:
java.awt.event.ActionListener, java.util.EventListener, KOAConstants

public class ImportCandidatesAdapter
extends Task

Class to handle importing candidate file.

Version:
$Id: ImportCandidatesAdapter.java,v 1.55 2004/05/21 20:39:37 hubbers Exp $
Author:
Martijn Oostdijk (martijno@cs.kun.nl)

Class Specifications

Specifications inherited from class Task
invariant 0 <= subTaskCount&&subTaskCount <= maxSubTasks;

Nested Class Summary
(package private)  class ImportCandidatesAdapter.CandidateFileChecker
          Inner class to do light-weight sanity check on xml file.
(package private)  class ImportCandidatesAdapter.CandidateFileParser
          Inner class to parse the candidate list file.
 
Nested classes inherited from class sos.koa.Task
Task.ActionThread, Task.MonitoredThread
 
Field Summary
(package private)  CandidateList candidates
          The candidate list.
(package private)  boolean keepRunning
          Whether to keep importing.
(package private)  int taskCount
          Number of codes encountered thus far.
 
Fields inherited from class sos.koa.Task
maxSubTasks, monitor, stillWorking, subTaskCount, success
 
Fields inherited from interface sos.koa.KOAConstants
ADDITIONAL_INFO_EXTRA, ADDITIONAL_INFO_MAX_HEIGHT, ADDITIONAL_INFO_MAX_WIDTH, AUDITLOG, AUDITLOG_PDF, AUDITLOG_XML, AUDITLOG_XSL, BASEDIR, CANDIDATES_IMPORTED_STATE, CLEAR_BUT_TXT, CLEAR_FAILURE_MSG, CLEAR_SUCCESS_MSG, CLEAR_TASK_MSG, CLEAR_WARNING_MSG, CLEAR_WARNING_MSG_1, CLEAR_WARNING_MSG_2, CLEARED_STATE, COUNT_BUT_TXT, COUNT_FAILURE_MSG, COUNT_SUCCESS_MSG, COUNT_TASK_MSG, COUNT_WARNING_MSG, DECRYPT_BUT_TXT, DECRYPT_ERROR_MSG, DECRYPT_ERROR_TAG, DECRYPT_FAILURE_MSG, DECRYPT_SUCCESS_MSG, DECRYPT_TASK_MSG, DECRYPT_WARNING_MSG, DECRYPTEDFILE, DEFAULT_VOTING_INTERVAL, EXIT_BUT_TXT, EXIT_FAILURE_MSG, EXIT_SUCCESS_MSG, EXIT_TASK_MSG, EXIT_WARNING_MSG, FORWARD_BACK_OPTIONS, FORWARD_MOREINFO_BACK_OPTIONS, HELP_BUT_TXT, HELP_TASK_MSG, IMPORT_CANDIDATES_BUT_TXT, IMPORT_CANDIDATES_FAILURE_MSG, IMPORT_CANDIDATES_SUCCESS_MSG, IMPORT_CANDIDATES_TASK_MSG, IMPORT_CANDIDATES_WARNING_MSG, IMPORT_KEY_FAILURE_MSG, IMPORT_KEY_SUCCESS_MSG, IMPORT_KEY_WARNING_MSG, IMPORT_PRIVATE_KEY_BUT_TXT, IMPORT_PRIVATE_KEY_TASK_MSG, IMPORT_PUBLIC_KEY_BUT_TXT, IMPORT_PUBLIC_KEY_TASK_MSG, IMPORT_VOTES_BUT_TXT, IMPORT_VOTES_FAILURE_MSG, IMPORT_VOTES_SUCCESS_MSG, IMPORT_VOTES_TASK_MSG, IMPORT_VOTES_WARNING_MSG, INIT_STATE, LESSINFO_OPTION, MAX_ENCRYPTED_VOTE_LENGTH, MAX_KEY_LENGTH, MOREINFO_OPTION, NO_ERRORS_MSG, NUMBER_OF_REDUNDANT_FIELDS, OK_CANCEL_OPTIONS, OK_LESSINFO_CANCEL_OPTIONS, OK_LESSINFO_OPTIONS, OK_MOREINFO_CANCEL_OPTIONS, OK_MOREINFO_OPTIONS, OK_OPTIONS, OUTDIR, PRIVATE_KEY_IMPORTED_STATE, PRIVATE_KEYTYPE, PUBLIC_KEY_IMPORTED_STATE, PUBLIC_KEYTYPE, RECOUNT, RECOUNT_PDF, RECOUNT_XML, RECOUNT_XSL, RELEASE, REPORT_BUT_TXT, REPORT_FAILURE_MSG, REPORT_GENERATED_STATE, REPORT_OPTIONS, REPORT_SUCCESS_MSG, REPORT_TASK_MSG, REPORT_WARNING_MSG, RESTART_BUT_TXT, RESTART_FAILURE_MSG, RESTART_SUCCESS_MSG, RESTART_TASK_MSG, RESTART_WARNING_MSG, TASK_CANCELED_MSG, TITLE, VOTES_COUNTED_STATE, VOTES_DECRYPTED_STATE, VOTES_IGNORED_SEE_MORE_INFO_MSG, VOTES_IMPORTED_STATE, YES_CANCEL_OPTIONS, YES_NO_OPTIONS
 
Constructor Summary
ImportCandidatesAdapter()
          Constructs this adapter.
 
Method Summary
(package private)  void clear()
          Clears temporary memory used by this task.
(package private)  void doAction()
          Imports the candidates.
(package private)  java.lang.Object getAdditionalInfo()
          Gets the additional information.
(package private)  java.lang.String getFailureMessage()
          What to print in failure dialog.
(package private)  java.lang.String getInfo()
          Gets information to put in popup dialog after successful completion of this task.
(package private)  java.lang.String getSuccessMessage()
          What to print in success dialog.
(package private)  int getSuccessState()
          The application state after successful completion of this task.
(package private)  java.lang.String getTitle()
          The title of this task.
(package private)  boolean isAdditionalInfoAvailable()
          Indicates whether this task has additional information available on the performed work.
(package private)  boolean isCancelableTask()
          Indicates whether the effect of this task can be undone (and whether the user should be given the option to undo the task).
(package private)  boolean isPreStateAllowed(int state)
           
(package private)  boolean isProgressMonitoredTask()
          Importing candidate codes can take a long time, better pop up a progress monitor.
(package private)  void logCompleted()
          Writes a 'task completed' entry in the log.
(package private)  void logFailed(java.lang.String reason)
          Writes a 'task failed' entry in the log.
(package private)  void logOpenedFile(java.io.File file)
          Writes a 'task opened file' entry in the log.
(package private)  void logStarted()
          Writes a 'task started' entry in the log.
(package private)  java.lang.String showCandidates()
          Gets the list of candidates imported by this task.
(package private)  void stopAction()
          If the cancel button is pressed this thread should stop
 
Methods inherited from class sos.koa.Task
actionPerformed, getWarningMessage, isDangerousTask, isModalTask, logCanceled, popupAdditionalInfo, popupAdditionalInfo, popupFailure, popupGetFile, popupGetPassword, popupNext, popupNextOrBack, popupSuccess, popupWarning, setMaxSubTasks, setSubTaskCount
 
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
 

Field Detail

candidates

CandidateList candidates
The candidate list.


taskCount

int taskCount
Number of codes encountered thus far.


keepRunning

boolean keepRunning
Whether to keep importing. Gets set to false when task is canceled.

Constructor Detail

ImportCandidatesAdapter

public ImportCandidatesAdapter()
Constructs this adapter.

Method Detail

getTitle

java.lang.String getTitle()
The title of this task.

Returns:
Title of this task.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

getSuccessMessage

java.lang.String getSuccessMessage()
What to print in success dialog.

Returns:
text to print in success dialog.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

getFailureMessage

java.lang.String getFailureMessage()
What to print in failure dialog.

Returns:
text to print in failure dialog.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

isPreStateAllowed

boolean isPreStateAllowed(int state)
Specifications: pure
Specifications inherited from overridden method in class Task:
       pure

getSuccessState

int getSuccessState()
The application state after successful completion of this task.

Returns:
the new state.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

isCancelableTask

boolean isCancelableTask()
Indicates whether the effect of this task can be undone (and whether the user should be given the option to undo the task). This task is cancelable, so should return true.

Overrides:
isCancelableTask in class Task
Returns:
this task is cancelable, so true.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

doAction

void doAction()
        throws KOAException
Imports the candidates. Asks the user to select the file. Checks the file. Parses the file.

Throws:
KOAException - if importing failed.
Specifications inherited from overridden method in class Task:
assignable objectState;

stopAction

void stopAction()
If the cancel button is pressed this thread should stop

Overrides:
stopAction in class Task
Specifications inherited from overridden method in class Task:
      --- None ---

clear

void clear()
Clears temporary memory used by this task.

Overrides:
clear in class Task
Specifications inherited from overridden method in class Task:
      --- None ---

logStarted

void logStarted()
Writes a 'task started' entry in the log.

Overrides:
logStarted in class Task
Specifications inherited from overridden method in class Task:
assignable AuditLog.*;

logOpenedFile

void logOpenedFile(java.io.File file)
Writes a 'task opened file' entry in the log.

Overrides:
logOpenedFile in class Task
Specifications inherited from overridden method logOpenedFile(File file) in class Task:
assignable AuditLog.*;

logFailed

void logFailed(java.lang.String reason)
Writes a 'task failed' entry in the log.

Overrides:
logFailed in class Task
Specifications inherited from overridden method logFailed(String reason) in class Task:
assignable AuditLog.*;

logCompleted

void logCompleted()
Writes a 'task completed' entry in the log.

Overrides:
logCompleted in class Task
Specifications inherited from overridden method in class Task:
      --- None ---

isAdditionalInfoAvailable

boolean isAdditionalInfoAvailable()
Indicates whether this task has additional information available on the performed work.

Overrides:
isAdditionalInfoAvailable in class Task
Returns:
a boolean indicating whether additional information is available.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

getAdditionalInfo

java.lang.Object getAdditionalInfo()
Gets the additional information.

Overrides:
getAdditionalInfo in class Task
Returns:
the additional information.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

getInfo

java.lang.String getInfo()
Gets information to put in popup dialog after successful completion of this task.

Overrides:
getInfo in class Task
Returns:
some information about the successfully completed task.
Specifications inherited from overridden method in class Task:
assignable AuditLog.*;

showCandidates

java.lang.String showCandidates()
Gets the list of candidates imported by this task.

Returns:
the list of candidates imported by this task.
Specifications: pure

isProgressMonitoredTask

boolean isProgressMonitoredTask()
Importing candidate codes can take a long time, better pop up a progress monitor.

Overrides:
isProgressMonitoredTask in class Task
Returns:
true.
Specifications: (inherited)pure
Specifications inherited from overridden method in class Task:
       pure

SOA
© 2004 SoS Group
All Rights Reserved