01: package de.schlund.pfixcore.example;
02:
03: import java.io.File;
04:
05: import de.schlund.pfixcore.example.iwrapper.EncodingTestUpload;
06: import de.schlund.pfixcore.generator.IHandler;
07: import de.schlund.pfixcore.generator.IWrapper;
08: import de.schlund.pfixcore.workflow.Context;
09:
10: /**
11: * @author mleidig@schlund.de
12: */
13: public class EncodingTestUploadHandler implements IHandler {
14:
15: public void handleSubmittedData(Context context, IWrapper wrapper)
16: throws Exception {
17: EncodingTestUpload upload = (EncodingTestUpload) wrapper;
18: File file = upload.getFile();
19: String text = upload.getText();
20: ContextEncodingTest ctx = context.getContextResourceManager()
21: .getResource(ContextEncodingTest.class);
22: if (text != null)
23: ctx.setText(text);
24: if (file != null)
25: ctx.setFile(file);
26: }
27:
28: public void retrieveCurrentStatus(Context context, IWrapper wrapper)
29: throws Exception {
30: EncodingTestUpload upload = (EncodingTestUpload) wrapper;
31: ContextEncodingTest ctx = context.getContextResourceManager()
32: .getResource(ContextEncodingTest.class);
33: if (ctx.getText() != null)
34: upload.setText(ctx.getText());
35: }
36:
37: public boolean needsData(Context context) throws Exception {
38: return false;
39: }
40:
41: public boolean prerequisitesMet(Context context) throws Exception {
42: return true;
43: }
44:
45: public boolean isActive(Context context) throws Exception {
46: return true;
47: }
48:
49: }
|