* Operations enumeration.
*/
private enum Execute {
+ /**
+ * Possible document operations.
+ */
renameDocument, accept, promote, demote, review, invalidate, approve, disapprove
};
- // ==============================================================================================================================
+ // =========================================================================
// Action methods
- // ==============================================================================================================================
+ // =========================================================================
/**
* Open a study.
getPublicationService().approve(doc,
Calendar.getInstance().getTime());
_openStudy.update(doc);
- _openStudy.getMenu().refreshSelectedItem(); // Updates the menu icon, in case of other documents in approved state
+ // Update the menu icon, in case of other documents in approved state
+ _openStudy.getMenu().refreshSelectedItem();
}
res = SUCCESS;
} catch (RuntimeException saverror) {
Step step = _openStudy.getSelectedStep();
Publication edited = step.getDocument(Long.valueOf(_index));
Date modifTime = Calendar.getInstance().getTime();
-
+
// Replace the document source file
getPublicationService().replace(edited, upfile, modifTime);
-
+
_openStudy.update(edited);
res = SUCCESS;
} catch (Exception error) {
setMenu();
_openStudy = getOpenStudy();
Step step = _openStudy.getSelectedStep();
- Publication doctag = step.getDocument(Long.valueOf(_index));
- Long prevVersion = 0L;
- if (doctag.value().getPreviousVersion() != null) {
- prevVersion = doctag.value().getPreviousVersion().getIndex();
- }
if (getStepService().removeDocument(step, Long.valueOf(_index))) { // Updates the data structure
- _openStudy.remove(doctag); // Updates the presentation
- // The previous version must be republished if any
- if (prevVersion > 0) {
- _openStudy.add(step.getDocument(prevVersion));
+ // Re-opening (refreshing) the currently open study
+ if (_selection == null) { // Opening a study just newed
+ _selection = _openStudy.getSelection(); // Default selection
}
+ _openStudy = open(getStudyService().selectStudy(
+ _openStudy.getIndex())); // Closes the previously open study
+ _openStudy.setSelection(_selection);
}
return SUCCESS;
}
- // ==============================================================================================================================
+ // =========================================================================
// Getters and setters
- // ==============================================================================================================================
+ // =========================================================================
/**
* Set the document title.