Example usage for java.util ArrayList toString

List of usage examples for java.util ArrayList toString

Introduction

In this page you can find the example usage for java.util ArrayList toString.

Prototype

public String toString() 

Source Link

Document

Returns a string representation of the object.

Usage

From source file:usbong.android.utils.UsbongUtils.java

public static View applyHintsInView(Activity a, View myView, int type) {
    Log.d(">>>>>>", "1");
    String filePath = UsbongUtils.USBONG_TREES_FILE_PATH + myTreeFileName + ".utree/hints/hints.xml";
    File file = new File(filePath);
    if (!file.exists()) {
        Log.d(">>>>>>", "2.1");
        file = new File(
                UsbongUtils.USBONG_TREES_FILE_PATH + "temp/" + myTreeFileName + ".utree/hints/hints.xml");

        if (!file.exists()) {
            Log.d(">>>>>>", "2.2");
            //            return myView; //just send the original view
            switch (type) {
            case IS_RADIOBUTTON:
                ((RadioButton) myView).setText(Html.fromHtml((((RadioButton) myView).getText().toString())));
                return myView;
            case IS_CHECKBOX:
                ((CheckBox) myView).setText(Html.fromHtml((((CheckBox) myView).getText().toString())));
                return myView;
            default: //case IS_TEXTVIEW:
                ((TextView) myView).setText(Html.fromHtml(((TextView) myView).getText().toString()));
                return myView;
            }//from ww w . j  a va  2s.co  m
        }
    }
    //if this point is reached, this means that hint file exists

    Log.d(">>>>>>", "2");

    if (tokenizedStringList == null) {
        tokenizedStringList = new ArrayList<String>();
    } else {
        tokenizedStringList.clear();
    }
    Scanner sc;
    StringBuffer output = new StringBuffer();

    //added by Mike, Oct. 3, 2014
    //       myView.setLayerType(View.LAYER_TYPE_SOFTWARE, null);

    switch (type) {
    case IS_RADIOBUTTON:
        sc = new Scanner(((RadioButton) myView).getText().toString());
        ((RadioButton) myView).setText("");
        break;
    case IS_CHECKBOX:
        sc = new Scanner(((CheckBox) myView).getText().toString());
        ((CheckBox) myView).setText("");
        break;
    default: //case IS_TEXTVIEW:
        sc = new Scanner(((TextView) myView).getText().toString());
        /*
                     Spannable myScannable = ((Spannable)((TextView)myView).getText());
        //            sc = new Scanner(Html.toHtml(myScannable));             
                    sc = new Scanner(myScannable.toString());             
        */
        ((TextView) myView).setText("");
        break;
    }

    //Japanese sentences do not have clear delimiters, such as spaces. 
    //They do have particles, but how does a computer know if it's a particle 
    //or part of a phrase?
    if (getSetLanguage() == getLanguageBasedOnID(LANGUAGE_JAPANESE)) {
        //          if (sc.hasNext()) {
        while (sc.hasNext()) {
            ArrayList<String> temp = tokenizeJapaneseString(sc.next());

            for (int i = 0; i < temp.size(); i++) {
                tokenizedStringList.add(temp.get(i)); //= tokenizeJapaneseString(sc.next());
            }
        }
    } else {
        //edited by Mike, Oct. 19, 2014
        /*
                  while (sc.hasNext()) {
                     tokenizedStringList.add(sc.next()+" ");
                  }          
        */
        StringBuffer temp = new StringBuffer();
        while (sc.hasNext()) {
            temp.append(sc.next() + " ");

            Log.d(">>>temp: ", temp.toString());

            if (temp.toString().startsWith("<a")) {
                while (sc.hasNext() && !temp.toString().trim().endsWith("</a>")) {
                    temp.append(sc.next() + " ");
                }
            } else if (temp.toString().startsWith("<small>")) {
                while (sc.hasNext() && !temp.toString().trim().endsWith("</small>")) {
                    temp.append(sc.next() + " ");
                }
            } else if (temp.toString().startsWith("<big>")) {
                while (sc.hasNext() && !temp.toString().trim().endsWith("</big>")) {
                    temp.append(sc.next() + " ");
                }
            } else if (temp.toString().startsWith("<font>")) {
                while (sc.hasNext() && !temp.toString().trim().endsWith("</font>")) {
                    temp.append(sc.next() + " ");
                }
            } else if (temp.toString().startsWith("<b>")) {
                //                Log.d(">>nasa loob","<b>");
                while (sc.hasNext() && !temp.toString().trim().endsWith("</b>")) {
                    //                while (sc.hasNext()&&!temp.toString().trim().contains("</b>")) {
                    temp.append(sc.next() + " ");
                }
            } else if (temp.toString().startsWith("<i>")) {
                while (sc.hasNext() && !temp.toString().trim().endsWith("</i>")) {
                    //                while (sc.hasNext()&&!temp.toString().trim().contains("</i>")) {
                    temp.append(sc.next() + " ");
                }
            } else if (temp.toString().startsWith("<u>")) {
                while (sc.hasNext() && !temp.toString().trim().endsWith("</u>")) {
                    temp.append(sc.next() + " ");
                }
            }

            tokenizedStringList.add(temp.toString() + " ");
            temp.delete(0, temp.length());//reset
        }
    }

    for (int i = 0; i < tokenizedStringList.size(); i++) {
        Log.d(">>", "" + tokenizedStringList.get(i));
    }

    Log.d(">>>>>>", "3");

    try {
        boolean foundMatch = false;

        for (int i = 0; i < tokenizedStringList.size(); i++) {
            XmlPullParserFactory factory = XmlPullParserFactory.newInstance();
            factory.setNamespaceAware(true);
            XmlPullParser parser = factory.newPullParser();

            InputStream in = null;
            InputStreamReader reader;
            try {
                in = new BufferedInputStream(new FileInputStream(file));
            } catch (Exception e) {
                e.printStackTrace();
            }
            reader = new InputStreamReader(in, "UTF-8");

            parser.setInput(reader);

            foundMatch = false;

            //Reference: http://developer.android.com/training/basics/network-ops/xml.html;
            //last accessed: 24 Oct. 2012
            while (parser.next() != XmlPullParser.END_DOCUMENT) {
                if (parser.getEventType() != XmlPullParser.START_TAG) {
                    continue;
                }

                if (parser.getName().equals("string")) {

                    Log.d(">>>>>parser.getAttributeValue(null, 'name'): ",
                            parser.getAttributeValue(null, "name"));
                    Log.d(">>>>>tokenizedStringList.get(" + i + "): ", tokenizedStringList.get(i));

                    if (parser.getAttributeValue(null, "name").equals(tokenizedStringList.get(i).trim())) {
                        if (parser.next() == XmlPullParser.TEXT) {
                            //                          Log.d(">>>>>parser.getText();: ",parser.getText());
                            //                          return parser.getText();

                            final String hintText = parser.getText();
                            final UsbongDecisionTreeEngineActivity finalUdtea = (UsbongDecisionTreeEngineActivity) a;

                            SpannableString link = makeLinkSpan(tokenizedStringList.get(i),
                                    new View.OnClickListener() {
                                        @Override
                                        public void onClick(View v) {
                                            new AlertDialog.Builder(finalUdtea).setTitle("Phrase Hint!")
                                                    .setMessage(hintText).setPositiveButton("OK",
                                                            new DialogInterface.OnClickListener() {
                                                                @Override
                                                                public void onClick(DialogInterface dialog,
                                                                        int which) {
                                                                }
                                                            })
                                                    .show();
                                        }
                                    });
                            Log.d(">>>", "has match: " + tokenizedStringList.get(i));
                            foundMatch = true;

                            switch (type) {
                            case IS_RADIOBUTTON:
                                ((RadioButton) myView).append(link);
                                makeLinksFocusable(((RadioButton) myView), IS_RADIOBUTTON);
                                continue;
                            case IS_CHECKBOX:
                                ((CheckBox) myView).append(link);
                                makeLinksFocusable(((CheckBox) myView), IS_CHECKBOX);
                                continue;
                            default://case IS_TEXTVIEW:
                                ((TextView) myView).append(link);
                                makeLinksFocusable(((TextView) myView), IS_TEXTVIEW);
                                continue;
                            }
                        }
                    }
                }
            }
            if (!foundMatch) {
                Log.d(">>>", "i: " + i + " " + tokenizedStringList.get(i));
                output.append(tokenizedStringList.get(i));
                Log.d(">>> type", "" + type);

                switch (type) {
                case IS_RADIOBUTTON:
                    ((RadioButton) myView).append(Html.fromHtml(tokenizedStringList.get(i)));
                    //makeLinksFocusable(((RadioButton)myView), IS_RADIOBUTTON);
                    continue;
                case IS_CHECKBOX:
                    ((CheckBox) myView).append(Html.fromHtml(tokenizedStringList.get(i)));
                    //                         makeLinksFocusable(((CheckBox)myView), IS_CHECKBOX); 
                    continue;
                default://case IS_TEXTVIEW:
                    //                        Log.d(">>>>>myView before Html.fromHtml...",((TextView)myView).getText().toString());
                    ((TextView) myView).append(Html.fromHtml(tokenizedStringList.get(i)));

                    //                        ((TextView)myView).setText(Html.fromHtml(((TextView)myView).getText().toString()+tokenizedStringList.get(i)));

                    Log.d(">>>>>myView", ((TextView) myView).getText().toString());
                    //                        ((CheckBox)myView).setText(mySpanned, TextView.BufferType.SPANNABLE);
                    //                        ((TextView)myView).setMovementMethod(LinkMovementMethod.getInstance());
                    //                         makeLinksFocusable(((TextView)myView), IS_TEXTVIEW); 
                    continue;
                }
            }
        }

    } catch (Exception e) {
        e.printStackTrace();
    }
    return myView;
}

