Jump to: navigation, search

Difference between revisions of "DocumentProxy"


(DocumentMetaProxy)
Line 8: Line 8:
  
 
== DocumentMetaProxy ==
 
== DocumentMetaProxy ==
UBIK provides a DocumentMetaProxy called '''PX_DOCUMENT''' (UID: 58c1a444-3867-41e7-84a2-bd655fb04755) that is derived from PROXYROOT.  
+
UBIK provides a DocumentMetaProxy called '''PX_DOCUMENT''' (UID: 58c1a444-3867-41e7-84a2-bd655fb04755) that is derived from PROXYROOT.
 +
The TargetType of DocumentMetaProxies needs to be set to a FileDocumentMetaClass (e.g. a MetaClass derived from FILEDOCUMENT).
 +
The following methods need to be overridden for the InterfaceAdministration MetaClasses that are related to DocumentMetaProxies via their SYSREL_INTERFACE_ADMIN_METAPROXY relation:
 +
* GetExternalDataReader()
 +
Here it is necessary to return an object of a class that implements the abstract class ''DocumentReadFromExternalExecutionBase''.
 +
 
 +
<source lang="csharp">
 +
namespace UBIK.Interface
 +
{
 +
    public struct FileDetails
 +
    {
 +
        public string FileName;
 +
        public string FullPath;
 +
        public string ContentType;
 +
        public DateTime CreationTime;
 +
    }
 +
 
 +
    public abstract class DocumentReadFromExternalExecutionBase : InterfaceExecutionBase
 +
    {
 +
...
 +
        public abstract Stream GetFilestream(DocumentProxy proxy);
 +
 
 +
        public abstract bool TryGetFileDetails(DocumentProxy proxy, out FileDetails details);
 +
    }
 +
}
 +
</source>
 +
 
 +
* GetExternalDataWriter()
 +
 
  
 
== Properties ==
 
== Properties ==

Revision as of 13:00, 24 June 2024

IC Attention.pngThis page is under construction.

Basics

A Document Proxy object contains the logic of a basic Proxy object combined with the capability to handle file documents from an interface. One Document Proxy object can handle both import and export of the same Ubik FileDocument instance via one interface.

IC Hint square.pngA Document Proxy object MUST HAVE PX_DOCUMENT or a derivative of it defined as its MetaClass!

The TargetType for DocumentMetaProxy has to be a FileDocument MetaClass.

DocumentMetaProxy

UBIK provides a DocumentMetaProxy called PX_DOCUMENT (UID: 58c1a444-3867-41e7-84a2-bd655fb04755) that is derived from PROXYROOT. The TargetType of DocumentMetaProxies needs to be set to a FileDocumentMetaClass (e.g. a MetaClass derived from FILEDOCUMENT). The following methods need to be overridden for the InterfaceAdministration MetaClasses that are related to DocumentMetaProxies via their SYSREL_INTERFACE_ADMIN_METAPROXY relation:

  • GetExternalDataReader()

Here it is necessary to return an object of a class that implements the abstract class DocumentReadFromExternalExecutionBase.

namespace UBIK.Interface
{
    public struct FileDetails
    {
        public string FileName;
        public string FullPath;
        public string ContentType;
        public DateTime CreationTime;
    }

    public abstract class DocumentReadFromExternalExecutionBase : InterfaceExecutionBase
    {
                ...
        public abstract Stream GetFilestream(DocumentProxy proxy);

        public abstract bool TryGetFileDetails(DocumentProxy proxy, out FileDetails details);
    }
}
  • GetExternalDataWriter()


Properties

Besides the properties known from the basic Proxy, a DocumentProxy provides the following properties:

ProxyMetaProperties:

Property Description
Key External primary key. Can be the file path to the external document or a byte stream.
File name The name of the external file (including its extension).
File path The full path of the external file.
File content type The content type (extension) of the external file.
File creation time The creation timestamp of the external file.

MetaProperties:

Property Description
Import File Hashcode The hashcode representing the content of the import file
Export File Hashcode The hashcode representing the content of the export file


DocumentBatchProxyCreator

The DocumentBatchProxyCreator class provides the possibility to create multiple Document Proxies with the import status set to QuedForReadFromExternal. The following two methods can be executed by e.g. using Who-Bert:

Example: Asking a DocumentBatchProxyCreator to create Document Proxies for all documents in a folder. The import status will be set to QuedForReadFromExternal for all of them.

// Getting your required MetaProxy
MetaProxy myMetaProxy = obj.Environment.UBIKDataFactory().ContentObject(new Guid("put UID of your MetaProxy here")) as MetaProxy;

// Creating a DocumentBatchProxyCreator instance
UBIK.Interface.DocumentBatchProxyCreator creator = new UBIK.Interface.DocumentBatchProxyCreator();

// calling ImportBatchOfDocuments() without filtering options
// Parameter 1: the path to the folder that contains the documents.
// Parameter 2: the MataProxy
creator.ImportBatchOfDocuments("put path to folder here", myMetaProxy);

// calling ImportBatchOfDocuments() with filtering options
// Parameter 1: string of the path to the folder that contains the documents.
// Parameter 2: the MataProxy
// Parameter 3: string of the search pattern
// Parameter 4: System.IO.SearchOption
creator.ImportBatchOfDocuments("put path to folder here", myMetaProxy, "*mySearchPattern*", SearchOption.AllDirectories);


See also