Last modified on 24 October 2024, at 14:22

FILEDOCUMENT

Revision as of 14:22, 24 October 2024 by MHM (Talk | contribs) (Customization)

IC METACLASS.gif File Document
Name FILEDOCUMENT
Namespace System.Document
Internal Name Filedocument
TypeString UBIK.Kernel.MetaClass
RuntimeType UBIK.Document.DocumentClass
Purpose Manage file documents
Version 2+


Definition

Internal Document

An internal document is marked with IsLocalDoc == true. The FullPath Property refers to the source - document but when saving the document UBIK creates a copy of the source document and stores it on the internal file share. From this moment on, the source document is no longer needed (even its full path is still available on the FullPath Property though).

External Document

An internal document is marked with IsLocalDoc == false. The FullPath Property refers to the external - document. UBIK reads the document if needed (e.g. when a client asks for it via a Web Sevice method).

Empty Document

An empty document is is marked by the FullPath Property being empty. An empty document is neither an internal nor an external document, it is just not yet defined.


Use Cases

Upload of a new document

If a document gets uploaded via the Web Service UBIK first creates an empty document. This properties of this document get already set as well as the reference/relation to its owner will get set. When (in a 2nd step) the document content (e.g. the image itself) gets uploaded the file will be saved as temporary file and the empty document will transfer it into an internal document:

  • FullPath refers to the Temporary Filepath
  • Extension is set
  • IsLocalDoc is set to true

When the document gets saved, UBIK creates a copy of the temporary files and stores it on the internal file share. The event LocalFileDocumentAvailable will be raised.

Creation of an external document

An external document cannot be created via the Web Service. It must be created manually, via import or using customizing.

Update of an internal document

If an internal document gets updated via the Web Service, the new document (content) first gets saved as temporary file. The FullPath will get changed and will refer to the new temporary file. When saving the document, UBIK will replace the old internal copy (on the Fileshare) with a copy of the new temporary file. First, the event LocalFileDocumentAvailable will be raised and as the internal document is updated we will raise the LocalFileDocumenUpdated event too.

Update of an external document

If an external document gets updated via the Web Service, the new document (content) first gets saved as temporary file. As the FullPath refers to the source of the external document it MUST NOT get changed. It can be configured (via customizing) if the uploaded document should immedialtely replace the source document (refered by the Fullpath) when the document gets saved. If it is configured to NOT-AUTO-OVERVRITE the temporary file is copied to the local storage

Customization

UBIK provides 2 methods to manage the internal document handling for external documents:

RevertLocalCopy()

RevertLocalCopy deletes the local copy (for external documents) in the local storage (if available).

ReplaceExternalFileWithLocalCopy

ReplaceExternalFileWithLocalCopy copies the file from the local storage (if available) over the existing exernal document. The local copy gets reverted if copying was successfull.