Posts

Showing posts from September, 2012

Append two Arrays in Java

Still need to optimize this method but this works with out any issues, public String[] appendArrays(String[] arrayToAdd, String[] arrayFromAdd) {         List<String> list = new ArrayList<String>(Arrays.asList(arrayToAdd));         if (arrayFromAdd != null && arrayFromAdd.length > 0) {             list.addAll(Arrays.asList(arrayFromAdd));         } else {             arrayFromAdd = new String[]{"N/A"};             list.addAll(Arrays.asList(arrayFromAdd));         }         return list.toArray(new String[list.size()]);     }    

Convert ResultSet to Array in Java

public String[] convertRStoArray(ResultSet resultSet, boolean closeResultSet) {         String[] arrayofDataColumns = null;         Map columnsMap = new HashMap();         int columns = 0;         try {             List<String> record = new ArrayList<String>();             while (resultSet.next()) {                 arrayofDataColumns = new String[resultSet.getMetaData().getColumnCount()];                 columns = (resultSet.getMetaData()).getColumnCount();                 String value = null;                 for (int i = 1; i <= columns; i++) {                     value = resultSet.getString(i);                     record.add(value);                     if (columnsMap.containsKey(i)) {                         if (value != null && !value.equals("")) {                             if (columnsMap.get(i) != null && !columnsMap.get(i).equals("") && !columnsMap.get(i).equals(value)) {                                 value = c...

IBM Sterling B2B Integrator Code List Deployment through Command Prompt

C:\Sirish\SterlingIntegrator\install\tp_import> import.cmd -update -passphrase passphrase -input C:\Sirish\bpml_coding\Sirish.xml This is the format requires to import from command prompt. Sirish.xml <?xml version="1.0" encoding="UTF-8"?> < SI_RESOURCES xmlns =" http://www.stercomm.com/SI/SI_IE_Resources " xmlns:xsi =" http://www.w3.org/2001/XMLSchema-instance " GISVersion =" 6000 " FrameworkVersion =" 2 ">             < CODE_LISTS >                         < CODE_LIST_XREF >                                     < LIST_NAME > Sirish </ LIST_NAME >      ...

Offset for given Time Zone

import java.util.TimeZone; public String getTimeZoneOffSet(String timeZoneID) {         TimeZone tz = TimeZone.getTimeZone(timeZoneID);         int rawOffset = tz.getRawOffset();         int hour = rawOffset / (60 * 60 * 1000);         int minute = Math.abs(rawOffset / (60 * 1000)) % 60;         return hour + ":" + minute;     } Test:  tc.getTimeZoneOffSet("America/New_York")); This returns Offset for NY -->-5:0 Using Calendar Class import java.util.Calendar ; public int getOffsetForTimeZone(String timeZoneId) {         int a;         Calendar calendar = new GregorianCalendar();         TimeZone timeZ = calendar.getTimeZone();         ti...

Graphical Process Modeler not opening in Sterling Integrator

Most of the times we get the below exception while opening Graphical Process modeler because the IP address in the below URL is not correct. Sterling Integrator host address and GMP host address different then we need to fix the host name and make it common. com.sun.deploy.net.FailedDownloadException: Unable to load resource: http://192.168.235.76:15000/gbm/pmodeler/ProcessModeler.jnlp     at com.sun.deploy.net.DownloadEngine.actionDownload(Unknown Source)     at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)     at com.sun.deploy.net.DownloadEngine.getCacheEntry(Unknown Source)     at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)     at com.sun.deploy.net.DownloadEngine.getResourceCacheEntry(Unknown Source)     at com.sun.deploy.net.DownloadEngine.getResource(Unknown Source)     at com.sun.deploy.net.DownloadEngine.getResource(...