Document metadata Set/Get

WebCenter Content User Interface – Get and Set Document’s Metadata

Hi all,

In my previous post about WebCenter Content User Interface I have written an overview about the available features of this new UI as well as how to start customizing it, and my experience and important milestones regarding installation. You can find my previous post here.

Today I’m going a little further and focus the attention on how to get and set document’s current properties and metadata attributes using the API available in the “WccAdfCustomization” application.

In my last post I’ve dragged-and-dropped a button to the “docInfoTabs.jsff” page that you can find inside of the “WccAdfLibrary.jar” library of the ViewController project. This is how it looks like:MyCustomButton

Now what we want is to get both document’s properties and metadata, and then set the comments for this same document when we click on the button. To do this we need to perform the following steps:

  1. Open the JDeveloper with “Default Role”. Then go to the ViewController project and create “MyCustomClass” java class. Create an action event listener method to be used by our button.MyCustomClass
  2. Assign “MyCustomClass” java class to the managed beans of “adfc-config.xml” file. From now on this class is available in the context of the “docInfoTabs.jsff” page.ManagedBean
  3. Go to your “docInfoTabs.jsff.xml” file and set the actionListener property like is shown in the next image:ActionListener
  4. Our “docInfoTabs.jsff” page is invoked inside “wccdoc.xml” bounded task flow. If you go to Managed Beans tab you can see the available classes inside it. We will take advantage of “DocInfoBean” class.WccdocTaskFlow
  5. Let’s return to our “MyCustomClass” java class and insert the following code inside “myCustomButtonAction”.
package wcc.custom.view;

import java.io.Serializable;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.Iterator;
import java.util.Map;

import javax.faces.component.UIComponent;
import javax.faces.component.UIViewRoot;
import javax.faces.context.FacesContext;
import javax.faces.event.ActionEvent;

import oracle.wcc.adf.model.Attachment;
import oracle.wcc.adf.model.Revision;
import oracle.wcc.adf.model.form.Field;
import oracle.wcc.adf.model.form.Form;
import oracle.wcc.adf.model.form.Item;
import oracle.wcc.adf.vc.DocInfoBean;
import oracle.wcc.adf.vc.DocumentOperationHelper;
import oracle.wcc.adf.vc.DynamicFormBean;

public class MyCustomClass {
    public MyCustomClass() {
        super();
    }
    
    public void myCustomButtonAction(javax.faces.event.ActionEvent p1) {
        
        //Getting document's properties
        
        //Getting the instance of 'DocInfoBean' class.
        DocInfoBean docInfoBean = (DocInfoBean)ADFUtils.getValueFromViewScope("wccDocInfoBean");
        //Getting the current revision of the selected document.
        Revision revision = docInfoBean.getRevision();
        System.out.println("Document Title:" + revision.getDDocTitle());
        System.out.println("Document Author: " + revision.getDDocAuthor());
        System.out.println("Document Last Modified Date: " + revision.getDReleaseDate());
        System.out.println("Document Status: " + revision.getLocalizedDStatus());
        System.out.println("Document Revision Number:" + revision.getDRevLabel());
        System.out.println("Document Comments: " + revision.getXComments());
        System.out.println("Document Profile: " + revision.getXIdcProfile());
        System.out.println("Document Type: " + revision.getDDocType());
        System.out.println("Document Format: " + revision.getDFormat());
        System.out.println("Document File Size: " + revision.getDFileSize());
        
        //Getting all metadata of the current revision of the selected document.
        DynamicFormBean dynamicFormBean = docInfoBean.getMetadataFormBean();
        Form form = dynamicFormBean.getForm();
        HashMap<String, Serializable> fieldValues = form.getFieldValues();
                
        Iterator iter = fieldValues.entrySet().iterator();
        while (iter.hasNext())
        {
            Map.Entry pair = (Map.Entry)iter.next();
            System.out.println(pair.getKey() + " = " + pair.getValue());
        }
        
        revision.setXComments("My Custom Comment");
        docInfoBean.setRevision(revision);
        //Set document's metadata for the current revision.
        DocumentOperationHelper.updateRevision(revision);
    }
}

6. The “getValueFromViewScope” method in my ADFUtils class look likes this:

public static Object getValueFromViewScope(String variable) {
      return AdfFacesContext.getCurrentInstance().getViewScope().get(variable);
}

7. Finally run your application and test the button.

 

Cheers,

Pedro Gabriel

@PedrohnGabriel

Post image by Cross Duck with small changes.

Webcenter UI Customization

WebCenter Content User Interface – Overview/Installation/Customization

Hi all,

Welcome to a new Red Mavericks article.

Today I’m writing about WebCenter Content User Interface. I will provide an overview over this renovated interface, some considerations regarding my installation experience process and what we can customize.

This article refers to Webcenter Content 11.1.1.9. We already have Webcenter’s 12c version, but the 11g is still widely used, even in most of our projects.

So, Oracle WebCenter Content User Interface offers a revamped interface, more user-friendly, with sophisticated:

  • Searching capabilities
  • Upload of multiple documents at once, each one with its own metadata form
  • Preview of documents with the related contents, metadata and revisions
  • Selection of document’s revisions via tabs
  • Tagging a document as Favorite
  • Perform actions over one or multiple documents in the list of documents

