Thursday, November 24, 2011

Oracle SOA Suite – Purging the Xref Data through JAVA API.

Oracle SOA Suite  – Purging the Xref Data through JAVA API.

The Oracle SOA Suite 11g and Oracle SOA Suite 12cprovides the Java API’s that can be used to purge the Xref Data.

The client API provides the Locator class to purge the Xref Data based on the filter.

locator.purgeXRefData(XRefPurgeFilter purgeFilter);

The XRefPurgeFilter class is used to set the filter condition to purge the Xref Data.

XRefPurgeFilter purgeFilter =new XRefPurgeFilter();

purgeFilter.setPurgeXRefTableURI ("oramds:/apps/EAIMetaData/Xref/Test.xref");

Specify the Xref Table for which data needs to be purged. If no column names are provided, all data for that XRef Table would be purged.

purgeFilter.setPurgeXRefTableURI – Can be used only combination with purgeFilter.addColumnToPurge, 

if we are using purgeFilter.setPurgeXRefTableURI with other filter conditions like purgeFilter.setPurgeDataBefore, we would receive the following error.

EJB Exception: ; nested exception is: java.lang.RuntimeException: oracle.tip.xref.exception.RepositoryException: Unable to access Cross Reference Values from Database.The SQL Exception is: "ORA-00933: SQL command not properly ended " Please ensure that the database is accessible. If accessible, please look at the stack trace and fix the issue. If unable to fix contact Oracle Support Fetching Data...

Add column names for specified XRef Table whose column data would be purged. 

If we are using purgeFilter.addColumnToPurge with any other filter condition other than purgeFilter.setPurgeXRefTableURI would be ignored.

Last modified date before which all data in the database would be purged.

All data in the database would be purged

Last modified date after which all data in the database would be purged.

The following code snippet will enable you to purge the Xref Data based on the filter condition.

Jar File required - <JDEV_HOME>\soa\modules\oracle.soa.mgmt_11.1.1\soa-infra-mgmt.jar

Hashtable jndiProps = new Hashtable();
Locator locator = LocatorFactory.createLocator(jndiProps);
java.util.Date purgeData=new Date(2011,11,24);

XRefPurgeFilter purgeFilter =new XRefPurgeFilter();
// purgeFilter.addColumnToPurge("ColumnA");
// purgeFilter.setPurgeAllData(true);
}catch(Exception e)

No comments:

Post a Comment