Commit 6ec80249 authored by ssalve's avatar ssalve

Sarita : Done changes to add scheme type 1 and 2 on 15JAN2018

git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@178399 ce508802-f39f-4f6c-b175-0d175dae99d5
parent b4fe8c20
......@@ -14,8 +14,10 @@ import java.sql.SQLException;
import java.sql.Statement;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.HashSet;
import java.util.Iterator;
import java.util.List;
import java.util.Set;
import javax.ejb.Stateless;
......@@ -168,12 +170,11 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
}
@Override
//Added by sarita on 21/12/2017
//public String getFreeSchemeAction(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams, String selDataStr) throws RemoteException,ITMException
public String getFreeSchemeaction(String actionType, String xmlString, String xmlString1, String objContext, String xtraParams) throws RemoteException,ITMException
{
Document dom = null;
Document dom1 = null;
//Document selDataDom = null;
String retString = null;
try
......@@ -188,11 +189,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
{
dom1 = new ibase.utility.E12GenericUtility().parseString(xmlString1);
}
/*if(selDataStr != null && selDataStr.length() > 0)
{
selDataDom = new ibase.utility.E12GenericUtility().parseString(selDataStr);
}*/
System.out.println("actionType:"+actionType+":");
if (actionType.equalsIgnoreCase("sorderScheme"))
......@@ -212,7 +208,6 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
}
@Override
//Added by sarita on 21/03/2017
public String getFreeSchemeaction(Document dom, Document dom1,String objContext, String xtraParams)throws ITMException
{
System.out.println("getFreeSchemeAction is calling.............");
......@@ -220,41 +215,53 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
String sql = "";
String detCnt = "0";
int noOfDetails = 0;
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
int count = 0;
PreparedStatement pstmt = null,pstmt1 = null;
ResultSet rs = null ,rs1 = null;
int count = 0 , domID = 0;
String itemCode = "",schemeCode = "",itemDescription="",updateFlag="";
NodeList detailList = null;
Node currDetail = null;
String itmCode="",s = "",s1 = "",quantity="",schemeType="",schAllowence="";
String itmCode="",s = "",s1 = "",quantity="",schemeType="",schAllowence="",siteCode="",s12="",schemeDescr="";
double qty = 0.0;
double purcBase=0.0;
double schAllowence1=0.0;
double schAllowence1=0.0,discount=0.0,purRate=0.0;
Iterator<String> itr = null;
List<String> itemList = new ArrayList<String>();
List<String> getSchemeList = new ArrayList<String>();
HashMap<String,Double> itemQuantityMap = new HashMap<String,Double>();
HashMap<String,List<String>> getSchemeItemList = new HashMap<String,List<String>>();
//HashMap<String,List<String>> freeItemInfoMap = new HashMap<String,List<String>>();//Added by sarita on 15JAN2018
List<String> itemCodeListScheme = new ArrayList<String>();
List<String> freeItemList = new ArrayList<String>();
List<String> freeItemListApplcbleType0 = new ArrayList<String>();
List<String> freeItemListApplcbleType1 = new ArrayList<String>();
List<String> freeItemListApplcbleType2 = new ArrayList<String>();
List<String> finalFreeItems = new ArrayList<String>();
HashMap<String,List<String>> freeItemInfoMap = new HashMap<String,List<String>>();
List<String> schemeInfo = null;
String itemValues = "",itemCodeSchm = "",rate;
double finRate =0.0;
try
{
conn = getConnection();
detailList = dom1.getElementsByTagName("Detail2");
noOfDetails = detailList.getLength();
//updateFlag = getAttributeVal(dom1,"updateFlag");
//updateFlag = getAttributeVal(dom1,"updateFlag"); //Added by sarita on 15JAN2018
System.out.println("noOfDetails >>"+noOfDetails);
for(int ctr = 0; ctr < noOfDetails; ctr++)
{
currDetail = detailList.item(ctr);
itemCode = genericUtility.getColumnValueFromNode("item_code__ord", currDetail);
quantity = genericUtility.getColumnValueFromNode("quantity", currDetail);
qty = Double.valueOf(quantity);
siteCode = genericUtility.getColumnValueFromNode("site_code", currDetail);
rate = genericUtility.getColumnValueFromNode("rate", currDetail);
qty = Double.valueOf(checkDouble(quantity));
purRate = Double.valueOf(checkDouble(rate));
itemList.add(itemCode);
if(itemQuantityMap.containsKey(itemCode))
......@@ -264,6 +271,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
qty = qty + Double.valueOf(itemQuantityMap.get(itemCode));
}
itemQuantityMap.put(itemCode.trim(), qty);
itemQuantityMap.put(itemCode.trim(), purRate);
}
else
{
......@@ -288,6 +296,7 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
rs = pstmt.executeQuery();
while(rs.next())
{
schemeCode = rs.getString("scheme_code");
getSchemeList.add(schemeCode);
itmCode = rs.getString("item_code");
......@@ -338,93 +347,239 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
if(getSchemeItemList.size() > 0)
{
sql = "select scheme_code,scheme_type,purc_base,sch_allowence from sch_group_def where scheme_code in ("+s1+")";
sql = "select scheme_code,descr,scheme_type,purc_base,sch_allowence,discount from sch_group_def where scheme_code in ("+s1+")";
System.out.println("sql >> ["+sql+"]");
pstmt = conn.prepareStatement(sql);
//pstmt.setString(1,s1);
rs = pstmt.executeQuery();
while(rs.next())
{
domID++;
System.out.println("DomId is ===="+domID);
schemeCode = rs.getString("scheme_code");
schemeType = rs.getString("scheme_type");
schemeDescr = rs.getString("descr");
purcBase = Double.valueOf(rs.getString("purc_base"));
schAllowence1= Double.valueOf(rs.getString("sch_allowence"));
System.out.println("schemeType ["+schemeType+"]" + "schemeCode ["+schemeCode+"]" + "purcBase ["+purcBase+"]" +"schAllowence1 ["+schAllowence1+"]");
schAllowence1= Double.valueOf(checkDouble(rs.getString("sch_allowence")));
discount = Double.valueOf(checkDouble(rs.getString("discount")));
System.out.println("schemeType ["+schemeType+"]" + "schemeCode ["+schemeCode+"]" + "purcBase ["+purcBase+"]" +"schAllowence1 ["+schAllowence1+"]" +"Scheme Description ["+schemeDescr+"]" + "Discount is :::["+discount+"]");
//valueXmlString.append("<scheme_type>").append("<![CDATA[").append(schemeType).append("]]>").append("</scheme_type>\r\n");
//valueXmlString.append("<applicable_scheme>").append("<![CDATA[").append(schemeCode).append("]]>").append("</applicable_scheme>\r\n");
//valueXmlString.append("<scheme_description visible = \"1\">").append("<![CDATA[").append(schemeDescr).append("]]>").append("</scheme_description>\r\n");
if("0".equalsIgnoreCase(schemeType))
{
//System.out.println("Scheme Type in O applicable on quantity");
List<String> itemCodeListScheme = new ArrayList<String>();
System.out.println("Scheme Type ::::::::::::"+schemeType);
itemCodeListScheme = getSchemeItemList.get(schemeCode);
System.out.println("itemCodeListScheme **"+itemCodeListScheme.size());
System.out.println("itemCodeListScheme **"+itemCodeListScheme);
System.out.println("itemCodes are in ListScheme **"+itemCodeListScheme.size());
if(itemCodeListScheme.size() > 0)
{
for(int cntr=0; cntr<itemCodeListScheme.size();cntr++)
{
List<String> freeItemList = new ArrayList<String>();
String itemCodeSchm = itemCodeListScheme.get(cntr);
itemCodeSchm = itemCodeListScheme.get(cntr);
System.out.println("itemCodeSchm ::::"+itemCodeSchm);
if(itemQuantityMap.containsKey(itemCodeSchm))
{
double xmlQty = itemQuantityMap.get(itemCodeSchm);
finRate = itemQuantityMap.get(itemCodeSchm);
System.out.println("Applicable Rate is ==["+finRate+"]"+"Quantity in XML is ::["+xmlQty+"]" + "\t" + "Quantity Applicable for Scheme is ::["+purcBase+"]");
// System.out.println("xmlQty is==="+xmlQty);
if(xmlQty >= purcBase)
{
double freeQty = ((xmlQty * schAllowence1)/purcBase);
System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);
sql = "SELECT S.item_code FROM SCH_PUR_ITEMS P ,SCH_OFFER_ITEMS S WHERE P.SCHEME_CODE=S.SCHEME_CODE AND P.ITEM_CODE='"+itemCodeSchm+"'";
double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]");
freeQty = freeQty * schAllowence1;
System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);//Added by sarita on 15JAN2018
freeItemListApplcbleType0.add(itemCodeSchm);
itemValues = getItemCode(freeItemListApplcbleType0);
System.out.println("Item Values for Scheme Type 0 is :::["+itemValues+"]");
//sql = "SELECT S.item_code FROM SCH_PUR_ITEMS P ,SCH_OFFER_ITEMS S WHERE P.SCHEME_CODE=S.SCHEME_CODE AND P.ITEM_CODE='"+itemCodeSchm+"'";
sql = "SELECT S.item_code FROM SCH_PUR_ITEMS P ,SCH_OFFER_ITEMS S WHERE P.SCHEME_CODE=S.SCHEME_CODE AND P.ITEM_CODE in ("+itemValues+")";
System.out.println("sql :::::"+sql);
pstmt = conn.prepareStatement(sql);
pstmt1 = conn.prepareStatement(sql);
//pstmt.setString(1,itemCodeSchm);
rs = pstmt.executeQuery();
while(rs.next())
rs1 = pstmt1.executeQuery();
freeItemList.clear();
freeItemInfoMap.clear();
System.out.println("Values in list after clear for Scheme 1:::"+freeItemList + "\t" +"freeItemInfoMap ["+freeItemInfoMap+"] ");
while(rs1.next())
{
String freeItem = rs.getString("item_code");
String freeItem = rs1.getString("item_code");
freeItemList.add(freeItem);
freeItemInfoMap.put(itemCodeSchm, freeItemList);
}
System.out.println("Free Item List ::::["+freeItemList+"]" + "freeItemInfoMap ::::["+freeItemInfoMap+"]");
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
finalFreeItems = freeItemInfoMap.get(itemCodeSchm);
System.out.println("Final List of Free Items for ::::Scheme Type 0 is "+finalFreeItems);
//s12 = returnFinalFreeItemDataUsingList(finalFreeItems, conn,schemeType,schemeCode,schemeDescr);
s12 = returnFinalFreeItemDataUsingList(finalFreeItems, conn,schemeType,schemeCode,schemeDescr,discount,freeQty,itemCodeSchm);
System.out.println("***********"+s12);
valueXmlString.append(s12);
}
else
{
System.out.println("Scheme is NOT applicable for ::"+itemCodeSchm + "Purchased Item quantity::"+xmlQty +"is NOT greater than or equal to applicable quantity"+purcBase+"for scheme "+schemeCode);
}
}
}
}
}//end of if block for type0
if("1".equalsIgnoreCase(schemeType))
{
System.out.println("Scheme Type ::::::::::::"+schemeType);
itemCodeListScheme = getSchemeItemList.get(schemeCode);
System.out.println("itemCodeListScheme **"+itemCodeListScheme);
System.out.println("itemCodes are in ListScheme **"+itemCodeListScheme.size());
if(itemCodeListScheme.size() > 0)
{
for(int cntr=0; cntr<itemCodeListScheme.size();cntr++)
{
itemCodeSchm = itemCodeListScheme.get(cntr);
System.out.println("itemCodeSchm ::::"+itemCodeSchm);
if(itemQuantityMap.containsKey(itemCodeSchm))
{
double xmlQty = itemQuantityMap.get(itemCodeSchm);
finRate = itemQuantityMap.get(itemCodeSchm);
System.out.println("Applicable Rate is ==["+finRate+"]"+"Quantity in XML is ::["+xmlQty+"]" + "\t" +"Purchased Items ["+itemCodeSchm+"]"+ "Quantity Applicable for Scheme is ::["+purcBase+"]");
List finalFreeItems = freeItemInfoMap.get(itemCodeSchm);
System.out.println("finalFreeItems :::"+finalFreeItems);
System.out.println("finalFreeItems :::"+finalFreeItems.size());
if(finalFreeItems.size() > 0)
if(xmlQty >= purcBase)
{
for(int cnt = 0;cnt<finalFreeItems.size();cnt++)
double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]");
freeQty = freeQty * schAllowence1;
System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);
freeItemListApplcbleType1.add(itemCodeSchm);
itemValues = getItemCode(freeItemListApplcbleType1);
System.out.println("Item Values for Scheme Type 1 is :::["+itemValues+"]");
sql = "SELECT S.item_code FROM SCH_PUR_ITEMS P ,SCH_OFFER_ITEMS S WHERE P.SCHEME_CODE=S.SCHEME_CODE AND P.ITEM_CODE in ("+itemValues+")";
System.out.println("sql :::::"+sql);
pstmt1 = conn.prepareStatement(sql);
//pstmt.setString(1,itemCodeSchm);
rs1 = pstmt1.executeQuery();
freeItemList.clear();
freeItemInfoMap.clear();
System.out.println("Values in list after clear for Scheme 1:::"+freeItemList);
while(rs1.next())
{
System.out.println(finalFreeItems.get(cnt));
itemDescription = getItemDescr((String)finalFreeItems.get(cnt),conn);
valueXmlString.append("<Detail>\r\n");
valueXmlString.append("<item_code__ord>").append("<![CDATA[").append(finalFreeItems.get(cnt)).append("]]>").append("</item_code__ord>\r\n");
valueXmlString.append("<item_descr>").append("<![CDATA[").append(itemDescription).append("]]>").append("</item_descr>\r\n");
valueXmlString.append("<quantity protect=\"0\">").append("<![CDATA[]]>").append("</quantity>\r\n");
valueXmlString.append("</Detail>\r\n");
String freeItem = rs1.getString("item_code");
freeItemList.add(freeItem);
freeItemInfoMap.put(itemCodeSchm, freeItemList);
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
/*valueXmlString.append("<Detail1>\r\n");
for(int cnt = 0;cnt<freeItemInfoMap.size();cnt++)
if(rs1 != null)
{
System.out.println(freeItemInfoMap.get(cnt));
valueXmlString.append("<free_item>").append("<![CDATA[").append(freeItemInfoMap.get(cnt)).append("]]>").append("</free_item>\r\n");
rs1.close();
rs1 = null;
}
valueXmlString.append("<Detail1>\r\n");
System.out.println("Final List for Items :::"+freeItemInfoMap);*/
finalFreeItems = freeItemInfoMap.get(itemCodeSchm);
System.out.println("Final List of Free Items for ::::Scheme Type 1 is "+finalFreeItems);
s12 = returnFinalFreeItemDataUsingList(finalFreeItems, conn,schemeType,schemeCode,schemeDescr,discount,freeQty,itemCodeSchm);
System.out.println("***********"+s12);
valueXmlString.append(s12);
}
else
{
System.out.println("Scheme is NOT applicable for ::"+itemCodeSchm + "Purchased Item quantity::"+xmlQty +"is greater NOT than or equal to applicable quantity"+purcBase+"for scheme "+schemeCode);
System.out.println("Scheme is NOT applicable for ::"+itemCodeSchm + "Purchased Item quantity::"+xmlQty +"is NOT greater than or equal to applicable quantity"+purcBase+"for scheme "+schemeCode);
}
}
}
}
}//end of if block for type1//Added by sarita on 15JAN2018
else if("2".equalsIgnoreCase(schemeType))
{
System.out.println("Scheme Type ::::::::::::"+schemeType);
itemCodeListScheme = getSchemeItemList.get(schemeCode);
System.out.println("itemCodeListScheme **"+itemCodeListScheme);
System.out.println("itemCodes are in ListScheme **"+itemCodeListScheme.size());
if(itemCodeListScheme.size() > 0)
{
for(int cntr=0; cntr<itemCodeListScheme.size();cntr++)
{
itemCodeSchm = itemCodeListScheme.get(cntr);
System.out.println("itemCodeSchm ::::"+itemCodeSchm);
if(itemQuantityMap.containsKey(itemCodeSchm))
{
double xmlQty = itemQuantityMap.get(itemCodeSchm);
finRate = itemQuantityMap.get(itemCodeSchm);
System.out.println("Applicable Rate is ==["+finRate+"]"+"Quantity in XML is ::["+xmlQty+"]" + "\t" +"Purchased Items ["+itemCodeSchm+"]"+ "Quantity Applicable for Scheme is ::["+purcBase+"]");
if(xmlQty >= purcBase)
{
double freeQty = (int)(xmlQty / purcBase); System.out.println("freeQty is ::["+freeQty+"]");
freeQty = freeQty * schAllowence1;
System.out.println("Items Applicable for Free Schemes :::"+itemCodeSchm + "free quantity"+(int)freeQty);
freeItemListApplcbleType2.add(itemCodeSchm);
itemValues = getItemCode(freeItemListApplcbleType2);
System.out.println("Item Values for Scheme Type 2 is :::["+itemValues+"]");
sql = "SELECT S.item_code FROM SCH_PUR_ITEMS P ,SCH_OFFER_ITEMS S WHERE P.SCHEME_CODE=S.SCHEME_CODE AND P.ITEM_CODE in ("+itemValues+")";
System.out.println("sql :::::"+sql);
pstmt1 = conn.prepareStatement(sql);
//pstmt.setString(1,itemCodeSchm);
rs1 = pstmt1.executeQuery();
freeItemList.clear();
freeItemInfoMap.clear();
System.out.println("Values in list after clear for Scheme 2:::"+freeItemList);
while(rs1.next())
{
String freeItem = rs1.getString("item_code");
freeItemList.add(freeItem);
freeItemInfoMap.put(itemCodeSchm, freeItemList);
}
if(pstmt1 != null)
{
pstmt1.close();
pstmt1 = null;
}
if(rs1 != null)
{
rs1.close();
rs1 = null;
}
finalFreeItems = freeItemInfoMap.get(itemCodeSchm);
System.out.println("Final List of Free Items for ::::Scheme Type 2 is "+finalFreeItems);
s12 = returnFinalFreeItemDataUsingList(finalFreeItems, conn,schemeType,schemeCode,schemeDescr,discount,freeQty,itemCodeSchm);
System.out.println("***********"+s12);
valueXmlString.append(s12);
}
else
{
System.out.println(itemCodeSchm + "Not contains in XML File");
System.out.println("Scheme is NOT applicable for ::"+itemCodeSchm + "Purchased Item quantity::"+xmlQty +"is NOT greater than or equal to applicable quantity"+purcBase+"for scheme "+schemeCode);
}
}
}
}
}
}//end of while loop
if(pstmt != null)
{
pstmt.close();
pstmt = null;
}
if(rs != null)
{
rs.close();
rs = null;
}
//valueXmlString.append(s12);
}//end of if block for list
valueXmlString.append("</Root>\r\n");
}
catch(Exception e)
......@@ -552,4 +707,137 @@ public class SorderAct extends ActionHandlerEJB implements SorderActLocal, Sorde
}
return AttribValue;
}
//Added by sarita on 15JAN2018
public String returnFinalFreeItemDataUsingList(List<String> list,Connection conn,String schemeType,String schemeCode,String schemeDescr,double discount,double freeQty,String itemValues)
{
System.out.println("finalFreeItems :::"+list);
//System.out.println("finalFreeItems :::"+list.size());
StringBuffer valueXmlString = new StringBuffer();
String itemDescription = "",nature = "",sch_attr="Y";
Set<String> listSet = null;
int domID = 0;
try
{
if("0".equalsIgnoreCase(schemeType) || "1".equalsIgnoreCase(schemeType))
{
nature="F";
discount=0.0;
//finRate=0.0;
System.out.println("Nature is "+nature);
}
else if("2".equalsIgnoreCase(schemeType))
{
nature="C";
System.out.println("Nature is "+nature);
}
System.out.println("Final List is :::to iterate ["+list+"]" +"\t"+ "Purchased Items are :::["+itemValues+"]");
if(list != null )
{
System.out.println("List is not Enpty!!!");
listSet = new HashSet<String>(list);
System.out.println("Final listSet to iterate ["+listSet+"]");
if(listSet.size() > 0)
{
for(String item_Code : listSet)
{
System.out.println("Free Item in listSet are :::"+listSet);
domID++;
valueXmlString.append("<Detail domId='"+(domID)+"'>\r\n");
System.out.println("Free Items "+item_Code);
itemDescription = getItemDescr(item_Code,conn);
valueXmlString.append("<scheme_type>").append("<![CDATA[").append(schemeType).append("]]>").append("</scheme_type>\r\n");
valueXmlString.append("<applicable_scheme>").append("<![CDATA[").append(schemeCode).append("]]>").append("</applicable_scheme>\r\n");
valueXmlString.append("<scheme_description visible = \"1\">").append("<![CDATA[").append(schemeDescr).append("]]>").append("</scheme_description>\r\n");
valueXmlString.append("<purchase_item_code>").append("<![CDATA[").append(itemValues).append("]]>").append("</purchase_item_code>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(item_Code).append("]]>").append("</item_code>\r\n");
//valueXmlString.append("<item_code__ord>").append("<![CDATA[").append(item_Code).append("]]>").append("</item_code__ord>\r\n");
//valueXmlString.append("<item_code__ord>").append("<![CDATA[").append(item_Code).append("]]>").append("</item_code__ord>\r\n");
valueXmlString.append("<item_descr>").append("<![CDATA[").append(itemDescription).append("]]>").append("</item_descr>\r\n");
valueXmlString.append("<quantity>").append("<![CDATA[").append(freeQty).append("]]>").append("</quantity>\r\n");
valueXmlString.append("<discount>").append("<![CDATA[").append(discount).append("]]>").append("</discount>\r\n");
valueXmlString.append("<nature>").append("<![CDATA[").append(nature).append("]]>").append("</nature>\r\n");
valueXmlString.append("<sch_attr>").append("<![CDATA[").append(sch_attr).append("]]>").append("</sch_attr>\r\n");
valueXmlString.append("<rate>").append("<![CDATA[").append(0.0).append("]]>").append("</rate>\r\n");
valueXmlString.append("</Detail>\r\n");
}
}
}
}
catch(Exception e)
{
System.out.println("Exception in returnFinalDataUsingList is:::"+e);
e.printStackTrace();
}
return valueXmlString.toString();
}
public String returnFinalDataUsingList(List<String> list,Connection conn,String siteCode)
{
System.out.println("finalFreeItems :::"+list);
System.out.println("finalFreeItems :::"+list.size());
StringBuffer valueXmlString = new StringBuffer();
String itemDescription = "";
try
{
Set<String> listSet = new HashSet<String>(list);
if(listSet.size() > 0)
{
for(String item_Code : listSet)
{
System.out.println("Free Items "+item_Code);
itemDescription = getItemDescr(item_Code,conn);
valueXmlString.append("<item_code__ord visible = \"1\">").append("<![CDATA[").append(item_Code).append("]]>").append("</item_code__ord>\r\n");
valueXmlString.append("<item_code>").append("<![CDATA[").append(item_Code).append("]]>").append("</item_code>\r\n");
valueXmlString.append("<item_descr>").append("<![CDATA[").append(itemDescription).append("]]>").append("</item_descr>\r\n");
valueXmlString.append("<site_code visible = \"1\">").append("<![CDATA[").append(siteCode).append("]]>").append("</site_code>\r\n");
valueXmlString.append("<quantity>").append("<![CDATA[]]>").append("</quantity>\r\n");
valueXmlString.append("<rate visible = \"1\">").append("<![CDATA[0]]>").append("</rate>\r\n");
}
}
}
catch(Exception e)
{
System.out.println("Exception in returnFinalDataUsingList is:::"+e);
e.printStackTrace();
}
return valueXmlString.toString();
}
public String getItemCode(List<String> itemCodeListScheme)
{
Iterator<String> itr = null;
String itemValues = "";
try
{
itr = itemCodeListScheme.iterator();
while(itr.hasNext())
{
itemValues = itemValues + "'"+(String) itr.next() + "'"+",";
}
//System.out.println("s1 is "+s1);
if(itemValues != null && itemValues.length() != 0)
{
itemValues = itemValues.substring(0,itemValues.length()-1);
// System.out.println("s1 is "+s1);
}
System.out.println("itemValues is "+itemValues);
}
catch(Exception e)
{
e.printStackTrace();
}
return itemValues;
}
private String checkDouble(String input)
{
if (input == null || input.trim().length() == 0)
{
input="0";
}
return input;
}
}
\ No newline at end of file
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment