summaryrefslogtreecommitdiff
path: root/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow
diff options
context:
space:
mode:
authortkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:57:41 +0000
committertkellner <tkellner@174cde9d-5d70-4d2a-aa98-46368bc2aaf7>2013-04-10 18:57:41 +0000
commitfdc0f9a9dfc7dabdc96bb830a079a353f160395c (patch)
tree43b05a50edf88feaaa298273ea949af77d520ec7 /pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow
parentf294a5abda6947a2edd7eb502ca340ac6c02f68f (diff)
downloadpdf-over-fdc0f9a9dfc7dabdc96bb830a079a353f160395c.tar.gz
pdf-over-fdc0f9a9dfc7dabdc96bb830a079a353f160395c.tar.bz2
pdf-over-fdc0f9a9dfc7dabdc96bb830a079a353f160395c.zip
Fixed some TODOs...
git-svn-id: https://joinup.ec.europa.eu/svn/pdf-over/trunk@57 174cde9d-5d70-4d2a-aa98-46368bc2aaf7
Diffstat (limited to 'pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow')
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java10
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java3
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java20
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java15
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java7
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java2
-rw-r--r--pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java2
9 files changed, 17 insertions, 51 deletions
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
index 1adc45a4..4850a313 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/ConfigProvider.java
@@ -25,8 +25,6 @@ import at.asit.pdfover.signator.SignaturePosition;
*
*/
public interface ConfigProvider {
- //TODO: define interface for config provider ....
-
/**
* Regex for parsing signature position
*/
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
index 90b2fba9..ece1cf7f 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/StateMachineImpl.java
@@ -18,6 +18,7 @@ package at.asit.pdfover.gui.workflow;
//Imports
import java.lang.reflect.Constructor;
+import org.eclipse.swt.SWTException;
import org.eclipse.swt.widgets.Composite;
import org.eclipse.swt.widgets.Display;
import org.eclipse.swt.widgets.Shell;
@@ -25,6 +26,7 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow;
+import at.asit.pdfover.gui.workflow.states.ErrorState;
import at.asit.pdfover.gui.workflow.states.PrepareConfigurationState;
import at.asit.pdfover.gui.workflow.states.State;
@@ -84,7 +86,9 @@ public class StateMachineImpl implements StateMachine, GUIProvider {
current.run();
} catch (Exception e) {
log.error("StateMachine update: ", e); //$NON-NLS-1$
- // TODO: GOTO generic error state!
+ ErrorState errorState = new ErrorState(this);
+ errorState.setException(e);
+ jumpToState(errorState);
}
if (this.exit) {
@@ -203,10 +207,6 @@ public class StateMachineImpl implements StateMachine, GUIProvider {
this.createMainWindow();
}
- if (this.container == null) {
- // TODO throw Exception...
- }
-
return this.container;
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
index af648dfd..dd240616 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/ErrorState.java
@@ -100,8 +100,7 @@ public class ErrorState extends State {
*/
@Override
public void updateMainWindowBehavior() {
- // TODO Auto-generated method stub
-
+ // Stay in previous state behavior
}
/**
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
index ca0e164c..9962d968 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/LocalBKUState.java
@@ -20,11 +20,14 @@ import org.apache.commons.httpclient.HttpClient;
import org.apache.commons.httpclient.HttpException;
import org.apache.commons.httpclient.HttpStatus;
import org.apache.commons.httpclient.methods.PostMethod;
+import org.eclipse.swt.SWT;
+import org.eclipse.swt.widgets.Display;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import at.asit.pdfover.gui.MainWindow.Buttons;
import at.asit.pdfover.gui.MainWindowBehavior;
+import at.asit.pdfover.gui.controls.ErrorDialog;
import at.asit.pdfover.gui.workflow.StateMachine;
import at.asit.pdfover.gui.workflow.Status;
import at.asit.pdfover.signator.SLRequest;
@@ -86,7 +89,7 @@ public class LocalBKUState extends State {
log.debug("SL REQUEST: " + sl_request); //$NON-NLS-1$
method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
-
+
int returnCode = client.executeMethod(method);
if(returnCode == HttpStatus.SC_OK)
@@ -115,13 +118,12 @@ public class LocalBKUState extends State {
SLResponse slResponse = new SLResponse(response, server, userAgent, signatureLayout);
this.state.signingState.setSignatureResponse(slResponse);
} else {
- // TODO: Create HTTP exception
this.state.threadException = new HttpException(method.getResponseBodyAsString());
}
} catch (Exception e) {
log.error("SignLocalBKUThread: ", e); //$NON-NLS-1$
- // TODO: Is local BKU running?
+ //
this.state.threadException = e;
} finally {
this.state.stateMachine.invokeUpdate();
@@ -168,17 +170,13 @@ public class LocalBKUState extends State {
}
if(this.threadException != null) {
- ErrorState error = new ErrorState(this.stateMachine);
- error.setException(this.threadException);
- this.setNextState(error);
+ ErrorDialog dialog = new ErrorDialog(Display.getCurrent().getActiveShell(), SWT.NONE, "Please check if a local BKU is running", this.threadException);
+ dialog.open();
+ this.threadException = null;
+ this.run();
return;
}
- if(!this.signingState.hasSignatureResponse()) {
- // The thread should set the response or the thread exception!!!
- // TODO: Jump to error state!
- }
-
// OK
this.setNextState(new SigningState(this.stateMachine));
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
index 2ebc3f39..a1748287 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/OutputState.java
@@ -66,8 +66,6 @@ public class OutputState extends State {
@Override
public void run() {
- // TODO Preform output operations ... end workflow
-
Status status = this.stateMachine.getStatus();
if (status.getSignResult() != null) {
@@ -97,20 +95,7 @@ public class OutputState extends State {
}
}
- /*
- * DocumentSource signedDocument =
- * status.getSignResult().getSignedDocument();
- *
- * FileOutputStream output; try { output = new FileOutputStream(new
- * File("/tmp/test.pdf"));
- * output.write(signedDocument.getByteArray(), 0,
- * signedDocument.getByteArray().length); output.close(); } catch
- * (IOException e) { // TODO Auto-generated catch block
- * e.printStackTrace(); }
- */
}
-
- // this.stateMachine.exit();
}
/*
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
index 88acc84b..af6cc3bd 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/PrepareSigningState.java
@@ -76,8 +76,6 @@ public class PrepareSigningState extends State {
this.state.signatureParameter.setSignatureDevice(status.getBKU());
this.state.signatureParameter.setSignaturePosition(status.getSignaturePosition());
- // TODO: Fill library specific signature Parameters ...
-
if(configuration.getDefaultEmblem() != null && !configuration.getDefaultEmblem().equals("")) { //$NON-NLS-1$
this.state.signatureParameter.setEmblem(new FileNameEmlbem(configuration.getDefaultEmblem()));
}
@@ -145,11 +143,6 @@ public class PrepareSigningState extends State {
return;
}
- if(this.signingState == null || this.signingState.getSignatureRequest() == null) {
- // This shouldnot happen!! PrepareDocumentThread allready performed, either we have a valid signingState or an exception!!
- // TODO: Jump to error state!
- }
-
// We got the Request set it into status and move on to next state ...
status.setSigningState(this.signingState);
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
index 20813f00..413f125c 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/SigningState.java
@@ -89,12 +89,7 @@ public class SigningState extends State {
this.setNextState(error);
return;
}
-
- if(status.getSignResult() == null) {
- // The thread should set the threadException or create a valid signResult
- // TODO: Jump to error state
- }
-
+
this.setNextState(new OutputState(this.stateMachine));
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java
index a1868462..ee984e96 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/ATrustHelper.java
@@ -67,11 +67,9 @@ public class ATrustHelper {
if (endidx > startidx) {
return data.substring(startidx, endidx);
}
- // TODO: throw proper exception
log.error("extracting Tag: end tag not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$
throw new Exception("end tag not available!"); //$NON-NLS-1$
}
- // TODO: throw proper exception
log.error("extracting Tag: start tag not valid!: " + start + " ... " + end); //$NON-NLS-1$//$NON-NLS-2$
throw new Exception("start tag not available!"); //$NON-NLS-1$
}
diff --git a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
index bd2f5b53..fb52fce8 100644
--- a/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
+++ b/pdf-over-gui/src/main/java/at/asit/pdfover/gui/workflow/states/mobilebku/PostSLRequestThread.java
@@ -77,7 +77,7 @@ public class PostSLRequestThread implements Runnable {
PostMethod method = new PostMethod(url);
method.addParameter("XMLRequest", sl_request); //$NON-NLS-1$
-
+
int returnCode = client.executeMethod(method);
String redirectLocation = null;