November 16, 2012

Configuring Discussion Server to Webcenter Spaces



Below are the steps to configure the discussion server with webcenter spaces

          1)      Open the EM console: http://<host>:port/em
          2)      Go to “Service Configuration” Option in Webcenter domain as shown in the below screen
 
  
           3)      Select “Discussions & Announcements” from the list available

           4)      Click on Add button, you will get the below screen

           5)      Enter details in the screen as shown below

           6)      Make sure you are giving correct address for Server URL and admin user of the discussion server

           7)      And also check policies if you required to any specific one from the list

           8)      Click on Test and then Click on OK


           9)      Restart Spaces managed server for that host

Verifying Discussion Service in Spaces

By following the below steps, you can confirm that the discussion server is configured to webcenter spaces.
           1)      Login to webcenter admin: http://<host>:8888/webcenter
           2)      Go to Administrator àConfiguration àServices
           3)      You can see a Service named Discussions
           4)      Click on the “Discussions” service, will display their settings


November 15, 2012

How to set binding object values from Java class?


This post is to explain how to set values of an object to another object of same type in adf bindings from java class. To understand better, let’s take an example. I have a java class to which data control was created.  The class contains an object of ServiceRequest class which was defined during some actions in the class. The object contains setters and getters. The object is available for data control and a form is created for the fields of the ServiceRequest class on JSF page from the data control. We have a button on the JSF page. On click of the button, a java been method is invoked in which a webservice call is being executed and a response object of type ServiceRequest class is returned. This returned object should be set to binding object. To do this, we should get values of all the fields of return object and then set them to second object in bindings. The following code will do this.


BindingContext bc = BindingContext.getCurrent();
   
    BindingContainer bindingContainer = bc.getCurrentBindingsEntry();
    DCBindingContainer bindingsImpl = (DCBindingContainer)bindingContainer;
    DCIteratorBinding iter =
      bindingsImpl.findIteratorBinding("serviceRequestIterator");
    //get current row of the binding iterator
    Row row = iter.getCurrentRow();
    //Assign all attributes of result object to attributes of current row object in binding's iterator
    try {
      String[] attributeNames = row.getAttributeNames();
      for (int i = 0; i < attributeNames.length; i++) {
       
        String getter =
          "" + Character.toUpperCase(attributeNames[i].charAt(0)) +
          attributeNames[i].subSequence(1, attributeNames[i].length());
        System.out.println("attribute: " + getter);
        try {
          //create method for getter of each attribute
          Method method =
            serviceRequest.getClass().getMethod("get" + getter, null);
          System.out.println("method has been created");
          //get value of the getter method
          String value = (String)method.invoke(serviceRequest, null);
          //System.out.println("value for " + method.toString() + ": " + value);
          //set the value to the current row of the binding
          row.setAttribute(attributeNames[i], value);
        } catch (NoSuchMethodException ex) {
        }

      }
    } catch (Exception ex) {
      System.out.println("Error : \n");
      ex.printStackTrace();
    }

October 18, 2012

Unix commands to shutdown/restart


The below commands are very useful especially when we are working with Unix Consoles or VMs with Unix OS, to power off them properly.

To Shutdown:  /etc/halt -p
To Restart: /sbin/reboot