This new interface without any doubt increases users’ experience and usability as well as offering a simple way to store, secure, retrieve, and share any type of document.

I think this new user interface puts Webcenter Content more tuned to the reality of the current Oracle web applications, brings it to a new level of experience.

WebCenter Content User Interface was entirely redesigned using ADF and can be easily customized. From developer’s point-of-view is much easier to develop new features targeted to specific customer needs since we just need to use ADF instead of Idoc Script.

Administration configurations still remain only accessible on the default native WebCenter Content interface, but from my point-of-view this is not an issue since we can think of this interface as a backoffice and the new one as the interface for the end-users.

 

Installation

In order to use WebCenter Content User Interface you must have already installed the WebCenter Content 11.1.1.8 or 11.1.1.9 versions.

Then you will need to perform a second installation for the new WebCenter Content User Interface with both Weblogic Server and Oracle Development Framework. This second installation requires a separate domain.

You can perform this second installation in two ways:

  1. In one single host, i.e., in the same host where you have previously installed WebCenter Content domain.wcccui
  2. In completely separate  machines as well.wccui2

In both cases this new domain will then connect to WebCenter Content Server. You can follow the installation instructions here.

During my installation I felt some lack of information regarding MDS configuration for this new domain that will contain the WebCenter Content User Interface. Basically, before you can run the scripts mentioned in the installation instruction in the weblogic shell to create the metadata partition (point 6 of Chapter 12.5) you will have to:

  1. Download the Repository Creation Utility (RCU) 11.1.1.8 via Oracle E-Delivery
  2. Run ./rcu located in rcuHome/bin folder
  3. When you reach the “Step 3 of 7: Select Components” you should select:
    • WebCenter Content
      • If the database you are connecting to is based on 12c you should unselect the option “Oracle Information Rights Management” since it is not supported.
  4. Oracle Platform Security Services” inside of “AS Common Schemas

Customization

After a successful installation of this new domain you are ready to use it and customize it based on your customer requirements.

In the installation machine you are able to find the full ADF application of this new interface. You can find it in this location

WCCUI_MW_HOME/oracle_common/webcenter/wccadf/WccAdfCustomization.zip

 

In order to use this application you will have to install the version 11.1.2.4 of the JDeveloper. You can find more details here.

Inside of the “WccAdfCustomization” application you should select the “Show libraries” in the Application Navigator in order to have access to important jars that you can take advantage for your developments.

This application contains two projects:

  • Model – Gathers the data from the WebCenter Content Server. In this project you should turn your attention to “jar”.WccAdfMdsIntegration
  • ViewController – This is the project were you will do interface customizations. Here you have the “jar” library. In this library you can find all the pages of the WebCenter Content User Interface.

 

WccAdfLibrary WccAdfLibrary2

During your customization you cannot directly edit the pages from “WccAdfLibrary.jar” library. You will have to create what Oracle call as “Seeded Customization Layer””.

You can have as many seeded customization layers as you want.

 

So what really is a “Seeded Customization Layer”?

A “Seeded Customization Layer” is a container of one type of customizations. In most cases, one layer would be sufficient but if multiple layer values are defined, the customizations for those values are applied in the order in which they are defined.

For example, imagine that you want different customizations for each deployable environment or different customers. The layers you create will be under the customer layer.

 

Where can I create a customization layer?

In order to create a customization you need to open the “adf-config.xml” file under “Application Resources”. Find the “customerCustomizationLayerValues” properties and insert the name we want for your layer.CustomizationLayer

Then open the “CustomizationLayerValues.xml” file also under the “Application Resources”. Find the “customer” layer and set the same name as you have given in the “value” property.

CustomizationLayer2

 

How to customize a page?

To customize a page you need to open the JDeveloper in “Customization Developer” role.CustomizationDeveloper

 

After JDeveloper having started you can notice that the “customer” customization layer is selected with the “Demo” layer that we have previously set in the configurations’ files. If you define more than one layer you can select the one you want to perform your customizations.CustomizationLayer3

Expand the “WccAdfLibrary.jar” library from the “ViewController” project and open the “docInfoTabs.jsff” page from the “wcc” package. As you can notice you cannot directly edit the code but you can drag-and-drop new controls or even use the “Property Inspector” to edit them.

For this example try to drag-and-drop a button as shown in the next image.

CustomizationLayer4

After you have inserted the new button you can notice that a new file is generated for you in the “ViewController” project with the new button. From now on you can edit the button properties over the new file “docInfoTabs.jsff.xml”.

CustomizationLayer5

The generated packages structure identifies the “Seeded Customization Layer”.

 

How can I test my customizations?

Before you can start testing your application in your Integrated Weblogic Server you need to set the idc connection and admin user in the “connections.xml” file under the “Application Resources”. This configuration specifies the default, local WebCenter Content server connection.

On the next post we’ll explore how to use these same button to get document’s current properties and metadata, change one of the metadata attributes and save it using the API available in the “WccAdfCustomization” application.

connections

 

Cheers,

Pedro Gabriel

@PedrohnGabriel

 Image post by Chad Horwedel