Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Customer


    throws Throwable {
   
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomerMaintActionForm form = (CustomerMaintActionForm) actionForm;
    Site site = getAdminBean(request).getSite();
        Customer customer = CustomerDAO.load(site.getSiteId(), Format.getLong(form.getCustId()));
    em.remove(customer);
    ActionForward actionForward = actionMapping.findForward("removeSuccess");
    return actionForward;
  }
View Full Code Here


      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    CustomerMaintActionForm form = (CustomerMaintActionForm) actionForm;
    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();

    Customer customer = CustomerDAO.load(site.getSiteId(), Format.getLong(form.getCustId()));

    ActionMessages errors = validate(form, site.getSiteId());
    if (errors.size() != 0) {
      saveMessages(request, errors);
          initSearchInfo(request, form, site.getSiteId(), customer);
      return mapping.findForward("error");
    }
    customer.setCustEmail(form.getCustEmail());
    customer.setCustPublicName(form.getCustPublicName());
    customer.setCustComments(form.getCustComments());
    customer.setActive(Constants.VALUE_NO);
    if (!Format.isNullOrEmpty(form.getActive())) {
      customer.setActive(form.getActive().equals("Y") ? Constants.VALUE_YES : Constants.VALUE_NO);
    }
   
    CustomerAddress address = customer.getCustAddress();
    if (address == null) {
      address = new CustomerAddress();
      customer.setCustAddress(address);
      customer.getCustAddresses().add(address);
          address.setRecCreateBy(adminBean.getUserId());
          address.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    address.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
    address.setCustAddressType(Constants.CUSTOMER_ADDRESS_CUST);
      address.setCustPrefix(form.getCustPrefix());
      address.setCustLastName(form.getCustLastName());
      address.setCustMiddleName(form.getCustMiddleName());
      address.setCustFirstName(form.getCustFirstName());
      address.setCustSuffix(form.getCustSuffix());
      address.setCustPhoneNum(form.getCustPhoneNum());
      address.setCustFaxNum(form.getCustFaxNum());
      address.setCustAddressLine1(form.getCustAddressLine1());
      address.setCustAddressLine2(form.getCustAddressLine2());
      address.setCustStateCode(form.getCustStateCode());
      address.setCustStateName("");
      if (Format.isNullOrEmpty(form.getCustStateCode())) {
        address.setCustStateName(Utility.getStateName(adminBean.getSiteId(), form.getCustStateCode()));
      }
      address.setCustCountryCode(form.getCustCountryCode());
      address.setCustCountryName("");
      if (Format.isNullOrEmpty(form.getCustCountryCode())) {
        address.setCustCountryName(Utility.getCountryName(adminBean.getSiteId(), form.getCustCountryCode()));
      }
      address.setCustZipCode(form.getCustZipCode());
        address.setRecUpdateBy(adminBean.getUserId());
        address.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        em.persist(address);

    address = null;
    for (CustomerAddress a : customer.getCustAddresses()) {
      if (a.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_BILLING)) {
        address = a;
      }
    }
    if (address == null) {
      address = new CustomerAddress();
      customer.getCustAddresses().add(address);
          address.setRecCreateBy(adminBean.getUserId());
          address.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    address.setCustUseAddress(form.getBillingCustUseAddress());
    address.setCustAddressType(Constants.CUSTOMER_ADDRESS_BILLING);
      address.setCustPrefix(form.getBillingCustPrefix());
      address.setCustLastName(form.getBillingCustLastName());
      address.setCustMiddleName(form.getBillingCustMiddleName());
      address.setCustFirstName(form.getBillingCustFirstName());
      address.setCustSuffix(form.getBillingCustSuffix());
      address.setCustPhoneNum(form.getBillingCustPhoneNum());
      address.setCustFaxNum(form.getBillingCustFaxNum());
      address.setCustAddressLine1(form.getBillingCustAddressLine1());
      address.setCustAddressLine2(form.getBillingCustAddressLine2());
      address.setCustStateCode(form.getBillingCustStateCode());
      address.setCustStateName("");
      if (!Format.isNullOrEmpty(form.getBillingCustStateCode())) {
        address.setCustStateName(Utility.getStateName(adminBean.getSiteId(), form.getBillingCustStateCode()));
      }
      address.setCustCountryCode(form.getBillingCustCountryCode());
      address.setCustCountryName("");
      if (!Format.isNullOrEmpty(form.getBillingCustCountryCode())) {
        address.setCustCountryName(Utility.getCountryName(adminBean.getSiteId(), form.getBillingCustCountryCode()));
      }
      address.setCustZipCode(form.getBillingCustZipCode());
        address.setRecUpdateBy(adminBean.getUserId());
        address.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        em.persist(address);
   
    address = null;
    for (CustomerAddress a : customer.getCustAddresses()) {
      if (a.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_SHIPPING)) {
        address = a;
      }
    }
    if (address == null) {
      address = new CustomerAddress();
      customer.getCustAddresses().add(address);
          address.setRecCreateBy(adminBean.getUserId());
          address.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    address.setCustUseAddress(form.getShippingCustUseAddress());
    address.setCustAddressType(Constants.CUSTOMER_ADDRESS_SHIPPING);
      address.setCustPrefix(form.getShippingCustPrefix());
      address.setCustLastName(form.getShippingCustLastName());
      address.setCustMiddleName(form.getShippingCustMiddleName());
      address.setCustFirstName(form.getShippingCustFirstName());
      address.setCustSuffix(form.getShippingCustSuffix());
      address.setCustPhoneNum(form.getShippingCustPhoneNum());
      address.setCustFaxNum(form.getShippingCustFaxNum());
      address.setCustAddressLine1(form.getShippingCustAddressLine1());
      address.setCustAddressLine2(form.getShippingCustAddressLine2());
      address.setCustStateCode(form.getShippingCustStateCode());
      address.setCustStateName("");
      if (!Format.isNullOrEmpty(form.getShippingCustStateCode())) {
        address.setCustStateName(Utility.getStateName(adminBean.getSiteId(), form.getShippingCustStateCode()));
      }
      address.setCustCountryCode(form.getShippingCustCountryCode());
      address.setCustCountryName("");
      if (!Format.isNullOrEmpty(form.getShippingCustCountryCode())) {
        address.setCustCountryName(Utility.getCountryName(adminBean.getSiteId(), form.getShippingCustCountryCode()));
      }
      address.setCustZipCode(form.getShippingCustZipCode());
        address.setRecUpdateBy(adminBean.getUserId());
        address.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        em.persist(address);

    customer.setRecUpdateBy(adminBean.getUser().getUserId());
    customer.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (!Format.isNullOrEmpty(form.getCustPassword())) {
      customer.setCustPassword(AESEncoder.getInstance().encode(form.getCustPassword()));
    }
    if (!Format.isNullOrEmpty(form.getCustClassId())) {
      CustomerClass customerClass = (CustomerClass) em.find(CustomerClass.class, Format.getLong(form.getCustClassId()));
      if (customerClass != null) {
        customer.setCustomerClass(customerClass);
      }
    }
    else {
      customer.setCustomerClass(null);
    }
    em.persist(customer);
   
    CustomerCreditCard customerCreditCard = null;
    Iterator<?> iterator = customer.getCustCreditCards().iterator();
    if (iterator.hasNext()) {
      customerCreditCard = (CustomerCreditCard) iterator.next();
    }
    if (customerCreditCard == null) {
      customerCreditCard = new CustomerCreditCard();
      customerCreditCard.setRecCreateBy(adminBean.getUser().getUserId());
      customerCreditCard.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    customerCreditCard.setCustCreditCardFullName(form.getCustCreditCardFullName());
    customerCreditCard.setCustCreditCardNum(AESEncoder.getInstance().encode(form.getCustCreditCardNum()));
    customerCreditCard.setCustCreditCardExpiryMonth(form.getCustCreditCardExpiryMonth());
    customerCreditCard.setCustCreditCardExpiryYear(form.getCustCreditCardExpiryYear());
    customerCreditCard.setCustCreditCardVerNum(form.getCustCreditCardVerNum());
    customerCreditCard.setRecUpdateBy(adminBean.getUser().getUserId());
    customerCreditCard.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    CreditCard creditCard = CreditCardDAO.load(site.getSiteId(), Long.valueOf(form.getCreditCardId()));
    customerCreditCard.setCreditCard(creditCard);
    customer.getCustCreditCards().add(customerCreditCard);
    em.persist(customerCreditCard);

   
        initSearchInfo(request, form, site.getSiteId(), customer);
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
View Full Code Here

            HttpServletResponse response)
        throws Throwable {
      MyAccountIdentityActionForm form = (MyAccountIdentityActionForm) actionForm;
      init(request, form);
      ActionForward actionForward = actionMapping.findForward("success");
      Customer customer = getCustomer(request);
    String siteId = getContentBean(request).getContentSessionKey().getSiteId();
      customer = CustomerDAO.load(siteId, customer.getCustId());
      form.setCustEmail(customer.getCustEmail());
      form.setCustPublicName(customer.getCustPublicName());
    createEmptySecureTemplateInfo(request);
        return actionForward;
    }
View Full Code Here

      saveMessages(request, messages);
            ActionForward actionForward = actionMapping.findForward("error");
            return actionForward;
      }
     
    Customer customer = CustomerDAO.load(siteId, getCustomer(request).getCustId());
   
        if (form.getCustPassword().trim().length() > 0) {
          customer.setCustPassword(AESEncoder.getInstance().encode(form.getCustPassword()));
        }
        customer.setCustPublicName(form.getCustPublicName());
        customer.setRecUpdateBy(Constants.USERNAME_CUSTOMER);
        customer.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
        em.persist(customer);
        ContentLookupDispatchAction.setCustId(request, customer.getCustId());
    form.setCustPassword("");
    form.setCustPassword1("");
    messages.add("message", new ActionMessage("content.text.information.updated"));
    saveMessages(request, messages)