From source file:org.apache.jsp.people_jsp.java

private boolean validateFormFields() {
      boolean isValid = true;
      ArrayList<String> al = new ArrayList<String>();
      if (firstName.length() < 1)
          al.add("First Name");
      if (lastName.length() < 1)
          al.add("Last Name");
      if (email.length() < 1)
          al.add("Email");
      if (al.size() > 0) {
          isValid = false;/* w ww .ja  va  2 s .co m*/
          messageToDisplay = "Error, the following required fields are missing: " + al.toString();
      }
      return isValid;
  }

From source file:com.linkedin.harisekhon.Utils.java

public static final ArrayList<String> validateNodePortList(ArrayList<String> nodes, String name) {
    String name2 = "";
    if (name != null) {
        name2 = name + " ";
    }/*from w  w  w  . jav a2  s. c o m*/
    ArrayList<String> final_nodes = new ArrayList<String>();
    ArrayList<String> nodes2 = uniqArraylistOrdered(nodes);
    if (nodes2.size() < 1) {
        throw new IllegalArgumentException(String.format("%snode(s) not defined", name2));
    }
    for (String node : nodes2) {
        //node = node.trim();
        for (String node2 : node.split("[,\\s]+")) {
            //node2 = node2.trim();
            final_nodes.add(validateHostPort(node2));
        }
    }
    vlogOption(String.format("%snodeport list", name2), final_nodes.toString());
    return final_nodes;
}

