EDDP: Auto Filing

For many applications the simplest solution for capturing documents is to define a static upload target. But it may also be advantageous to structure the documents into a hierarchy based upon a specified criteria. EDDP provides a solution for this use-case by supporting document auto-filing; documents uploaded to a folder can be refiled into a folder hierarchy once the document is successfully committed. Auto-filing occurs both when a document is created or when a new document revision is created (the document is updated); in either case a new document is created at the target path from the appropriate revision of the source document.

Auto-filing relates to all documents uploading to the server - included those uploaded via AttachFS' own support for auto-filing documents based on non-folder upload targets [aka "INBOX filing" such as commonly used with tasks]. When integrated with AttachFS the auto-filing of documents can be daisy chained - a document upload to a task stored automatically in the related project and linked to the task, and then relocated by event driven document auto-filing. As the object links and object properties of an auto-filed document are copied from the original document to the document in the target location the new document will be linked to the non-folder target in the same manner as the the original document.

Event driven auto-filing is controlled by the presence of an object property in the document management name-space named autoFileTarget. The value of the property must be an ogo:// URI string indicating the target of the auto-file action. When this property exists within a folder hierarchy all documents created in that hierarchy will be subject to the auto-filing action. It is expected that the auto-filing target will be outside of the to-be-filed hierarchy.


Text 1: OGo URI value indicating documents created in the folder hierarchy should be copied to subfolders of the paperwork folder in the project numbered "TestProject". Subfolders will be created for the current month and year. Once successfully copied the original document will be deleted.

When a document is copied to the target location by auto-filing all the object properties and object links are copied to the new document as well. This preserves the relationships and meta-data from the original document. The new document will also be related via an object link to the original document; for that link the new document will be the source, the original document will be the target, and the link type will be "coils:copyFrom".

Parameter Default Description
deleteafterfiling NO A value of “YES” will cause the original document to be automatically deleted once the auto-filed copy has been successfully created. For any other value the original document will not be modified.

Table 1: URI parameters supported in an autoFileTarget URI property value.

Prior to resolving the autoFileTarget URI the value is scanned for known labels; these known labels are replaced with appropriate strings such as the current month or year as well. Property aliases are also supported as replacement values when constructing the file-to URI. Use of the property aliases allows the object properties of the document being filed to be used to construct the file-to path as well.

Label Description
$__YEAR__; The four-digit numeric value of the current year; for example "1972".
$__MONTH__; The numeric value of the current calendar month with a possibly leading zero. For example the month of June is represented as "06".
$__DAYOFMONTH__; The current day-of-month as a two digit number with a possibly leading zero, such as "09".
$__WEEKOFMONTH__; Returns the range of days of month for the current week. If the current week begins on the 9th of the month and ends on the 15th of the month value for the labels would be "09-15". If the week is the first or last week of a month it may not represent seven calendar days – it only considers the days of the current month; the value of the last week of September 2013 would be "29-30" as the last day of the month is a Monday.
$propertyAlias; The property aliases as defined in the PropertyAliases.yaml document. This string in the URI will be replaced with the string value of the referenced property from the document being filed; if the server's property aliases do not alias this string the string will not be replaced, if the alias does resolve but the document in question lacks a matching property the string will be replaced with the literal "__undefined__".

Table 2: Label substitution values supported in the autoFileTarget URI property value.

Document auto-filing actions which would place the filed copy in the same folder as the original document or auto-filing attempts on zero-sized documents will be discarded by the auto-filing service; no copy will be made in either of these cases.

The creation of the document copies is performed using an administrative context - so the only permissions applied to the process are those applied to the origin folder to which the user or application initially uploads the document. Copies of the original document will however maintain the owner/creator of the original document.

The file-name of the new document will the an alpha lower case version of the original file with a randomized suffix between the file-name and the file extension; this eliminates the potential for file-name collisions.