Showing posts with label oracle. Show all posts
Showing posts with label oracle. Show all posts

Friday, April 1, 2011

Get UCM Folders and Content Items using CIS API

You know one of this issues, it is very simple but you don't have it on top of your head and you have to look into the documentation for how to do it. Even if it's well documented it takes time and you just want to have a code snipped and use it into your application. One of this issues for example is reading the folders and the content items (documents) from UCM, when I develop some custom application. In this case I want to show you how to do it using UCM CIS API.

The first thing you need is a folder ID, which is the content ID from UCM. This is going to be your start folder and you will use it to read the child elements. What you also need is the current ICISApplication and application context. If you develop Portlets you may initialize them with your web.xml configuration. Having this you can go for the code bellow:

1 public List getSubFolders(String folderID, ICISApplication m_cis, String username) throws CommandException {
2 ISCSContext scsContext = m_cis.getUCPMAPI().getActiveAPI()._createSCSContext();
3
4 scsContext.setUser((username != null ? username : "guest"));
5
6 // this should be always true because we use UCPM API, so make sure that the adapter exist!
7 if (repData.getAdapterName() != null) {
8 scsContext.setAdapterName(repData.getAdapterName());
9 }
10
11 ISCSComponentFolderAPI folderAPI = m_cis.getUCPMAPI().getActiveAPI().getComponentFolderAPI();
12 ISCSFolderID csFolderId = m_cis.getUCPMAPI().getActiveAPI()._createActiveFolderID(folderID);
13 ISCSFolderDisplayResponse response = folderAPI.listChildren(getISCSContext(), csFolderId);
14
15 return response.getFolders();
16 }
17

Using this function you will get one sub level of folders for the given folder ID. If you want to get the documents inside a folder you can use this function:


1 public List getFoldersItems(String folderID, ICISApplication m_cis, String username) throws CommandException {
2 ISCSContext scsContext = m_cis.getUCPMAPI().getActiveAPI()._createSCSContext();
3
4 scsContext.setUser((username != null ? username : "guest"));
5
6 // this should be always true because we use UCPM API, so make sure that the adapter exist!
7 if (repData.getAdapterName() != null) {
8 scsContext.setAdapterName(repData.getAdapterName());
9 }
10
11 ISCSComponentFolderAPI folderAPI = m_cis.getUCPMAPI().getActiveAPI().getComponentFolderAPI();
12 ISCSFolderID csFolderId = m_cis.getUCPMAPI().getActiveAPI()._createActiveFolderID(folderID);
13 ISCSFolderDisplayResponse response = folderAPI.listChildren(getISCSContext(), csFolderId);
14
15 return response.getItems();
16 }
17

I hope that helps you, cheers!

Thursday, February 17, 2011

Oracle UCM GET_SEARCH_RESULTS service with full text search

Newly I was working on portlet which should be able to do full text search through the UCM documents and I was experimenting with the RIDC and also with the CIS API's. There are some ticks you may take care of, for example using quotes is a very special case and most of situations UCM will throw an exception if you not use them well. During my tests I was able to develop one solution which works very well for me doing full text search and here is it:
 