View Full Code Here

        calcPage(adminBean, form, list, pageNo);
        Vector<CustomerDisplayForm> vector = new Vector<CustomerDisplayForm>();
        int startRecord = (form.getPageNo() - 1) * adminBean.getListingPageSize();
        int endRecord = startRecord + adminBean.getListingPageSize();
        for (int i = startRecord; i < list.size() && i < endRecord; i++) {
          Customer customer = (Customer) list.get(i);
          CustomerAddress customerAddress = null;
          for (CustomerAddress address : customer.getCustAddresses()) {
            if (address.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_CUST)) {
              customerAddress = address;
              break;
            }
          }
          CustomerDisplayForm customerDisplay = new CustomerDisplayForm();
          customerDisplay.setSiteName(customer.getSiteDomain().getSiteDomainLanguage().getSiteName());
          customerDisplay.setCustId(Format.getLong(customer.getCustId()));
          customerDisplay.setCustEmail(customer.getCustEmail());
          customerDisplay.setCustFirstName(customerAddress.getCustFirstName());
          customerDisplay.setCustLastName(customerAddress.getCustLastName());
          customerDisplay.setActive(String.valueOf(customer.getActive()));
            vector.add(customerDisplay);
        }
        CustomerDisplayForm customers[] = new CustomerDisplayForm[vector.size()];
        vector.copyInto(customers);
        form.setCustomers(customers);
