- private enum ToDo { cancel, upload };
-
-// ==============================================================================================================================
-// Action methods
-// ==============================================================================================================================
-
- public String doInitialize () {
-// -----------------------------
- setMenuProperty("study");
- setToolProperty("none");
- initializationScreenContext(_menuProperty, _toolProperty);
-
- return SUCCESS;
- }
-
- public String doUpload () {
-// -------------------------
- setMenuProperty("study");
- setTitleProperty("study");
- setEditDisabledProperty("true");
- initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty);
-
- if (action == ToDo.cancel) return "cancel";
- try {
- File udir = getRepositoryService().getDownloadDirectory(getConnectedUser());
- String path = udir.getPath() + "/" + uploadFileName;
- File file = new File(path);
-
- if (!udir.exists()) udir.mkdir();
- if (file.exists()) file.delete();
- Do.copy(upload, file);
- logger.info("Uploading \"" + uploadFileName + "\" " + uploadMimeType + " file.");
- /*if (next == null || next.isEmpty()) {
- next = "import";
- }*/
-
- logger.info("MKA next = " + next);
- return next;
- }
- catch (OutOfMemoryError error) {
-
- setMenuProperty("none");
- setTitleProperty("study");
- setEditDisabledProperty("true");
- setToolProperty("none");
- initializationScreenContext(_menuProperty, _titleProperty, _editDisabledProperty, _toolProperty);
-
- return "outofmemory";
- }
- catch (Exception error) {
- logger.error("Reason: ", error);
- return ERROR;
- }
- }
-// ==============================================================================================================================
-// Getters and setters
-// ==============================================================================================================================
-
- public String getIndex () {
-// -------------------------
- return index;
- }
- public String getFileName () {
-// ----------------------------
- return uploadFileName;
- }
- public String getNextAction () {
-// ------------------------------
- return next;
- }
-
- public void setCancel (boolean back) {
-// ------------------------------------
- this.action = ToDo.cancel;
- }
- public void setDoIt (boolean upload) {
-// --------------------------------
- this.action = ToDo.upload;
- }
- public void setIndex (String index) {
-// -----------------------------------
- this.index = index;
- }
- public void setNextAction (String next) {
-// ---------------------------------------
- this.next = next;
- }
- public void setUpload (File upload) {
-// -----------------------------------
- this.upload = upload;
- }
- public void setUploadFileName (String name) {
-// -------------------------------------------
- this.uploadFileName = name;
- }
- public void setUploadContentType (String mime) {
-// ----------------------------------------------
- this.uploadMimeType = mime;
- }