Friday, May 24, 2013

New page template for custom webcenter project : Not able to add as portal resource

I recently faced a strange issue while creating a new template for webcenter project in Jdeveloper. I created a custom page template for my portal application based on a quick start layout and added some custom code that displays content for header and footer region . Now when I tried to add this page template as a new page template in resource catalog by right clicking the PageTemplate.jspx and selecting create as portal resource. It gives me notification, that "the jspx document is not a valid page template or content presenter template. Recognizing the resource type as Page Style".

In <af:xmlContent> tag you should add:

<description>Facet for content</description>
And in some parte of your code you need add this:
<af:facetRef facetName="content"/>

After this change if you will try to add the template in resource catalog,it should work fine.Hope this helps.

Friday, April 19, 2013

ADF 11g Skinning

An excellent article by Frank on how to approach skinning in ADF , helps to understand how to approach skinning in ADF. Also with latest release of Jdeveloper you have a skin designer as part of Jdeveloper itself , which makes skinning a lot easier.Here is the link to the article : . 

ADF 11g .... now Free !

I was not aware that Oracle has now made ADF free, that is a great news for entire J2EE community, now you can quickly develop rich web applications on ADF 11g and deploy on any open source free server like Glassfish, etc. Here is the link for the declaration :

Tuesday, April 16, 2013

Webcentre Discussions Dissection

Hi All , after sleeping for quite some time, thought to start blogging back. This  time I thought to start with ADF/Webcentre. Webcentre , as we all are seeing is gaining quite a momentum in consulting market now and I can see numerous projects being done some standard spaces implementation , but most projects are custom Webcentre portal as its gives you the liquidity to build any to integrate or build standard ADF application and use lot many features of Webcentre.

An essential part of Webcentre is Webcentre Discussions(Jive Forums) server and its service. Recently I worked on a custom webcentre project where I integrated the discussion service of webcentre. My idea of writing this article is to explain the discussion service terminology and  details and then programmatic API(s) which might help you to do something creative in your project with discussion service.

About Jive Forums
Jive forums is the software which runs on discussion server and is a self sufficient forums portal/website. In fact Oracle forums are built on the same platform. Its quite stable, robust and fast.There are currently two editions of Jive Forums: Silver Edition (for small to midsize deployments) and Gold Edition (for large deployments). Some Features unique to the Gold edition include:

• Question/answer workflow, through which users can mark a post as a question then designate
responses as helpful or correct (scoring points for the users who posted them).
• Expert email notification, in which email notifications are sent for unanswered questions.
• Multiple theme configurations to customize look and feel.
• Reward point system, where points are awarded for responses based on how useful the response
turns out to be.
• Community everywhere, through which users embed discussion threads into other web pages.
• Web services for programmatic access to Jive Forums data.

Discussion Forums basics
a) Community : A community typically corresponds to a group of people with a common set of interests and it usually has a single overall purpose.
b) Category : A category is the broadest classification of content in a community. Categories may contain other categories, forums, threads, and messages.
c)Forum: A forum generally focuses on a single thread or a small group of associated threads, and is narrower in scope than a category.
d)Thread : Threads are the individual questions or subjects discussed within the scope of a single forum.A thread is defined as an original message and all of its replies. Threads may run only a few messageslong, or may include hundreds of messages.
e)Message : A message refers to a single question, discussion point or reply that is posted to a forum.Messages comprise a subject header, a message body, and sometimes a file attachment or attachments.

Discussion Forums database details
Sometimes, its essential to look into the database of discussion forums, for a requirement like grooup update of something. For this reason, it is absolutely necessary for you to have the understanding of some of the main tables, used in Forums are :

Category : select * from jivecategory where name like ('')

Forums: select * from jiveForum where categoryid=<category id which you can get from jivecategory>

Thread :  Thread is created in the forum where root message id is the starting message of the thread.
select * from jivethread where forumid=92 order by modificationdate desc
You can get root messageid and thread id from the above query. Root message id is the starting message of the thread.

Message : All messages of a thread are stored in the table jivemessage with parent child relationship also maintaining the sequence of replies.If parentmessageid is null then root message, else child message.

select * from jivemessage where forumid= and threadid= and messageid=

--the direct child of this message can be found by quering with parent
--message id as message id
select * from jivemessage where forumid= and threadid= and parentmessageid=

-- using connect by prior getting entire message stack of a thread
--starting from root node
      FROM jivemessage jv
      where jv.forumid= and jv.threadid=
      START WITH jv.messageid =
      CONNECT BY PRIOR jv.messageid = jv.parentmessageid
      ORDER by creationdate
-- Pls note that each message 's user id
-- is jive user id which is based on LDAP username configured in weblogic security realm
-- and the relationship is stored in jiveuser table  

Webcentre Discussion Services Available Taskflows:
With the discussion services, you have the following taskflows:

  1. Discussion Forums: Taskflow that integrates the basic functionality to allow discussions on a page
  2. Discussions - Popular topics: Taskflow that shows the popular topics
  3. Discussions - Quick view: A smaller view to list the topics
  4. Discussions - Recent topics: Taskflow that shows a list of the recent topics
  5. Discussions - Watched topics: Taskflow that shows the list of the watched topics from the current user
  6. Discussions - Watched forums: Taskflow that shows the list of the watched forums from the current user

Webcenter Discussion Forum Programmatic APIs:
Sometimes, you might get a requirement, where you  have requirement to play with code on creating category/discussions/forums. programatically, so giving common APIs used for the same:

Common code for all:

import oracle.webcenter.collab.announcement.AnnouncementFilter;
import oracle.webcenter.collab.announcement.AnnouncementService;
import oracle.webcenter.collab.announcement.AnnouncementSession;

public ForumSession session = null;
public CategoryService catService = null;
public ForumService forumService = null;

catService = (CategoryService)session.getService(CategoryService.class);
Category newCreatedCategory = catService.createCategory(null, new Long(parentCategoryId).toString(),categoryName, categoryName, categoryName);
categoryId = Long.parseLong(newCreatedCategory.getId());

catService = (CategoryService)session.getService(CategoryService.class);
long rootCategoryId = Long.parseLong(catService.getRootCategoryId());

List forums = catService.getForums(new Long(categoryId).toString(), null,true);
forumService = (ForumService)session.getService(ForumService.class);
Forum newCreatedForum = forumService.createForum(null,new Long(RootCategoryId).toString(),TopicName, TopicName, TopicName);
forumId = Long.parseLong(newCreatedForum.getId());
Forum forum = forumService.getForum(new Long(forumId).toString());
long topicCount = forum.getTopicCount();

I hope this article gives you a clear picture of discussion forums service in webcentre.