The function will be use to convert binary data in OSB context variable into string.
Another useful POJO to add to your OSBToolkit.java.
public class OSBToolkit
{
public OSBToolkit()
{
}
public static String convertOSBBinaryContentToString(DataSource ds) throws Exception
{
InputStream is=ds.getInputStream();
BufferedReader din = new BufferedReader(new InputStreamReader(is));
StringBuffer sb = new StringBuffer();
try {
String line = null;
while((line=din.readLine()) != null){
sb.append(line+"\n");
}
}
finally{
try{
is.close();
} catch(IOException ex){}
}
return sb.toString();
}
}
Showing posts with label Java. Show all posts
Showing posts with label Java. Show all posts
Monday, July 21, 2014
Convert Siebel datetime to XML
Class to parse Siebel datetime format into XML standard format.
Another useful POJO to add to your OSBToolkit.java.
public class OSBToolkit
{
public OSBToolkit()
{
}
public static Date convertSiebelDateTimeToXML(String dateString) {
Date stringDate = null;
try
{ //If dateTime
if(dateString.trim().length() > 10)
{
stringDate = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(dateString);
}// If just a date
else if(dateString.trim().length() > 0)
{
stringDate = new SimpleDateFormat("MM/dd/yyyy").parse(dateString);
}
}
catch(Exception e)
{
e.printStackTrace();
}
return stringDate;
}
public static String convertXMLToSiebelDate(Date date) {
String formattedDate ="";
if(date != null)
{
SimpleDateFormat format =
new SimpleDateFormat("MM/dd/yyyy");
formattedDate = format.format(date);
}
else
{
}
return formattedDate;
}
}
Another useful POJO to add to your OSBToolkit.java.
public class OSBToolkit
{
public OSBToolkit()
{
}
public static Date convertSiebelDateTimeToXML(String dateString) {
Date stringDate = null;
try
{ //If dateTime
if(dateString.trim().length() > 10)
{
stringDate = new SimpleDateFormat("MM/dd/yyyy HH:mm:ss").parse(dateString);
}// If just a date
else if(dateString.trim().length() > 0)
{
stringDate = new SimpleDateFormat("MM/dd/yyyy").parse(dateString);
}
}
catch(Exception e)
{
e.printStackTrace();
}
return stringDate;
}
public static String convertXMLToSiebelDate(Date date) {
String formattedDate ="";
if(date != null)
{
SimpleDateFormat format =
new SimpleDateFormat("MM/dd/yyyy");
formattedDate = format.format(date);
}
else
{
}
return formattedDate;
}
}
Sleep/pause/throttle the transaction in OSB
From time-to-time you have requirement to sleep/pause/throttle the transaction in OSB. You can do this by using a simple POJO.
Below is a class to add to your OSBToolkit.java.
public class OSBToolkit
{
public OSBToolkit()
{
}
public static String sleep(long l)
{
String s;
try
{
Thread.sleep(l);
s = "Success";
}
catch(Exception exception)
{
s = "Error";
}
return s;
}
}
Then from OSB, reference to the OSBToolkit and the sleep class, specify the following value as input:
xs:long(5000)
Below is a class to add to your OSBToolkit.java.
public class OSBToolkit
{
public OSBToolkit()
{
}
public static String sleep(long l)
{
String s;
try
{
Thread.sleep(l);
s = "Success";
}
catch(Exception exception)
{
s = "Error";
}
return s;
}
}
Then from OSB, reference to the OSBToolkit and the sleep class, specify the following value as input:
xs:long(5000)
Subscribe to:
Posts (Atom)
Topics
- 12c (1)
- Architecture (2)
- B2B (1)
- Banking (1)
- BPEL (3)
- Cisco (1)
- ebXML (1)
- EDIFACT (1)
- Effective Management (2)
- Engineered Systems (2)
- Exadata (2)
- Exalogic (1)
- Governance (1)
- Innovative (1)
- Issue Management (1)
- ITIL (1)
- Java (3)
- JDeveloper (2)
- Methods (27)
- Mobility (1)
- OFM (5)
- OIC (1)
- Oracle SOA Suite (7)
- OSB (1)
- Principles (8)
- Release Management (1)
- Scripting (1)
- Standards (3)
- Virtualization (1)
- webMethods (6)
- XPath (1)