Who created that Site Studio section?

question was asked today on the Oracle WebCenter Content forum about how to determine the user who created a Site Studio section.

Hi All, is it possible to get the user details about one section, like who has created that section in site hierarchy

Out of the box, Site Studio does not appear to store the user name of the person who created a section. If this information were to be found, we would expect to find it in the XML project file. However, upon examination of a newly created section, there is no mention of the user who created that section.

<section label=”456″ nodeId=”23″ urlDirName=”456″/>

This issue can be solved but to do so, a custom component is needed. Site Studio sections are created via the service SS_ADD_NODE. This service calls the addNode method. There is a filterSiteStudioAddNode, that is fired at the end of the addNode method. At first, my thought was to use similar code to addNode (and the other methods it calls) to add/set an attribute on the newly created section. However, most of this code is in methods with protected or no modifier. This makes it difficult (but not impossible) to gain access to those methods. Even if that code were easily accessible, a better approach is to call the Site Studio service SS_SET_NODE_PROPERTY at the end of the SiteStudioAddNode filter.

  • Description: This service sets a node property.
  • Parameters:
    • siteId: the unique identifier of the site (required).
    • nodeId: the unique identifier of the node (required).
    • property: the name of the property to set or remove (required).
    • value: the new value of the attribute (optional). If the value is not specified, the property will be removed.
  • Returns: Nothing.
  • Security: The user must have at least write access to the node.

This service will do everything we need and if Oracle decides to change their code, our code keeps working because we are simply calling a service. The parameters needed for this service call are in the filter’s DataBinder. The new section’s nodeId is in the DataBinder as the parameter newNodeId. The property parameter is the name of the attribute we want to set. For this, I created a preference prompt, SSSectionCreatedBy_PropertyName, which contains the attribute name (by default, the preference prompt value is createdBy). The value attribute, is the current user. This can be retrieved from the ExecutionContext which can be cast to a Service object since we are in a filter. I have made the component, [download id=”10″], available for download. Below, you can find the Java filter code to implement the functionality of storing the user who created a section. This same approach to building a component can be applied to add other information (such as a security related information) to a newly created section node in the project file. Once the component is installed and enabled, adding a new section will result in similar information being added to the project file (notice the createdBy attribute).

<section createdBy=”sysadmin” label=”456″ nodeId=”23″ urlDirName=”456″/>

This createdBy property can be retrieved by calling the service SS_GET_NODE_PROPERTY with parameters siteIdnodeId and property (where property is the attribute name set in the preference prompt). The value is returned in the LocalData as value. You can also retrieve the createdBy property using the Idoc Script function ssGetNodeProperty (pass in the parameters nodeId and name, where name is the attribute name set in the preference prompt).

Leave a Reply

2 Comments on "Who created that Site Studio section?"

Notify of
avatar
Sort by:   newest | oldest | most voted
Romain
Guest
Romain

Thanks for this very instructing article!
Where do I find the list of all filters (SiteStudioAddNode.. etc) that are fired by UCM or SSXA?
Also how do you created the component, especially SSSectionCreatedBy.hda? Is there a tool for that?

wpDiscuz