View Full Code Here

                continue;
              }
              if (!customers[i].getRemove().equals("Y")) {
                continue;
              }
                Customer customer = new Customer();
                customer = CustomerDAO.load(site.getSiteId(), Format.getLong(customers[i].getCustId()));
                em.remove(customer);
            }
            em.getTransaction().commit();
          }
View Full Code Here

  public CommentInfo[] getContentComment() throws Exception {
    return api.getContentComment(getContentKey());
  }
 
  public Hashtable<String, String> updateContentComment() throws Exception {
    Customer customer = ContentLookupDispatchAction.getCustomer(request);
    if (customer == null) {
      return null;
    }
   
    String contentNaturalKey = Utility.reEncode(getCategoryParameter(request, 2));
    String commentTitle = request.getParameter("commentTitle");
    commentTitle = Utility.escapeStrictHTML(commentTitle);
    String commentLine = request.getParameter("comment");
    commentLine = Utility.escapeStrictHTML(commentLine);

    Hashtable<String, String> attributes = new Hashtable<String, String>();
    if (Format.isNullOrEmpty(commentTitle)) {
      attributes.put("commentTitleMessage", getLanguage("content.error.string.required"));
    }
    if (Format.isNullOrEmpty(commentLine)) {
      attributes.put("commentMessage", getLanguage("content.error.string.required"));
    }
   
    if (attributes.size() == 0) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Content content = (Content) ContentDAO.loadNatural(siteDomain.getSite().getSiteId(), contentNaturalKey);
      Comment comment = new Comment();
      comment.setCommentTitle(commentTitle);
      comment.setComment(commentLine);
      comment.setCommentRating(0);
      comment.setActive(Constants.VALUE_YES);
      String custName = customer.getCustEmail();
      if (custName.length() > 20) {
        custName = custName.substring(0, 19);
      }
      comment.setRecCreateBy(custName);
      comment.setRecCreateDatetime(new Date(System.currentTimeMillis()));
View Full Code Here

    ItemInfo itemInfo = api.getItem(itemNaturalKey, updateStatistics);
    return itemInfo;
  }
 
  public Hashtable<String, String> updateItemComment() throws Exception {
    Customer customer = ContentLookupDispatchAction.getCustomer(request);
    if (customer == null) {
      return null;
    }
   
    String itemNaturalKey = Utility.reEncode(getCategoryParameter(request, 2));
    String commentTitle = request.getParameter("commentTitle");
    commentTitle = Utility.escapeStrictHTML(commentTitle);
    String commentLine = request.getParameter("comment");
    commentLine = Utility.escapeStrictHTML(commentLine);
    String commentRating = request.getParameter("commentRating");

    Hashtable<String, String> attributes = new Hashtable<String, String>();
    if (Format.isNullOrEmpty(commentTitle)) {
      attributes.put("commentTitleMessage", getLanguage("content.error.string.required"));
    }
    if (Format.isNullOrEmpty(commentLine)) {
      attributes.put("commentMessage", getLanguage("content.error.string.required"));
    }
    if (Format.isNullOrEmpty(commentRating) || commentRating.equals("0")) {
      attributes.put("commentRatingMessage", getLanguage("content.error.string.required"));
    }

    if (attributes.size() == 0) {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Item item = (Item) ItemDAO.loadNatural(siteDomain.getSite().getSiteId(), itemNaturalKey);
      Comment comment = new Comment();
      comment.setCommentTitle(commentTitle);
      comment.setComment(commentLine);
      comment.setCommentRating(Integer.valueOf(commentRating));
      comment.setActive(Constants.VALUE_YES);
      String custName = customer.getCustEmail();
      if (custName.length() > 20) {
        custName = custName.substring(0, 19);
      }
      comment.setRecCreateBy(custName);
      comment.setRecCreateDatetime(new Date(System.currentTimeMillis()));
View Full Code Here

 
  protected void init(HttpServletRequest request) throws Exception {
  }
 
  protected void initAddressInfo(ShoppingCartActionForm form, Site site, ShoppingCart shoppingCart, HttpServletRequest request, ActionMessages messages) throws Exception {
    Customer customer = shoppingCart.getCustomer();
    form.setPasswordEmpty(false);
    if (Format.isNullOrEmpty(customer.getCustPassword())) {
      form.setPasswordEmpty(true);
    }
   
    CustomerAddress billingAddress = shoppingCart.getBillingAddress();
    CustomerAddress shippingAddress = shoppingCart.getShippingAddress();

    form.setCustId(Format.getLong(customer.getCustId()));
    form.setNewUser(false);
    if (request.getParameter("new") != null  && request.getParameter("new").equals(String.valueOf(Constants.VALUE_YES))) {
      form.setNewUser(true);
    }
    form.setCustEmail(customer.getCustEmail());
   
    CustomerAddress custAddress = shoppingCart.getCustAddress();
    if (custAddress != null) {
      form.setCustFirstName(custAddress.getCustFirstName());
      form.setCustMiddleName(custAddress.getCustMiddleName());
View Full Code Here

      return errors;
    }
   
    protected void saveAddress(ShoppingCartActionForm form, Site site, ShoppingCart shoppingCart, ContentBean contentBean) throws Exception {
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    Customer customer = CustomerDAO.load(site.getSiteId(), Format.getLong(form.getCustId()));
    customer.setRecUpdateBy(Constants.USERNAME_SYSTEM);
    customer.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    // em.update(customer);
   
    CustomerAddress shippingAddress = null;
    CustomerAddress billingAddress = null;
    CustomerAddress custAddress = customer.getCustAddress();
    Iterator<?> iterator = customer.getCustAddresses().iterator();
    while (iterator.hasNext()) {
      CustomerAddress address = (CustomerAddress) iterator.next();
      if (address.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_BILLING)) {
        billingAddress = address;
      }
      if (address.getCustAddressType().equals(Constants.CUSTOMER_ADDRESS_SHIPPING)) {
        shippingAddress = address;
      }
    }
   
    if (custAddress == null) {
      custAddress = new CustomerAddress();
      customer.setCustAddress(custAddress);
      custAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_CUST);
      customer.getCustAddresses().add(custAddress);
      custAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
      custAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    custAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
    custAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
    custAddress.setCustFirstName(form.getCustFirstName());
    custAddress.setCustMiddleName(form.getCustMiddleName());
    custAddress.setCustLastName(form.getCustLastName());
    custAddress.setCustSuffix(form.getCustSuffix());
    custAddress.setCustAddressLine1(form.getCustAddressLine1());
    custAddress.setCustAddressLine2(form.getCustAddressLine2());
    custAddress.setCustCityName(form.getCustCityName());
    if (!Format.isNullOrEmpty(form.getCustStateCode())) {
      custAddress.setCustStateCode(form.getCustStateCode());
      custAddress.setCustStateName(Utility.getStateName(site.getSiteId(), form.getCustStateCode()));
    }
    else {
      custAddress.setCustStateCode("");
      custAddress.setCustStateName(form.getCustStateName());
    }
    custAddress.setCustCountryCode(form.getCustCountryCode());
    custAddress.setCustCountryName(Utility.getCountryName(site.getSiteId(), form.getCustCountryCode()));
    custAddress.setCustZipCode(form.getCustZipCode());
    custAddress.setCustPhoneNum(form.getCustPhoneNum());
    custAddress.setCustFaxNum(form.getCustFaxNum());
    custAddress.setRecUpdateBy(Constants.USERNAME_SYSTEM);
    custAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    custAddress.setState(StateDAO.loadByStateCode(site.getSiteId(), form.getCustStateCode()));
    custAddress.setCountry(CountryDAO.loadByCountryCode(site.getSiteId(), form.getCustCountryCode()));
    custAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
    custAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    if (custAddress.getCustAddressId() == null) {
      em.persist(custAddress);
    }
    shoppingCart.setCustAddress(custAddress);
   
    if (billingAddress == null) {
      billingAddress = new CustomerAddress();
      billingAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_BILLING);
      customer.getCustAddresses().add(billingAddress);
      billingAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
      billingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    billingAddress.setCustUseAddress(form.getBillingUseAddress());
    if (form.billingUseAddress.equals(Constants.CUST_ADDRESS_USE_OWN)) {
      billingAddress.setCustUseAddress(Constants.CUST_ADDRESS_USE_OWN);
      billingAddress.setCustPrefix(form.getBillingCustPrefix());
      billingAddress.setCustFirstName(form.getBillingCustFirstName());
      billingAddress.setCustMiddleName(form.getBillingCustMiddleName());
      billingAddress.setCustLastName(form.getBillingCustLastName());
      billingAddress.setCustSuffix(form.getBillingCustSuffix());
      billingAddress.setCustAddressLine1(form.getBillingCustAddressLine1());
      billingAddress.setCustAddressLine2(form.getBillingCustAddressLine2());
      billingAddress.setCustCityName(form.getBillingCustCityName());
      if (!Format.isNullOrEmpty(form.getBillingCustStateCode())) {
        billingAddress.setCustStateCode(form.getBillingCustStateCode());
        billingAddress.setCustStateName(Utility.getStateName(site.getSiteId(), form.getBillingCustStateCode()));
      }
      else {
        billingAddress.setCustStateCode("");
        billingAddress.setCustStateName(form.getBillingCustStateName());
      }
      billingAddress.setCustCountryCode(form.getBillingCustCountryCode());
      billingAddress.setCustCountryName(Utility.getCountryName(site.getSiteId(), form.getBillingCustCountryCode()));
      billingAddress.setCustZipCode(form.getBillingCustZipCode());
      billingAddress.setCustPhoneNum(form.getBillingCustPhoneNum());
      billingAddress.setCustFaxNum(form.getBillingCustFaxNum());
      billingAddress.setState(StateDAO.loadByStateCode(site.getSiteId(), form.getBillingCustStateCode()));
      billingAddress.setCountry(CountryDAO.loadByCountryCode(site.getSiteId(), form.getBillingCustCountryCode()));
    }
    billingAddress.setRecUpdateBy(Constants.USERNAME_SYSTEM);
    billingAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (billingAddress.getCustAddressId() == null) {
      em.persist(billingAddress);
    }
    shoppingCart.setBillingAddress(billingAddress);
   
    if (shippingAddress == null) {
      shippingAddress = new CustomerAddress();
      shippingAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_SHIPPING);
      customer.getCustAddresses().add(shippingAddress);
      shippingAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
      shippingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
    }
    shippingAddress.setCustUseAddress(form.getShippingUseAddress());
    if (form.shippingUseAddress.equals(Constants.CUST_ADDRESS_USE_OWN)) {
      if (shippingAddress == null) {
        shippingAddress = new CustomerAddress();
        customer.getCustAddresses().add(shippingAddress);
        shippingAddress.setCustUseAddress(form.getShippingUseAddress());
        shippingAddress.setRecCreateBy(Constants.USERNAME_SYSTEM);
        shippingAddress.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      }
      shippingAddress.setCustAddressType(Constants.CUSTOMER_ADDRESS_SHIPPING);
      shippingAddress.setCustPrefix(form.getShippingCustPrefix());
      shippingAddress.setCustFirstName(form.getShippingCustFirstName());
      shippingAddress.setCustMiddleName(form.getShippingCustMiddleName());
      shippingAddress.setCustLastName(form.getShippingCustLastName());
      shippingAddress.setCustSuffix(form.getShippingCustSuffix());
      shippingAddress.setCustAddressLine1(form.getShippingCustAddressLine1());
      shippingAddress.setCustAddressLine2(form.getShippingCustAddressLine2());
      shippingAddress.setCustCityName(form.getShippingCustCityName());
      if (!Format.isNullOrEmpty(form.getShippingCustStateCode())) {
        shippingAddress.setCustStateCode(form.getShippingCustStateCode());
        shippingAddress.setCustStateName(Utility.getStateName(site.getSiteId(), form.getShippingCustStateCode()));
      }
      else {
        shippingAddress.setCustStateCode("");
        shippingAddress.setCustStateName(form.getShippingCustStateName());
      }
      shippingAddress.setCustCountryCode(form.getShippingCustCountryCode());
      shippingAddress.setCustCountryName(Utility.getCountryName(site.getSiteId(), form.getShippingCustCountryCode()));
      shippingAddress.setCustZipCode(form.getShippingCustZipCode());
      shippingAddress.setCustPhoneNum(form.getShippingCustPhoneNum());
      shippingAddress.setCustFaxNum(form.getShippingCustFaxNum());
      shippingAddress.setState(StateDAO.loadByStateCode(site.getSiteId(), form.getShippingCustStateCode()));
      shippingAddress.setCountry(CountryDAO.loadByCountryCode(site.getSiteId(), form.getShippingCustCountryCode()));
      if (shippingAddress.getCustAddressId() == null) {
        em.persist(shippingAddress);
      }
      shoppingCart.setShippingAddress(shippingAddress);
    }
    shippingAddress.setRecUpdateBy(Constants.USERNAME_SYSTEM);
    shippingAddress.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (shippingAddress.getCustAddressId() == null) {
      em.persist(shippingAddress);
    }
    if (customer.getCustId() == null) {
      em.persist(customer);
    }
    shoppingCart.setShippingAddress(shippingAddress);
    shoppingCart.initCustomer(customer, contentBean);
    }
View Full Code Here

TOP

Related Classes of com.jada.jpa.entity.Customer

Copyright © 2018 www.massapicom. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.