1 final IdcClientManager idcManager = new IdcClientManager();
2 final IdcClient idcClient = idcManager.createClient("idc://127.0.0.1:4444");
3 final IdcContext idcContext = new IdcContext("sysadmin");
4
5 final DataBinder binder = idcClient.createBinder();
6
7 // populate the binder with the parameters
8 binder.putLocal ("IdcService", "GET_SEARCH_RESULTS");
9 binder.putLocal ("QueryText", "dDocFullText <substring> <qsch>"+yourSearchWordOrWords+"</qsch>");
10 binder.putLocal ("SearchEngineName", "databasefulltext");
11 binder.putLocal ("ResultCount", "20");
12
13 // execute the request
14 ServiceResponse response = idcClient.sendRequest (idcContext, binder);
15
16 // get the binder
17 DataBinder serverBinder = response.getResponseAsBinder ();
18 DataResultSet resultSet = serverBinder.getResultSet ("SearchResults");
19
20 // loop over the results
21 for (DataObject dataObject : resultSet.getRows ()) {
22 System.out.println ("Title is: " + dataObject.get ("dDocTitle"));
23 System.out.println ("Author is: " + dataObject.get ("dDocAuthor"));
24

 

Nothing special so far except the line which declares the full text search. To be able to proceed with the full text search you have to use dDocFullText attribute inside the search query. The tag <substring> is the same as 'like'. Also you have to put your searching string or words in quotes which could be a problem sometime, so I used the tag <qsch>. Using this tag you can have quotes now inside your search string without to break the code and get parsing exceptions.

 

To be able to test the example, you do have to enable full text search inside UCM. To do this follow the steps for example from this blog here and then re-index the documents in UCM.

 

There is also one very nice article about how to define UCM queries if you want to replace the full text search with something more specific, you can read this article from Kyle's Blog here.

Wednesday, January 26, 2011

WCI LDAP Directory query size limit

In one of my previously articles I was talking about how to export users from Oracle WebCenter Interaction LDAP Directory. This works well if you want to export a limited number of users. If you try to export all users registered inside the portal you will realize that you are not able to get more then 1000 users at once. In case you use some LDAP browser and then you click to export the entire user tree you will get only limited set. There are many reasons for this limitation but basically is done because of performance reasons.
In case you want to export all users let's say to migrate to another system you can change the limitation to a value which allows you to export all users. You can do this by doing following:

Go to the server where your WCI LDAP Directory service runs. The limitation is configured in the configuration.xml file, which you can find under: %WCI_INSTALL_PATH%/settings/.

Inside the folder open the configuration.xml file and search for the component: aluidirectory:backend:rdbms. Inside the component section you should see the following configuration:

        <setting name="query:sizelimit">
            <value xsi:type="xsd:integer">1000</value>
        </setting>

Change the value to a number which will allows you to export all users from the database. Make sure that you restart the LDAP Directory Service after you make the change.


IMPORTANT: After you finish with the export, change back to the original value and restart the service again.

Thursday, May 27, 2010

Oracle WebCenter Portlet Debugging

Author: Alexander Rudat

Info: This article was migrated from the old blog!

Introduction

This article describes how to debug a portlets that is already deployed to WebLogic server using Oracle JDeveloper 11g.

Overview

These a re the basic steps involved in remote debugging an WebCenter portlets deployed in WebLogic:

  1. Configuration of the WebLogic to support remote debugging
  2. Configuration of the portlet project in JDeveloper
  3. Actual debugging of the portlet

Configuration of the WebLogic
To start the WebLogic server in debugging mode, there are a couple of configuration changes that need to be done to the WebLogic domain where the portlet is deployed.

First we need to edit JVM options of the WebLogic server startup script where the portlet is deployed. Normally the startManagedWebLogic.cmd is used to start this managed server.
This startup script is located in the %MIDDLEWARE_HOME%\user_projects\domains\<domain_name>\bin  directory, where %MIDDLEWARE_HOME% is the installation directory of WebLogic.

Add the following line before the set JAVA_OPTIONS= line:

set REMOTE_DEBUG_JAVA_OPTIONS=-Xdebug -Xnoagent -Xrunjdwp:transport=dt_socket,address=4000,server=y,suspend=n


Change the set JAVA_OPTIONS= line to read like the one below:

set JAVA_OPTIONS=%SAVE_JAVA_OPTIONS% %ADF_JAVA_OPTIONS% %REMOTE_DEBUG_JAVA_OPTIONS%


After this changes save the startup script and start the managed server and be sure that you have access to the admin console (for example http://localhost:7001/console).

Finally we need to check, that HTTP tunneling is enabled on the managed server. To do this, login to the admin console, select the managed server and select the Protocols tab.

wls_protocols


Be sure that Enable Tunneling is selected.


Configuration of the portlet


First let's create a new run configuration specifically for remote debugging. Double-click the project where you portlets are developed.

jev_show_profile

In the Project Properties select the Run/Debug/Profile page. Click New... to create a new run configuration. In the Create Run Configuration  dialog enter Remote Debugging for the name of the run configuration. Leave the Copy Settings From selection to Default and click OK to create the new run configuration.

jev_create_profile

Once the Remote Debug run configuration is created, select it in the Run Configurations and click Edit... to bring up the Edit Run Configuration dialog. In the Launch Settings page click on the Remote Debugging checkbox to enable remote debugging for this run configuration.

jev_edit_profile1


Finally select the Remote page and verify that the Protocol is set to Attach to JPDA and the port matches the port specified earlier when configuring WebLogic for remote debugging (defaults to 4000).

jev_edit_profile2

Actual debugging of the portlet

To start the remote debugging profile, right-click on your portlet project and select Start Remote Debugger.

Now JDeveloper is asking the host and port specification. If you WebLogic server is installed locally, you can apply the default settings:

jdev_attach_to_jpda

Set a breakpoint at you java code and run the portal (WebCenter) application, where the portlet is used.


jdev_debugging

That's all, now you are able to debug the portlet java code. Hope you will find all errors in your portlet :-)

References

http://www.oracle.com/technology/products/jdev/howtos/weblogic/remotedebugwls.html