01: package de.schlund.pfixcore.example;
02:
03: import de.schlund.pfixcore.example.iwrapper.FileUpload;
04: import de.schlund.pfixcore.generator.IHandler;
05: import de.schlund.pfixcore.generator.IWrapper;
06: import de.schlund.pfixcore.workflow.Context;
07: import de.schlund.pfixxml.multipart.UploadFile;
08:
09: /**
10: * @author mleidig@schlund.de
11: */
12: public class FileUploadHandler implements IHandler {
13:
14: public void handleSubmittedData(Context context, IWrapper wrapper)
15: throws Exception {
16: FileUpload upload = (FileUpload) wrapper;
17: UploadFile file = upload.getFile();
18: ContextFileUpload ctxUpload = context
19: .getContextResourceManager().getResource(
20: ContextFileUpload.class);
21: if (upload.getComment() != null)
22: ctxUpload.setComment(upload.getComment());
23: if (file != null)
24: ctxUpload.setFiles(new UploadFile[] { file });
25: }
26:
27: public void retrieveCurrentStatus(Context context, IWrapper wrapper)
28: throws Exception {
29:
30: }
31:
32: public boolean needsData(Context context) throws Exception {
33: return false;
34: }
35:
36: public boolean prerequisitesMet(Context context) throws Exception {
37: return true;
38: }
39:
40: public boolean isActive(Context context) throws Exception {
41: return true;
42: }
43:
44: }
|