From source file:com.rothconsulting.android.websms.connector.orange.ConnectorOrange.java

/**
 * {@inheritDoc}//  w w w . j av a  2 s .  c om
 */
@Override
protected final void doSend(final Context context, final Intent intent) throws WebSMSException {
    this.log("************************************************");
    this.log("*** Start doSend SMS");
    this.log("************************************************");
    this.doBootstrap(context, intent);

    this.sendData(URL_SENDSMS, context, null);

    ConnectorCommand command = new ConnectorCommand(intent);

    // SMS Text
    String text = command.getText();
    this.log("text.length()=" + text.length());
    this.log("text=" + text);

    int sent = 0;
    if (!this.SENT_SMS.equals(DUMMY)) {
        try {
            sent = Integer.valueOf(this.SENT_SMS);
        } catch (NumberFormatException e) {
            this.log("*** Cannot convert SMS_CREDIT to integer: " + this.SENT_SMS);
        }
    }
    // Building POST parameter
    ArrayList<BasicNameValuePair> postParameter = new ArrayList<BasicNameValuePair>();
    postParameter.add(new BasicNameValuePair("form[_token]", this.SMS_FORM_TOKEN));
    postParameter.add(new BasicNameValuePair("form[message]", text));
    postParameter.add(new BasicNameValuePair("form[sentTillNow]", "" + sent));
    postParameter.add(new BasicNameValuePair("form[submitted]", "1"));
    postParameter.add(new BasicNameValuePair("submit", "0"));

    // SMS Recipients
    String[] to = command.getRecipients();
    this.log("to[0]    =" + to[0]);
    if (to == null || to.length > 10) {
        String error = context.getString(R.string.connector_orange_more_than_10);
        this.log("----- ERROR: " + error);
        Toast.makeText(context, R.string.connector_orange_more_than_10, Toast.LENGTH_LONG).show();
    }
    this.log("to.length=" + to.length);
    // Send SMS
    for (int i = 0; i < to.length; i++) {
        if (to[i] != null && to[i].length() > 1) {

            int index1 = to[i].indexOf("<");
            int index2 = to[i].indexOf(">");
            String toNumber = to[i].substring(index1 + 1, index2);

            postParameter.add(new BasicNameValuePair("form[to][fullNumber]", toNumber));

            // Google analytics
            if (this.mGaTracker != null) {
                this.log("Tracking ID=" + this.mGaTracker.getTrackingId());
                this.mGaTracker.sendEvent(TAG, "Send SMS", "Count receiver: " + i + 1, 0L);
            }

            this.log("***** POST Parameter=" + postParameter.toString());
            this.sendData(URL_SENDSMS, context, postParameter);
        }
    }

    this.doUpdate(context, intent);

    this.setBalance(context);

    this.log("************************************************");
    this.log("*** Ende doSend SMS");
    this.log("************************************************");
}

