Wednesday 29 July 2020

Under the Covers of the 11.2 Document Repository

Admittedly this is a pretty niche topic but I thought I may as well post it anyway.

On our EPM 11.1.2.3 system we had a mechanism whereby users could upload documents to Workspace and then our batch jobs could run with those files as parameters. In order to do this we would have to reconcile the folder and filename in R&A Workspace with the folder and filename in the RM1 folder. This required getting information out of the database and creating it as a view.

So in 11.1.2.3 a typical view entry would look like the below:


The definition of the view is available below.



Now in 11.2 the RA repository is no more - but there is something similar. So we wanted to create functionality that could do the same thing. In 11.2 the tables are very, very different. The file itself (in fact most document properties) are saved as hex values in the database table, so additionally we would have to change our scripts to pull the file data out of the table first and then run operations on it.

The document repository tables relevant for us are:

  • REPOSITORY_OBJECTS - gives us the UUID of a repository object, the object type, parent object, owner and last modified date
  • REPOSITORY_OBJECT_PROPERTIES - allows us to view the properties of an object, encoded as a hex string - properties include the name, description, file size, original filename and content
  • REPOSITORY_OBJECT_PROP_INDEX - is essentially the properties of the properties of an object, giving us the data type and string value for properties of a certain object

So seeing the data in these tables I knew we would be able to build a view to give the information we needed. The tables above had the information we needed - the object hierarchy, object names, UUIDs, owners and last modified dates. The only thing I needed to do was pull all the data together.

I wanted to keep the exact same view columns so I knew I would have to somehow change the existing view definition into something that can be used with 11.2. Now I am not the best SQL coder so I am sure there are much better ways of achieving the same result but I managed to adapt the view, so now it will give a view entry like the below:


The new definition of the view is available below.



Hopefully this information will prove useful to someone! If someone finds a way to optimise the view and suggest improvements I am very open to that. For us the next step is to create a function that pulls the related object out of the SQL tables. So the query would do something like:

SELECT PROPERTY_VALUE FROM [HSS].[dbo].[REPOSITORY_OBJECT_PROPERTIES]
WHERE OBJECT_UUID = '...' AND PROPERTY_NAME = 'jcr:data'