ADF: Cloning personalizations between users - read and write MDS Customization documents image14

ADF: Cloning personalizations between users – read and write MDS Customization documents

In a recent post I wrote how wonderful the ADF support for user level customizations or personalizations is, and then I went on to explain how the user can be enabled to remove her own personalizations (https://technology.amis.nl/2012/09/27/adf-undo-the-users-page-personalizations-query-and-manipulate-mds/). This article a sequel to that story. It will introduce the capability for one user to clone the personalizations from another user. This means at the background that the document that contains the customizations for a page for the ‘source user’ is read and a new document with the exact same contents is written for the ‘target user’ who will then have personalizations that are at that time exactly the same as those of the source user. There is no link between the two documents – they are both on their own. Any pre-existing personalizations for the target user are lost in this process.

Note: I do not talk about the privileges that you want to define in order to not have anyone copying from just anyone else. Also note that I discuss cloning the personalizations for a single page only. Copying all personalizations from one user to another however is a very simple extension of what is discussed below.

The steps for implementing this clone capability in an application that is already personalization enabled are remarkably simple.

The starting point is user SKING who has applied a number of personalizations to the following page:

image

User AHUNOLD
image
did not apply any personalization, so the page to him looks as the developers created it:

image

Alexander Hunold saw the page when his colleague Steven King was working with it, and he thought that amazing! Those superb personalizations had turned the page into a beauty, easy to use and addictive to look at. So Alexander wants his page to look the same as SKING’s. He uses the cloning mechanism:
image

and is informed:

image

After refreshing the page, now for AHUNOLD it too looks like:
image

In the MDS Repository, the document with personal customizations for SKING was copied for AHUNOLD. On the MDS File implementation that looks simply as follows:
image

Note: since both users have their own copy, any additional personalization made by one of them is invisible to the other. At any time though they can again close each other’s personalizations.

Implementation

Using the groundwork described in the previous article – https://technology.amis.nl/2012/09/27/adf-undo-the-users-page-personalizations-query-and-manipulate-mds/ – it is not a lot of work to implement the cloning. It primarily requires details on the MDS API functionality – by and large found here: http://idmclub.wikidot.com/metadata-store.

In the page itself, I have introduced an inputText and a slightly differently configured commandLink:

image

The Java Code in the MDSCoordinator class is as follows:
image

The last lines write the message for the user:
image

Resources

The class MDSCoordinator.

IDMClub Wiki on accessing the MDS API: http://idmclub.wikidot.com/metadata-store

Andreas Koop – ADF: MDS power user layer and “How to control MDS customizations at runtime” – http://multikoop.blogspot.com/2012/01/adf-mds-power-user-layer-and-to-control.html

One Response