1 Reply Latest reply: Feb 27, 2013 8:45 AM by Kaushal Bhati RSS

    How to capture the configuration details

    Vijay Nimmakuri
      Hi All,

      I have been trying to capture all the configuration details once the user hits the Finish button. I tried using PostConfigsave event and tried to insert the values into CZ attributes tables but could not succeed.

      Apart from PostconfigSave, is there any event to capture all the configuration details. Please share if there is any sample code.

      Note : I am not sure, Iam facing an error while testing the model with Debugger iam getting the below error. Does PostConfigSave effects with this....
      User Interface 'ORA-01403: no data found' is not up to date for model 'Prototype Product Models/Vijay's Prototype Models/'


      ************************************* Below is the sample code which iam using***************************************
      import java.sql.Connection;
      import java.sql.PreparedStatement;
      import java.sql.ResultSet;
      import java.sql.SQLException;
      import java.sql.Statement;


      import com.sun.java.util.collections.ArrayList;
      import com.sun.java.util.collections.Collection;
      import com.sun.java.util.collections.List;
      import com.sun.java.util.collections.Map;
      import com.sun.java.util.collections.Iterator;
      import oracle.apps.cz.cio.BomNode;
      import oracle.apps.cz.cio.Configuration;
      import oracle.apps.cz.cio.IOption;
      import oracle.apps.cz.cio.IOptionFeature;
      import oracle.apps.cz.cio.IRuntimeNode;
      import oracle.apps.cz.cio.NoSuchChildException;
      import oracle.apps.cz.cio.SelectionNotMutexedException;

      public class CfgExportTest {
           
           Configuration config =null;
           
           public void exportData(IRuntimeNode irn){
                Configuration config = irn.getConfiguration();
                String value;
                try{
                IOptionFeature of= (IOptionFeature)irn.getChildByName("Select a panel"); //its one of the opton feature on UI
                IOption opt= of.getSelectedOption();
                value=opt.getDisplayName();
                insertAttributes(irn,config, value);
                }
                catch(NoSuchChildException e)
                {
                     e.printStackTrace();
                }
                catch( SelectionNotMutexedException e)
                {
                     e.printStackTrace();
                }
           }
           

           
           public int insertAttributes (IRuntimeNode node,Configuration config, String value)
           {
                Connection conn = config.getContext().getJDBCConnection();
                PreparedStatement pStmt = null;
                int ret=0;
                try {
                String insertString = "INSERT INTO CZ_CONFIG_ATTRIBUTES (CONFIG_HDR_ID, CONFIG_REV_NBR,CONFIG_ITEM_ID, ATTRIBUTE_CATEGORY,ATTRIBUTE2)";
                String valueString = " VALUES(?,?,?,?,?)";
                String sql = insertString + valueString;
                pStmt = conn.prepareStatement(sql);
                //Bind/set values to the parameters
                // Add config_hdr_id.
                pStmt.setLong(1,config.getConfigHeaderIdLong());
                // Add config_rev_nbr.
                pStmt.setLong(2,config.getConfigHeaderRevisionLong());
                // Add config_item_id.
                pStmt.setLong(3,node.getConfigItemID());
                // Add flexfield context for attribute.
                pStmt.setString(4,"CIO Integration" );
                pStmt.setString(5,value );
                // Iterate over attributes.

                ret = pStmt.executeUpdate();
                pStmt.close();
                }
                catch(Exception e)
                {
                     e.printStackTrace();
           }
                return ret;
      }
      }


      **************************************************************************************************************


      Thanks,
      vijay

      Edited by: Vijay Nimmakuri on Jan 21, 2013 3:33 PM