Document Management
This page documents the document browser, upload, download, history, attachment, visibility, and PDF tool subsystems in SureDrive. It covers the Angular routes and controllers, the upload service, backend operation constants, and the document entity model.
Overview
Documents in SureDrive are stored within a folder hierarchy defined by the Content Model Editor. The document navigator is the primary user interface — it renders the folder tree on the left and a document list or preview panel on the right. All document operations (upload, download, move, share, sign, annotate, delete, restore) are initiated from this view.
Key owning modules:
- UI:
suredms-web-client—network/study/folder tree, upload wizard, document detail views - Service layer:
suredms-web-service— document streaming and processing endpoints - Domain model:
suredms-common—DocumentEntity,BlobDescriptor
Angular Routes
File: SC/suredms-web-client/src/main/webapp/app/js/state/app-states.js
| State | Template / Controller | Purpose |
|---|---|---|
app.network.study.browse.files | drive-file-navigator.html | Main SureDrive document navigator; folder tree + document list |
app.network.study.browse.document | StudyDocumentController | Document detail view; metadata, preview, workflow actions |
app.network.study.upload-drive | DriveUploadFilesController | Multi-file upload wizard for SureDrive |
app.network.study.browse.attachment | StudyAttachmentController | Attachment detail view for a specific document attachment |
Controllers and Services
DriveUploadFilesController
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/drive-upload-files.js
Orchestrates the multi-file upload process. Responsibilities:
- Collects files from the browser drag/drop or file picker.
- Allows users to assign content type (folder placement), metadata fields, and PDF conversion options per file.
- Supports
manualVersionChange(Major/Minor version increment selection during upload). - Emits upload progress events consumed by the progress indicator component.
StudyDocumentController
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/documents/study-document-details.js
Manages the document detail panel. Responsibilities:
- Renders document metadata and the PDF preview iframe.
- Surfaces actions: review, sign, initiate workflow process, associate with tasks.
- Delegates permission checks to
DocumentPermissionsHelper(see Role-Based Access Control).
StudyDocumentHistoryController
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/documents/study-document-history.js
Handles the version history panel for a document:
| Method | Operation |
|---|---|
fetchDocumentHistory | Calls Mobile.GetDocumentHistory to populate the versions list |
revertDocument | Calls OPERATION_DOCUMENT_RESTORE_VERSION to promote an older version to current |
UploadFilesHelperService
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/study-upload.js
Shared utility service for all document upload flows:
| Method | Purpose |
|---|---|
reloadRequiredMetadata | Fetches mandatory metadata fields based on content type and user role |
populateUploadTaskParams | Configures upload parameters when the upload is part of a workflow task |
handleEmail | Parses .msg / .eml files using JSZip; extracts attachments as individual document objects |
copyMetadataParameters | Synchronises metadata across multiple files in a batch upload |
ContentVisibilityService
Manages ACL rules for documents and folders. Implements the backend of the Configuring Document Visibility and Configuring Content Visibility Help flows. Works with ExpandedArchiveAclRule (see Role-Based Access Control).
TrashedArchiveService
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/study-trash.js
Handles soft-delete and permanent-delete flows:
| Method | Backend Operation |
|---|---|
undeleteArchive | Mobile.UndeleteDocuments — restores deleted documents |
purgeArchive | Mobile.PurgeDocuments — permanently removes documents |
StudyNavigatorFileEditorService
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/study-navigator-file-editor.js
Facilitates in-browser PDF manipulation: Split, Merge, and Redact operations surfaced via the PDF Tools panel in the document detail view.
Document Entity Model
File: SC/suredms-common/src/main/java/com/sureclinical/suredms/entity/DocumentEntity.java
| Method | Description |
|---|---|
getVersion() | Internal numeric version counter |
getManualVersionString() | User-facing version string (e.g., 1.0, 2.1) |
getContentSize() | File size in bytes |
getDocumentStatus() | Lifecycle state: Draft, Effective, Obsolete |
isDocumentLocked() | true if the document is checked out or otherwise restricted |
Backend Operation Constants
Operations are defined in constants-operations.js and executed via ConnectionService. Key document operations:
| Constant | Operation String | Purpose |
|---|---|---|
OPERATION_MOBILE_UPLOAD_DOCUMENT | Mobile.UploadDocument | Streams document binary to the server |
| — | Mobile.GetDocumentHistory | Returns version list for a document |
OPERATION_DOCUMENT_RESTORE_VERSION | — | Promotes an older version to current |
| — | Mobile.UndeleteDocuments | Restores documents from trash |
| — | Mobile.PurgeDocuments | Permanently deletes documents |
Document Operations Reference
| Help Topic | Operation | Entry Point |
|---|---|---|
| Uploading Documents | DriveUploadFilesController → Mobile.UploadDocument | Documents area → Upload button |
| Downloading Documents | StudyDocumentController → download action | Document detail → Download |
| Moving Documents to Archive | DocumentPermissionsHelper.canBeMovedToArchive() + acquire queue service | Document detail → Move to Archive |
| Deleting Documents | Soft delete to trash | Document context menu → Delete |
| Restoring Documents | TrashedArchiveService.undeleteArchive | Trash → Restore |
| Permanently Deleting | TrashedArchiveService.purgeArchive | Trash → Permanently Delete |
| Document History | StudyDocumentHistoryController.fetchDocumentHistory | Document detail → History tab |
| Revert Version | StudyDocumentHistoryController.revertDocument | History tab → Revert |
| Moving / Copying | StudyNavigatorFileEditorService | Document context menu → Move / Copy |
| Configuring Visibility | ContentVisibilityService | Document detail → Visibility |
| Content Visibility (folder) | ContentVisibilityService | Folder context menu → Content Visibility |
| Using PDF Tools | StudyNavigatorFileEditorService → split / merge / redact | Document detail → PDF Tools |
| Sharing Documents | ACTION_SHARE_BOOKMARK / sharing service | Document detail → Share |
| Managing Attachments | StudyAttachmentController | Document detail → Attachments tab |
| Submitting Discrepancies | Quality review flow | Document detail → Submit Discrepancy |
| Working with Expired Documents | Expiry filter in navigator | Documents → filter by Expired |
| Importing from SharePoint | Connector integration (see Connectors) | Documents → Import from SharePoint |
Bookmarks
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/bookmarks/study-bookmark-navigator.js
StudyBookmarkNavigatorController manages the dedicated Bookmarks view — a filtered version of the document tree showing only user-marked favourites. The ACTION_SHARE_BOOKMARK action allows users to create a direct link to a bookmarked folder or document and share it with other team members.
Keyboard Navigation
File: SC/suredms-web-client/src/main/webapp/app/js/network/study/study-navigator.js
StudyAbstractNavigatorController injects KeyboardNavigationService to handle keyboard shortcuts across the Documents, Bookmarks, Acquire Queue, and Quality Queue views.
| Key | Method / Action |
|---|---|
↑ / ↓ arrow | selectPreviousEntity / selectNextEntity — move selection in the tree |
Enter | Open selected item |
Backspace | Navigate to parent directory |
Escape | Clear selection |
Delete | Trigger delete action on selected item (where applicable) |
KeyboardNavigationService.bindKeyListener is used in individual controllers to map additional keys to context-specific document actions.