From source file:org.apache.jsp.sources_jsp.java

private boolean validateFormFields() {
       boolean isValid = true;
       ArrayList<String> al = new ArrayList<String>();
       if (shareTitle.length() < 1)
           al.add("Title");
       if (shareDescription.length() < 1)
           al.add("Description");
       if (al.size() > 0) {
           isValid = false;/*from   w  ww  .j a  v a 2s . c o  m*/
           messageToDisplay = "Error, the following required fields are missing: " + al.toString();
       }
       return isValid;
   }

From source file:io.snappydata.hydra.cluster.SnappyTest.java

protected static ArrayList<String> getWorkerFileContents(String userKey, ArrayList<String> fileContents) {
    Set<String> keys = SnappyBB.getBB().getSharedMap().getMap().keySet();
    for (String key : keys) {
        if (key.startsWith(userKey)) {
            Log.getLogWriter().info("Key Found..." + key);
            String value = (String) SnappyBB.getBB().getSharedMap().get(key);
            fileContents.add(value);//  w  ww .j  a  v  a 2  s  .  c  om
        }
    }
    Log.getLogWriter().info("ArrayList contains : " + fileContents.toString());
    return fileContents;
}

From source file:com.nuance.expertassistant.ReadExcelFile.java

public ArrayList<Integer> retrieveAnswers(String projectID, String question, String expectedAnswer) {

    ArrayList<Integer> analysis = new ArrayList<Integer>();

    analysis.add(0);/*from   ww  w  .  j a  v a  2s . com*/
    analysis.add(-1);
    analysis.add(-1);
    analysis.add(-1);

    try {

        String contextID = InvokeQACoreAPI.getContextID(projectID).replaceAll("\n", "");

        System.out.println(" The contextID is :[" + contextID + "]");

        String answerString = InvokeQACoreAPI.getAnswer(contextID, projectID, question);
        // System.out.println(" The retrieved answer is :" + answerString);
        JSONArray jsonArray = new JSONArray(answerString);

        for (int i = 0; i < jsonArray.length(); i++) {
            JSONObject job = jsonArray.getJSONObject(i);
            String answerText = job.getJSONObject("answer").getString("text");
            String evidence = html2text(
                    job.getJSONObject("answer").getJSONObject("evidence").getString("text"));
            int confidence = job.getJSONObject("answer").getInt("confidence");
            Double score = job.getJSONObject("answer").getDouble("score");

            System.out.println("ANSWER TEXT (" + i + "):[" + answerText + "]");
            System.out.println("EVIDENCE TEXT (" + i + "):[" + evidence + "]");
            System.out.println("CONFIDENCE (" + i + "):[" + confidence + "]");
            System.out.println("SCORE (" + i + "):[" + score + "]");

            if (evidence.contains(expectedAnswer) || answerText.contains(expectedAnswer)) {
                analysis.clear();
                analysis.add(1);
                analysis.add(i);
                analysis.add(evidence.length() + answerText.length());
                analysis.add(jsonArray.length());

                System.out.println("Analysis is " + analysis.toString());

                return analysis;
            }

            System.out.println("*********************************************");
        }

    } catch (Exception e) {

        System.out.println("Exception :" + e.getMessage());
        e.printStackTrace();
        return analysis;
    }

    return analysis;

}

