Commit 323af4b2 authored by msingh's avatar msingh

Added bean for product wizard.


git-svn-id: http://15.206.35.175/svn/proteus/business-java/trunk@98938 ce508802-f39f-4f6c-b175-0d175dae99d5
parent ac013348
package ibase.webitm.bean.wms;
import java.io.File;
import java.sql.Connection;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import ibase.system.config.AppConnectParm;
import ibase.system.config.ConnDriver;
import ibase.utility.CommonConstants;
import ibase.utility.E12GenericUtility;
import ibase.webitm.ejb.wms.DDProductWizRemote;
import ibase.webitm.utility.ITMException;
import javax.naming.InitialContext;
import javax.servlet.http.HttpSession;
public class ItemDetailsBean
{
private ibase.utility.UserInfoBean userInfo = null;
private HttpSession sessionCtx = null;
private String objName = "";
private String user_lang ="en";
private String user_country = "US";
/**
*
* @param objName
* @param sessionCtx
* @throws ITMException
*/
public ItemDetailsBean(String objName, HttpSession sessionCtx) throws ITMException
{
try
{
this.objName = objName;
this.sessionCtx = sessionCtx;
this.userInfo = ( ibase.utility.UserInfoBean ) this.sessionCtx.getAttribute("USER_INFO");
}
catch (Exception e)
{
throw new ITMException(e);
}
}
public ItemDetailsBean() {
// TODO Auto-generated constructor stub
}
/**
* display list in popup
* @param loginCode
* @param field
* @param values
* @return
* @throws ITMException
*/
public String getList( String loginCode, String field, String[] values ) throws ITMException
{
System.out.println("loginCode in getList =["+loginCode+"]");
String itemTypeList = "";
DDProductWizRemote ddProductWizRemote = null;
try
{
InitialContext ctx = new InitialContext( new AppConnectParm().getProperty() );
ddProductWizRemote = (ibase.webitm.ejb.wms.DDProductWizRemote) ctx.lookup("ibase/DDProductWizEJB/remote");
itemTypeList = ddProductWizRemote.getList(loginCode, field, values);
String xslFileName = getXSLFileName( "dd_productWiz_itemList_wiz_" + this.user_lang + "_" + this.user_country + ".xsl" );
itemTypeList = (ibase.webitm.utility.GenericUtility.getInstance()).transformToString( xslFileName, itemTypeList, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
}
catch (Exception e)
{
throw new ITMException(e);
}
finally
{
if ( ddProductWizRemote != null )
{
ddProductWizRemote = null;
}
}
return itemTypeList;
}
/**
* go to prevoius form
* @param formNo
* @param xmlData
* @return
* @throws ITMException
*/
public String previousForm( String formNo, String xmlData ) throws ITMException
{
String retHtmlData = null;
try
{
System.out.println("In Method : [previousForm]");
System.out.println("xmlString : ["+ xmlData +"]");
String xslFileName = getXSLFileName( this.objName + formNo + "_wiz_" + this.user_lang + "_" + this.user_country + "_" + "A" + ".xsl" );
retHtmlData = (ibase.webitm.utility.GenericUtility.getInstance()).transformToString( xslFileName, xmlData, CommonConstants.APPLICATION_CONTEXT + File.separator + "temp", "Output", ".html" );
}
catch (Exception e)
{
throw new ITMException(e);
}
finally
{
}
return retHtmlData;
}
/**
* get XSL filename
* @param xslFileName
* @return
* @throws ITMException
*/
private String getXSLFileName( String xslFileName )throws ITMException
{
String retFileName = null;
try
{
String defaultPath = null;
if( CommonConstants.APPLICATION_CONTEXT != null )
{
defaultPath = CommonConstants.APPLICATION_CONTEXT + CommonConstants.ITM_CONTEXT + File.separator;
}
else
{
defaultPath = ".." + File.separator + "webapps" + File.separator + "ibase" + File.separator + CommonConstants.ITM_CONTEXT + File.separator;
}
File xslPath = new File( defaultPath + File.separator + "xsl" + File.separator + CommonConstants.THEME + File.separator + "WIZARD");
if ( !xslPath.exists() )
{
xslPath.mkdir();
}
System.out.println( " xslPath [" + xslPath +"] xslFileName ["+xslFileName +"]");
File xslFile = new File(xslPath , xslFileName);
if( xslFile.exists() )
{
retFileName = xslFile.getAbsolutePath();
}
else
{
throw new ITMException( new Exception( retFileName + " Wizard XSL file Not Found") );
}
}
catch (Exception e)
{
throw new ITMException(e);
}
return retFileName;
}
/**
*
* @param sizeCode
* @return
* @throws ITMException
*/
//Added by Parikshit Kumbhar on 18/05/2015 [added getSizeDetails() function] Start
public String getSizeDetails( String sizeCode ) throws ITMException
{
E12GenericUtility genericUtility = new E12GenericUtility();
StringBuffer valueXmlString = new StringBuffer("<Root>\r\n");
Connection conn = null;
PreparedStatement pstmt = null;
ResultSet rs = null;
try
{
ConnDriver connDriver = new ConnDriver();
conn = connDriver.getConnectDB("DriverITM");
String sql = "SELECT Attrib_Id, TRIM(Descr) FROM itm_attrib_val WHERE Attrib_Code=? ORDER BY sort_order";
pstmt = conn.prepareStatement(sql);
pstmt.setString(1, sizeCode);
rs = pstmt.executeQuery();
int num = 1;
while (rs.next())
{
String fieldId = checkNullAndTrim(rs.getString(1));
String fieldValue = checkNullAndTrim(rs.getString(2));
valueXmlString.append("<PROD_SIZE domID='"+ num +"' selected = 'N'>\r\n");
valueXmlString.append("<fieldId><![CDATA[").append(fieldId).append("]]></fieldId>\r\n");
valueXmlString.append("<fieldValue><![CDATA[").append(fieldValue).append("]]></fieldValue>\r\n");
valueXmlString.append("</PROD_SIZE>\r\n");
num++;
}
}
catch (Exception e)
{
e.printStackTrace();
System.out.println("Exception :ITMWizardStatefulEJB :getList(String):" + e.getMessage() + ":");
valueXmlString = valueXmlString.append(genericUtility.createErrorString(e));
}
finally
{
try
{
if (rs != null)
{
rs.close();
rs = null;
}
if (pstmt != null )
{
pstmt.close();
pstmt = null;
}
if (conn != null && !conn.isClosed())
{
conn.close();
conn = null;
}
}
catch (Exception e)
{
System.out.println("Exception :ITMWizardStatefulEJB :getProdTypeList(String) :==>\n"+ e.getMessage());
throw new ITMException(e);
}
}
valueXmlString.append("</Root>\r\n");
System.out.println("\n****ValueXmlString :" + valueXmlString.toString() + ":********");
return valueXmlString.toString();
}
//Added by Parikshit Kumbhar on 18/05/2015 [added getSizeDetails() function] End
/**
*
* @param input
* @return
*/
private String checkNullAndTrim(String input)
{
if (input==null)
{
input="";
}
return input.trim();
}
}
/*
* To change this license header, choose License Headers in Project Properties.
* To change this template file, choose Tools | Templates
* and open the template in the editor.
*/
package ibase.webitm.bean.wms;
import java.util.Date;
/**
*
* @author Rsingh
*/
public class Product {
private int storeId;
public void setStoreId(int storeId) {
this.storeId = storeId;
}
public int getStoreId() {
return this.storeId;
}
private int taxClass;
public void setTaxClass(int taxClass) {
this.taxClass = taxClass;
}
public int getTaxClass() {
return this.taxClass;
}
private String categories;
public void setCategories(String categories) {
this.categories = categories;
}
public String getCategories() {
return this.categories;
}
private String sku;
public void setSku(String sku) {
this.sku = sku;
}
public String getSku() {
return this.sku;
}
private String productName;
public void setProductName(String productName) {
this.productName = productName;
}
public String getProductName() {
return this.productName;
}
private double productWeight;
public void setProductWeight(double productWeight) {
this.productWeight = productWeight;
}
public double getProductWeight() {
return this.productWeight;
}
private int productStatus;
public void setProductStatus(int productStatus) {
this.productStatus = productStatus;
}
public int getProductStatus() {
return this.productStatus;
}
private int sizeId;
public void setProductSizeId(int sizeId) {
this.sizeId = sizeId;
}
public int getProductSize() {
return this.sizeId;
}
private int dimensionId;
public void setProductDimensionId(int dimensionId) {
this.dimensionId = dimensionId;
}
public int getProductDimensionId() {
return this.dimensionId;
}
private int manufacturerId;
public void setManufacturerId(int manufacturerId) {
this.manufacturerId = manufacturerId;
}
public int getManufacturerId() {
return this.manufacturerId;
}
private int colorId;
public void setColorId(int colorId) {
this.colorId = colorId;
}
public int getColorId() {
return this.colorId;
}
private String manufacturerCountryCode;
public void setManufacturerCountryCode(String manufacturerCountryCode) {
this.manufacturerCountryCode = manufacturerCountryCode;
}
public String getManufacturerCountryCode() {
return this.manufacturerCountryCode;
}
private double price;
public void setPrice(double price) {
this.price = price;
}
public double getPrice() {
return this.price;
}
private double cost;
public void setCost(double cost) {
this.cost = cost;
}
public double getCost() {
return this.cost;
}
private double specialPrice;
public void setSpecialPrice(double specialPrice) {
this.specialPrice = specialPrice;
}
public double getSpecialPrice() {
return this.specialPrice;
}
private Date specialPriceFrom;
public void setSpecialPriceFrom(Date specialPriceFrom) {
this.specialPriceFrom = specialPriceFrom;
}
public Date getSpecialPriceFrom() {
return this.specialPriceFrom;
}
private Date specialPriceTo;
public void setSpecialPriceTo(Date specialPriceTo) {
this.specialPriceTo = specialPriceTo;
}
public Date getSpecialPriceTo() {
return this.specialPriceTo;
}
private double msrp;
public void setmsrp(double msrp) {
this.msrp = msrp;
}
public double getMsrp() {
return this.msrp;
}
private String metaTitle;
public void setMetaTitle(String metaTitle) {
this.metaTitle = metaTitle;
}
public String getMetaTitle() {
return this.metaTitle;
}
private String metaKeywords;
public void setMetaKeywords(String metaKeywords) {
this.metaKeywords = metaKeywords;
}
public String getMetaKeywords() {
return this.metaKeywords;
}
private String metaDescription;
public void setMetaDescription(String metaDescription) {
this.metaDescription = metaDescription;
}
public String getMetaDescription() {
return this.metaDescription;
}
private String longDescription;
public void setLongDescription(String longDescription) {
this.longDescription = longDescription;
}
public String getLongDescription() {
return this.longDescription;
}
private String shortDescription;
public void setShortDescription(String shortDescription) {
this.shortDescription = shortDescription;
}
public String getShortDescription() {
return this.shortDescription;
}
private String imagePath;
public void setImagePath(String imagePath) {
this.imagePath = imagePath;
}
public String getImagePath() {
return this.imagePath;
}
private int qty;
public void setQty(int qty) {
this.qty = qty;
}
public int getQty() {
return this.qty;
}
private String currency;
public void setCurrency(String currency)
{
this.currency = currency;
}
public String getCurrency()
{
return this.currency;
}
//Changed by samadhan D15AKAT003 on 20/05/2015 for magento updation. Start
private int attributeSetId;
public void setAttributeSetId(int attributeSetId) {
this.attributeSetId = attributeSetId;
}
public int getAttributeSetId() {
return this.attributeSetId;
}
//Changed by samadhan D15AKAT003 on 20/05/2015 for magento updation. End
//Changed by samadhan D15AKAT003 on 08/06/2015 for store view magento updation. Start
private String storeInfo;
public String getStoreInf() {
return storeInfo;
}
public void setStoreInf(String storeInf) {
this.storeInfo = storeInf;
}
//Changed by samadhan D15AKAT003 on 08/06/2015 for store view magento updation. end
//Changed by samadhan D15AKAT003 on 15/06/2015 for store view magento updation. Start
private String barcode;
public String getBarcode() {
return barcode;
}
public void setBarcode(String barcode) {
this.barcode = barcode;
}
//Changed by samadhan D15AKAT003 on 15/06/2015 for store view magento updation. end
//Changed by Wasim on 14/08/2015 for api key for magento. [START]
private String apiKey;
public String getApiKey() {
return this.apiKey;
}
public void setApiKey(String tag) {
this.apiKey = tag;
}
//Changed by Wasim on 14/08/2015 for api key for magento. [END]
}
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