Commit 0dcccbae authored by prumde's avatar prumde

Bug Fixing


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@174293 ce508802-f39f-4f6c-b175-0d175dae99d5
parent 92ff4933
......@@ -61,7 +61,7 @@ public class CategoryDAO
+ " FROM ECMSubCategory esc, SiteItem si "
+ " WHERE esc.scatCode = si.scatCode "
+ " AND si.siteCode = :siteCode "
+ " AND si.ecmType = 1 "
+ " AND si.ecmType IN (1, 2, 3)"
+ " )"
+ " ORDER BY catCode ");
query.setParameter("siteCode", siteCode);
......@@ -78,7 +78,7 @@ public class CategoryDAO
+ " FROM SiteItem si "
+ " WHERE si.scatCode = ec.catCode "
+ " AND si.siteCode = :siteCode "
+ " AND si.ecmType = 1 "
+ " AND si.ecmType IN (1, 2, 3) "
+ " )"
+ " ORDER BY ec.catCode ");
query.setParameter("siteCode", siteCode);
......@@ -169,7 +169,7 @@ public class CategoryDAO
Query query = session.createQuery("FROM ECMSubCategory WHERE scatCode IN ("
+ " SELECT scatCode FROM SiteItem "
+ " WHERE siteCode = :siteCode "
+ " AND ecmType = 1 "
+ " AND ecmType IN (1, 2, 3) "
+ ")"
+ " ORDER BY catCode, scatCode ");
query.setParameter("siteCode", siteCode);
......@@ -204,7 +204,7 @@ public class CategoryDAO
Query query = session.createQuery("FROM ItemMaster WHERE item_code IN ("
+ " SELECT itemCode FROM SiteItem "
+ " WHERE siteCode = :siteCode "
+ " AND ecmType = 1 "
+ " AND ecmType IN (1, 2, 3) "
+ ")"
+ " ORDER BY item_code ");
query.setParameter("siteCode", siteCode);
......@@ -240,7 +240,7 @@ public class CategoryDAO
+ " SELECT itemCode FROM SiteItem "
+ " WHERE siteCode = :siteCode "
+ " AND scatCode = :scatCode "
+ " AND ecmType = 1 "
+ " AND ecmType IN (1, 2, 3) "
+ ")"
+ " ORDER BY item_code ");
query.setParameter("siteCode", siteCode);
......@@ -276,7 +276,7 @@ public class CategoryDAO
+ " AND si.itemCode = item.item_code "
+ " AND esc.curRank < :curRank "
+ " AND si.siteCode = :siteCode "
+ " AND si.ecmType = 1 "
+ " AND si.ecmType IN (1, 2, 3) "
+ " ORDER BY item.item_code ");
query.setParameter("siteCode", siteCode);
......
......@@ -421,14 +421,14 @@ public class ProductDAO {
List<ItemAttribute> itemAttributesList = query.getResultList();
System.out.println("fetchAttributes for phyAttrib ["+phyAttrib+"]");
ItemAttribute itemAttributeObj = ( itemAttributesList != null ) ? itemAttributesList.get(0) : null;
ItemAttribute itemAttributeObj = ( itemAttributesList != null && !itemAttributesList.isEmpty() ) ? itemAttributesList.get(0) : null;
if(itemAttributeObj != null)
{
Query query1 = session.createQuery("FROM ItemAttributeVal WHERE attribCode = '" + phyAttrib + "'");
List<ItemAttributeVal> attributeList = query1.getResultList();
productCache.storeItemAttribValues(cacheName, attributeList);
productCache.storeItemAttribs(cacheName, itemAttributeObj);
}
productCache.storeItemAttribs(cacheName, itemAttributeObj);
session.close();
}
catch (HibernateException e)
......
package proteus.ecm.schedule;
import java.util.Date;
import java.util.List;
import proteus.ecm.cache.CacheManager;
import proteus.ecm.cache.dao.SystemCache;
......
......@@ -223,40 +223,61 @@ public class CategoryService
//For Facet Data Creation
if( optionObjArr == null )
{
String facetDataStr = null;
ECMSubCategory ecmSubCategory = categoryCache.getCachedSubCategory(scatCode, cacheName);
String facetDataStr = getFacetData(scatCode, "local2do", ecmSubCategory.getKeyAttrib() );
JSONObject facetData = new JSONObject(facetDataStr);
System.out.println("JSONObject facetData [" + facetData + "]");
JSONObject facetFields = facetData.getJSONObject("facet_counts").getJSONObject("facet_fields");
System.out.println("JSONObject facetFields [" + facetFields + "]");
if( ecmSubCategory == null )
{
ECMCategory ecmCategory = categoryCache.getCachedCategory(scatCode, cacheName);
facetDataStr = getFacetData(scatCode, "local2do", ecmCategory.getKeyAttrib() );
}
else
{
facetDataStr = getFacetData(scatCode, "local2do", ecmSubCategory.getKeyAttrib() );
}
String itemVariant= itemDetail.getItemVariants();
System.out.println("itemVariant In Response Method "+itemVariant);
if(itemVariant != null && itemVariant.trim().length() > 0)
if( facetDataStr != null && !"false".equalsIgnoreCase( facetDataStr ))
{
optionObjArr = new JSONArray();
JSONObject resItemVariant = new JSONObject(itemVariant);
JSONArray attributes = resItemVariant.getJSONArray("attributes");
for(int i = 0; i < attributes.length(); i++)
JSONObject facetData = new JSONObject(facetDataStr);
System.out.println("JSONObject facetData [" + facetData + "]");
JSONObject facetFields = facetData.getJSONObject("facet_counts").getJSONObject("facet_fields");
System.out.println("JSONObject facetFields [" + facetFields + "]");
String itemVariant= itemDetail.getItemVariants();
System.out.println("itemVariant In Response Method "+itemVariant);
if(itemVariant != null && itemVariant.trim().length() > 0)
{
JSONObject attrKeyValue = attributes.getJSONObject(i);
System.out.println("attrKeyValue --> "+attrKeyValue);
int count = 0;
int index = attrKeyValue.getInt("index");
String name = attrKeyValue.getString("name");
System.out.println("attributes id "+index +"name-->"+name);
if(index != -1)
optionObjArr = new JSONArray();
JSONObject resItemVariant = new JSONObject(itemVariant);
JSONArray attributes = resItemVariant.getJSONArray("attributes");
for(int i = 0; i < attributes.length(); i++)
{
String attribName = attrKeyValue.getString("attribName");
System.out.println("FacetData"+attribName+">>>"+facetFields.getJSONArray(attribName));
attrKeyValue.put("facetData", facetFields.getJSONArray(attribName));
optionObjArr.put(attrKeyValue);
JSONObject attrKeyValue = attributes.getJSONObject(i);
System.out.println("attrKeyValue --> "+attrKeyValue);
int count = 0;
int index = attrKeyValue.getInt("index");
String name = attrKeyValue.getString("name");
System.out.println("attributes id "+index +"name-->"+name);
if(index != -1)
{
String attribName = attrKeyValue.getString("attribName");
System.out.println("FacetData"+attribName+">>>"+facetFields.getJSONArray(attribName));
attrKeyValue.put("facetData", facetFields.getJSONArray(attribName));
optionObjArr.put(attrKeyValue);
}
}
}
}
}
}
itemDetails.put(new JSONObject().put("filterOptions", optionObjArr));
//itemDetails.put(new JSONObject().put("filterOptions", optionObjArr));
if( optionObjArr != null )
{
itemDetails.put(new JSONObject().put("filterOptions", optionObjArr));
}
else
{
itemDetails.put(new JSONObject().put("filterOptions", new JSONArray()));
}
}
//return itemDetails;
return Response.status(200).entity(itemDetails.toString()).build();
......@@ -551,11 +572,12 @@ public class CategoryService
solrQuery.setRows(0);
List<String> attribList = getAttributeList(keyAttributes);
String[] attribArr = {};
solrQuery.addFacetField( attribList.toArray( attribArr) );
System.out.println("keyAttributes: [\n"+keyAttributes + "]" + attribList + "<attribList>" + attribArr);
if( attribList != null )
{
String[] attribArr = {};
solrQuery.addFacetField( attribList.toArray( attribArr) );
System.out.println("keyAttributes: [\n"+keyAttributes + "]" + attribList + "<attribList>" + attribArr);
}
System.out.println("solrURL["+solrURL+"]");
String urlQueryString = ClientUtils.toQueryString(solrQuery, true);
System.out.println("urlQueryString: [\n"+urlQueryString);
......
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