From source file:com.vmware.bdd.cli.commands.ClusterCommands.java

private void validateServiceUserConfigHelper(String appManagerType,
        Map<String, Map<String, String>> serviceUserConfigs, List<String> supportedConfigs,
        List<String> failedMsgList) {
    ArrayList<String> unSupportedKeys = new ArrayList<>();
    for (Map<String, String> config : serviceUserConfigs.values()) {
        for (String key : config.keySet()) {
            if (!supportedConfigs.contains(key) && !unSupportedKeys.contains(key)) {
                unSupportedKeys.add(key);
            }//from w  w  w  .j  a v  a  2  s. c  om
        }
    }
    if (!unSupportedKeys.isEmpty()) {
        failedMsgList.add(
                appManagerType + " deployed cluster doesn't support following keys when config service user: "
                        + unSupportedKeys.toString());
    }
}

From source file:net.i2cat.csade.life2.backoffice.bl.StatisticsManager.java

public String getDatosHelpOffered() {
    ArrayList<Pair> datos = new ArrayList<Pair>();
    try {// ww w  .  j  ava  2 s .c o  m
        Category[] categories = sd.listCategories("", 0, 0, "");
        Pair pair = null;
        int num;
        for (Category c : categories) {
            num = sd.countOffers("category_id=" + c.getCategory_id());
            if (num > 0) {
                pair = new Pair(StringEscapeUtils.escapeHtml(c.getCategory_name()) + " (" + num + ")", num);
                datos.add(pair);
            }

        }
    } catch (Exception ex) {
    }
    return datos.toString();
}

From source file:main.MainClass.java

private String SupportToReportsSyncer(String mode) {

    loggerObj.log(Level.INFO, "Inside SupportToReportsSyncer method");

    String masterConfigFile = "./conf/SupportToReportsSyncer/masterconfig.props";
    ArrayList<String> fileLocation = FileOperations.getFilesLocForSupToRepSync(masterConfigFile);

    if (fileLocation == null || fileLocation.size() == 0) {
        loggerObj.log(Level.INFO, "Cannot get conf file Locations from master config file " + masterConfigFile);
        return null;
    }//from w w w . jav a  2  s  . c o m

    loggerObj.log(Level.INFO, "The conf files obtained from master config file is " + fileLocation.toString());

    for (Iterator indiFileItr = fileLocation.iterator(); indiFileItr.hasNext();) {

        String indiFileLoc = (String) indiFileItr.next();

        JSONObject supportToreportsDetails = initializeSupportToReportsDetails(indiFileLoc);

        if (supportToreportsDetails == null) {
            System.out.println("The config file is empty or does not contain proper data");
            return "JSON OBJECT READ FROM FILE IS NULL";
        }
        try {
            loggerObj.log(Level.INFO, "Received supportToreports details json object after parsing the file is "
                    + supportToreportsDetails.toJSONString());

            JSONObject supDetails = (JSONObject) supportToreportsDetails.get("supDetails");
            JSONObject repDetails = (JSONObject) supportToreportsDetails.get("repDetails");

            loggerObj.log(Level.INFO,
                    "Going to parse Config file to get support details and query support data from support.zoho.com");
            System.out.println(
                    "Going to parse Config file to get support details and query support data from support.zoho.com");
            String folderToWriteResponse = "./fromServer/SupportToReportsSyncer";
            String[] responseString = getSupportDataWithConfigDetails(supDetails, mode, folderToWriteResponse,
                    false, "SupportToReportSyncer");

            if (responseString == null) {
                System.out
                        .println("The config file does not contain essential support configuration data data");
                loggerObj.log(Level.SEVERE,
                        "The config file does not contain essential support configuration data data");
                return "REPORT DETAILS IN JSON OBJECT READ FROM FILE IS NULL";
            }

            //https://support.zoho.com/api/json/requests/getrecords?authtoken=8ecc8d0229b00b83d4c398b19a4282bc&portal=memdmissuemgr&department=MDM%20Issue%20Mgr&selectfields=requests(Ticket%20Id,Created%20At,Module,Functionality,Immediate%20priority,Status,Issue%20Source,Issue%20Type,Priority,OS%20Platform,Customer%20Email,Request%20Tag,Ticket%20Owner,Modified%20Time,Modified%20By,Ticket%20Closed%20Time,Old%20Issue%20ID,To%20Address,Email,Subject,Developer%20Comments,Customer%20Description)//
            String folderToReadFrom = responseString[0];
            int numOfSupFiles = Integer.parseInt(responseString[1]);
            loggerObj.log(Level.INFO,
                    "Response String received from Support api/Internal files is: folderToReadFrom"
                            + folderToReadFrom + " Number of files is " + numOfSupFiles);
            System.out.println("support data is fetched from support.zoho.com");

            //This is used to write the ResponseJSONArray to file system so that it can be used for future parsing
            loggerObj.log(Level.INFO,
                    "Going to parse the data from supportToReport config file to get ExtraColumns data");
            System.out.println(
                    "Going to parse the data from supportToReport config file to get ExtraColumns data");
            JSONObject extraColumnsJSONObj = getExtraColumnsForReports(repDetails);

            loggerObj.log(Level.INFO,
                    "Going to parse the data from supportToReport config file to get column names that need change in reports");
            JSONObject SupToRepHdrChgJSONObj = getSupToRepNameChngeCol(repDetails);

            loggerObj.log(Level.INFO,
                    "Going to parse the data from supportToReport config file to change column names that need change in reports");
            JSONObject SupToRepHdrObj = getFinalSupToRepColName(SupToRepHdrChgJSONObj, extraColumnsJSONObj,
                    supDetails);

            loggerObj.log(Level.INFO,
                    "Going to parse the data downloaded from support to change to a format to upload tp reports");
            Integer reportsFileNum = 1;
            String currTime = getCurrTimeInDD_MM_YY_HH_MM_SS();
            String folderToWriteParsedResponse = "./parsed_output/SupportToReportsSyncer/" + currTime;

            boolean createFolderToWriteResponse = new File(folderToWriteParsedResponse).mkdirs();

            if (!createFolderToWriteResponse) {
                loggerObj.log(Level.INFO,
                        "Cannot create a folder" + folderToWriteParsedResponse + " to write response");
                return null;
            }
            JSONOperations parserObj = new JSONOperations();
            for (int i = 1; i <= numOfSupFiles; i++) {
                String fileToReadFrom = folderToReadFrom + i + ".json";
                JSONObject responseFromSup = (JSONObject) FileOperations.readFromJSONFile(fileToReadFrom);
                JSONArray issueMgrJSONArray = parserObj.SupJOToReportsJA(responseFromSup, extraColumnsJSONObj,
                        SupToRepHdrChgJSONObj, "row");

                if (issueMgrJSONArray == null) {
                    loggerObj.log(Level.INFO,
                            "Processed JSON from zoho support to delver to reports is null while reading file "
                                    + fileToReadFrom);
                    System.out.println("Processed JSON from zoho support to delver to reports is null");
                    return "PROCESSED JSON FOR REPORTS IS NULL";
                }

                String fileToWriteParsedResponse = folderToWriteParsedResponse + "/ParsedJSON_" + reportsFileNum
                        + ".json";
                loggerObj.log(Level.INFO,
                        "Processed JSON from zoho support. GOing to write it to a file to import to zoho reports"
                                + fileToWriteParsedResponse);
                boolean isFileWriteSuccess = FileOperations.writeObjectToFile(issueMgrJSONArray,
                        fileToWriteParsedResponse);
                //System.out.println("Processed JSON from zoho support. GOing to write it to a file to import to zoho reports"); 
                if (!isFileWriteSuccess) {
                    loggerObj.log(Level.INFO,
                            "Error occurred while writing Processed JSON from zoho support to delver to reports to the file located in"
                                    + fileToWriteParsedResponse);
                    return "ERROR IN WRITING PROCESSED JSON TO FILE " + fileToWriteParsedResponse;
                }
                loggerObj.log(Level.INFO,
                        "Processed JSON from zoho support is writtrn to a file to import to zoho reports"
                                + fileToWriteParsedResponse);
                reportsFileNum++;
            }

            //Need to have invalid jsonarray check also//
            JSONArray repConnectionParams = getRepDetailsFromConfigFile(repDetails);

            //Handling null check if any required field is not present;
            if (repConnectionParams.size() == 1) {
                JSONObject errorJSON = (JSONObject) repConnectionParams.get(0);
                ArrayList<String> nullFields = (ArrayList<String>) errorJSON.get("nullFields");
                loggerObj.log(Level.INFO,
                        "The following fields required to make connection to reports is not present"
                                + nullFields.toString());
                System.out.println("The following fields required to make connection to reports is not present"
                        + nullFields.toString());
                return null;
            }

            // Handling error case to check if the Matching columns are not present in Reports column
            if (repDetails.get("ZOHO_MATCHING_COLUMNS") != null) {
                String[] matchingColumns = repDetails.get("ZOHO_MATCHING_COLUMNS").toString().split(",");
                boolean isPresent = false;
                ArrayList<String> matchingColNotInRepColn = null;

                for (String i : matchingColumns) {

                    Set<String> repColns = SupToRepHdrObj.keySet();
                    for (Iterator it = repColns.iterator(); it.hasNext();) {
                        String repColnHdr = it.next().toString();
                        if (repColnHdr.equals(i)) {
                            isPresent = true;
                        }
                    }
                    if (isPresent != true) {
                        if (matchingColNotInRepColn == null) {
                            matchingColNotInRepColn = new ArrayList<>();
                        }
                        matchingColNotInRepColn.add(i);
                    }
                    isPresent = false;
                }
                if (matchingColNotInRepColn != null) {
                    loggerObj.log(Level.INFO,
                            "The following fields are present in Matching columns but not in Report columns"
                                    + matchingColNotInRepColn.toString());
                    System.out.println(
                            "The following fields required to make connection to reports is not present"
                                    + matchingColNotInRepColn.toString());
                    return null;
                }
            } else {
                if (repDetails.get("ZOHO_IMPORT_TYPE").equals("UPDATEADD")) {
                    loggerObj.log(Level.SEVERE,
                            "Please provide the matching columns as it is mandatory for UPDATEADD import type in config file.");
                    System.out.println(
                            "Please provide the matching columns as it is mandatory for UPDATEADD import type in config file.");
                    return null;
                }
            }

            JSONObject urlParams = (JSONObject) repConnectionParams.get(0);
            JSONObject postParams = (JSONObject) repConnectionParams.get(1);
            repConnectionParams = null;

            loggerObj.log(Level.INFO, "urlParams is " + urlParams.toJSONString());
            loggerObj.log(Level.INFO, "postParams is " + postParams.toJSONString());

            loggerObj.log(Level.INFO, "Going to bulk import the json file in the folder "
                    + folderToWriteParsedResponse + " to the reports");

            System.out.println("Going to bulk import in to the reports:");
            for (int i = 1; i <= reportsFileNum - 1; i++) {

                String fileToUploadToReports = folderToWriteParsedResponse + "/ParsedJSON_" + i + ".json";
                loggerObj.log(Level.INFO, "Going to upload " + fileToUploadToReports + "to reports");
                postParams.put("jsonFileName", fileToUploadToReports);

                ZohoReportsAPIManager reportsClient = new ZohoReportsAPIManager();
                boolean isSuccessfullImport = false;
                try {
                    isSuccessfullImport = reportsClient.postBulkJSONImport(urlParams, postParams);
                } catch (IOException ex) {
                    loggerObj.log(Level.INFO, "Problem in bulk importing the json file " + fileToUploadToReports
                            + " to the reports");
                    System.out.println("Problem in bulk importing the json file to the reports");
                }

                if (isSuccessfullImport) {
                    loggerObj.log(Level.INFO, "Successfully bulk imported the json file  "
                            + fileToUploadToReports + " to the reports");
                    System.out.println("Successfully bulk imported the json file  " + fileToUploadToReports
                            + " to the reports");
                } else {
                    loggerObj.log(Level.INFO, "Probelem in bulk importing the json file  "
                            + fileToUploadToReports + " to the reports");
                    System.out.println("Probelem in bulk importing the json file  " + fileToUploadToReports
                            + " to the reports");
                }

            }

        } catch (Exception e) {
            loggerObj.log(Level.SEVERE, "Some problem in Syncing support with reports. Exception is");
            loggerObj.log(Level.SEVERE, e.getMessage(), e);
            System.out.println("Exception is " + e.toString());
            return null;
        }

    }

    return null;
}