Difference between revisions of "DocumentProxy"
(→DocumentMetaProxy) |
(→BatchDocumentProxyCreator) |
||
(9 intermediate revisions by the same user not shown) | |||
Line 1: | Line 1: | ||
− | |||
− | |||
== Basics == | == Basics == | ||
A Document Proxy object contains the logic of a basic [[Proxy]] object combined with the capability to handle file documents from an interface. | 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. | One Document Proxy object can handle both import and export of the same Ubik FileDocument instance via one interface. | ||
− | {{Hint|A Document | + | {{Hint|A Document Proxies are instances of PX_DOCUMENT or a derivative of it!}} |
− | The TargetType for DocumentMetaProxy | + | The TargetType for DocumentMetaProxy should be a FileDocument MetaClass. |
− | == DocumentMetaProxy == | + | [[Category:Document|DocumentProxy]] |
+ | [[Category:Interfacing|DocumentProxy]] | ||
+ | |||
+ | == DocumentMetaProxy Setup == | ||
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 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: | The following methods need to be overridden for the InterfaceAdministration MetaClasses that are related to DocumentMetaProxies via their SYSREL_INTERFACE_ADMIN_METAPROXY relation: | ||
* GetExternalDataReader() | * GetExternalDataReader() | ||
− | |||
− | |||
<source lang="csharp"> | <source lang="csharp"> | ||
− | + | protected override UBIK.Interface.IInterfaceExecutor GetExternalDataReader() | |
{ | { | ||
− | + | return new UBIK.Interface.FileDocumentReadFromExternalExecutor(this.Environment); | |
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
− | + | ||
} | } | ||
</source> | </source> | ||
* GetExternalDataWriter() | * GetExternalDataWriter() | ||
+ | <source lang="csharp"> | ||
+ | protected override UBIK.Interface.IInterfaceExecutor GetExternalDataWriter() | ||
+ | { | ||
+ | return new UBIK.Interface.FileDocumentWriteToExternalExecutor(this.Environment); | ||
+ | } | ||
+ | </source> | ||
+ | [[Category:Document|DocumentProxy]] | ||
+ | [[Category:Interfacing|DocumentProxy]] | ||
== Properties == | == Properties == | ||
Line 46: | Line 39: | ||
! Property!! Description | ! Property!! Description | ||
|- | |- | ||
− | | Key|| | + | | Key|| The '''file path''' to the external document (ubik needs to have access to it). External primary key. |
|- | |- | ||
| File name|| The name of the external file (including its extension). | | File name|| The name of the external file (including its extension). | ||
Line 69: | Line 62: | ||
− | == | + | == BatchDocumentProxyCreator == |
− | The | + | The BatchDocumentProxyCreator 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: | The following two methods can be executed by e.g. using Who-Bert: | ||
− | '''Example: Asking a | + | '''Example: Asking a BatchDocumentProxyCreator to create Document Proxies for all documents in a folder (top level only) without filters.''' |
<source lang="csharp"> | <source lang="csharp"> | ||
Line 79: | Line 72: | ||
MetaProxy myMetaProxy = obj.Environment.UBIKDataFactory().ContentObject(new Guid("put UID of your MetaProxy here")) as MetaProxy; | MetaProxy myMetaProxy = obj.Environment.UBIKDataFactory().ContentObject(new Guid("put UID of your MetaProxy here")) as MetaProxy; | ||
− | // Creating a | + | // Creating a BatchDocumentProxyCreator instance |
− | UBIK.Interface. | + | UBIK.Interface.BatchDocumentProxyCreator creator = new UBIK.Interface.BatchDocumentProxyCreator(); |
− | // calling | + | // Defining string for folder path |
+ | string folderPath = @"C:\Documents"; | ||
+ | |||
+ | // calling CreateProxies() without filtering options | ||
// Parameter 1: the path to the folder that contains the documents. | // Parameter 1: the path to the folder that contains the documents. | ||
// Parameter 2: the MataProxy | // Parameter 2: the MataProxy | ||
− | creator. | + | creator.CreateProxies(folderPath, myMetaProxy); |
+ | </source> | ||
+ | |||
+ | '''Example: Asking a BatchDocumentProxyCreator to create Document Proxies for all documents in a folder (top and sub levels) with filters.''' | ||
+ | |||
+ | <source lang="csharp"> | ||
+ | // Getting your required MetaProxy | ||
+ | MetaProxy myMetaProxy = obj.Environment.UBIKDataFactory().ContentObject(new Guid("put UID of your MetaProxy here")) as MetaProxy; | ||
+ | |||
+ | // Creating a BatchDocumentProxyCreator instance | ||
+ | UBIK.Interface.BatchDocumentProxyCreator creator = new UBIK.Interface.BatchDocumentProxyCreator(); | ||
+ | |||
+ | // Defining string for folder path | ||
+ | string folderPath = @"C:\Documents"; | ||
+ | |||
+ | //Define string for search pattern | ||
+ | string searchPattern = "*.pdf"; | ||
− | // calling | + | // calling CreateProxies() with filtering options |
// Parameter 1: string of the path to the folder that contains the documents. | // Parameter 1: string of the path to the folder that contains the documents. | ||
// Parameter 2: the MataProxy | // Parameter 2: the MataProxy | ||
// Parameter 3: string of the search pattern | // Parameter 3: string of the search pattern | ||
// Parameter 4: System.IO.SearchOption | // Parameter 4: System.IO.SearchOption | ||
− | creator. | + | creator.CreateProxies(folderPath, myMetaProxy, searchPattern, SearchOption.AllDirectories); |
</source> | </source> | ||
+ | [[Category:Document|DocumentProxy]] | ||
+ | [[Category:Interfacing|DocumentProxy]] | ||
==See also== | ==See also== | ||
Line 100: | Line 114: | ||
* [[ProxyMetaProperty]] | * [[ProxyMetaProperty]] | ||
* [[Proxy]] | * [[Proxy]] | ||
+ | * [[ProxyScanner]] | ||
* [[HowTo:Configure_Proxies]] | * [[HowTo:Configure_Proxies]] | ||
+ | |||
+ | [[Category:Document|DocumentProxy]] | ||
+ | [[Category:Interfacing|DocumentProxy]] |
Latest revision as of 15:56, 24 June 2024
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.
The TargetType for DocumentMetaProxy should be a FileDocument MetaClass.
DocumentMetaProxy Setup
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()
{
return new UBIK.Interface.FileDocumentReadFromExternalExecutor(this.Environment);
}
- GetExternalDataWriter()
{
return new UBIK.Interface.FileDocumentWriteToExternalExecutor(this.Environment);
}
Properties
Besides the properties known from the basic Proxy, a DocumentProxy provides the following properties:
ProxyMetaProperties:
Property | Description |
---|---|
Key | The file path to the external document (ubik needs to have access to it). External primary key. |
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 |
BatchDocumentProxyCreator
The BatchDocumentProxyCreator 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 BatchDocumentProxyCreator to create Document Proxies for all documents in a folder (top level only) without filters.
MetaProxy myMetaProxy = obj.Environment.UBIKDataFactory().ContentObject(new Guid("put UID of your MetaProxy here")) as MetaProxy;
// Creating a BatchDocumentProxyCreator instance
UBIK.Interface.BatchDocumentProxyCreator creator = new UBIK.Interface.BatchDocumentProxyCreator();
// Defining string for folder path
string folderPath = @"C:\Documents";
// calling CreateProxies() without filtering options
// Parameter 1: the path to the folder that contains the documents.
// Parameter 2: the MataProxy
creator.CreateProxies(folderPath, myMetaProxy);
Example: Asking a BatchDocumentProxyCreator to create Document Proxies for all documents in a folder (top and sub levels) with filters.
MetaProxy myMetaProxy = obj.Environment.UBIKDataFactory().ContentObject(new Guid("put UID of your MetaProxy here")) as MetaProxy;
// Creating a BatchDocumentProxyCreator instance
UBIK.Interface.BatchDocumentProxyCreator creator = new UBIK.Interface.BatchDocumentProxyCreator();
// Defining string for folder path
string folderPath = @"C:\Documents";
//Define string for search pattern
string searchPattern = "*.pdf";
// calling CreateProxies() 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.CreateProxies(folderPath, myMetaProxy, searchPattern, SearchOption.AllDirectories);