Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.ProductClass


   
      Site site = getAdminBean(request).getSite();
    EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ProductClassMaintActionForm form = (ProductClassMaintActionForm) actionForm;
    try {
      ProductClass productClass = ProductClassDAO.load(site.getSiteId(), Format.getLong(form.getProductClassId()));
      em.remove(productClass);
      em.getTransaction().commit();
    }
    catch (Exception e) {
      if (Utility.isConstraintViolation(e)) {
View Full Code Here


      insertMode = true;
    }

    AdminBean adminBean = getAdminBean(request);
    Site site = adminBean.getSite();
    ProductClass productClass = new ProductClass();
    if (!insertMode) {
      productClass = ProductClassDAO.load(site.getSiteId(), Format.getLong(form.getProductClassId()));
    }

    ActionMessages errors = validate(form);
    if (errors.size() != 0) {
      saveMessages(request, errors);
      return mapping.findForward("error");
    }

    if (insertMode) {
      productClass.setRecCreateBy(adminBean.getUser().getUserId());
      productClass.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      productClass.setSystemRecord(Constants.VALUE_NO);
    }
    productClass.setSite(site);
    productClass.setProductClassName(form.getProductClassName());
    productClass.setRecUpdateBy(adminBean.getUser().getUserId());
    productClass.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    if (insertMode) {
      em.persist(productClass);
    }
    else {
      // em.update(productClass);
    }
        form.setMode("U");
        form.setProductClassId(productClass.getProductClassId().toString());
        FormUtils.setFormDisplayMode(request, form, FormUtils.EDIT_MODE);
    return mapping.findForward("success");
  }
View Full Code Here

          query.setParameter("productClassName", "%" + form.getSrProductClassName() + "%");
        }
        Iterator<?> iterator = query.getResultList().iterator();
        Vector<ProductClassDisplayForm> vector = new Vector<ProductClassDisplayForm>();
        while (iterator.hasNext()) {
          ProductClass productClass = (ProductClass) iterator.next();
        ProductClassDisplayForm productClassDisplay = new ProductClassDisplayForm();
        productClassDisplay.setProductClassId(Format.getLong(productClass.getProductClassId()));
        productClassDisplay.setProductClassName(productClass.getProductClassName());
        productClassDisplay.setSystemRecord(String.valueOf(productClass.getSystemRecord()));
        vector.add(productClassDisplay);
        }
        form.setProductClasses(vector);
       
        ActionForward actionForward = actionMapping.findForward("success");
View Full Code Here

        String productClassIds[] = form.getProductClassIds();
       
        try {
          if (productClassIds != null) {
            for (int i = 0; i < productClassIds.length; i++) {
                ProductClass productClass = new ProductClass();
                productClass = ProductClassDAO.load(getAdminBean(request).getSite().getSiteId(), Format.getLong(productClassIds[i]));
                if (productClass.getSystemRecord() == Constants.VALUE_YES) {
                  continue;
                }
                em.remove(productClass);
            }
            em.getTransaction().commit();
View Full Code Here

      customerClass.setRecCreateBy(userId);
      customerClass.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      customerClass.setSite(site);
      em.persist(customerClass);

      ProductClass productClass = new ProductClass();
      productClass.setProductClassName(Constants.PRODUCT_CLASS_REGULAR);
      productClass.setSystemRecord(Constants.VALUE_YES);
      productClass.setRecUpdateBy(userId);
      productClass.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
      productClass.setRecCreateBy(userId);
      productClass.setRecCreateDatetime(new Date(System.currentTimeMillis()));
      productClass.setSite(site);
      em.persist(productClass);

      ShippingType shippingType = new ShippingType();
      shippingType.setShippingTypeName(Constants.SHIPPING_TYPE_REGULAR);
      shippingType.setSystemRecord(Constants.VALUE_YES);
View Full Code Here

public class ProductClassDAO extends ProductClass {
  private static final long serialVersionUID = -5190472179467443342L;

  public static ProductClass load(String siteId, Long productClassId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
    ProductClass productClass = (ProductClass) em.find(ProductClass.class, productClassId);
    if (!productClass.getSite().getSiteId().equals(siteId)) {
      throw new SecurityException();
    }
    return productClass;
  }
View Full Code Here

                     "and   productClassName = :productClassName");
      query.setParameter("siteId", siteId);
      query.setParameter("productClassName", productClassName);
      Iterator<?> iterator = query.getResultList().iterator();
      if (iterator.hasNext()) {
        ProductClass productClass = (ProductClass) iterator.next();
        return productClass;
      }
      return null;
  }
View Full Code Here

    if (taxRegionList.length == 0) {
      return itemTaxes;
    }
    Vector<ItemTax> vector = new Vector<ItemTax>();
    for (TaxRegion taxRegion : taxRegionList) {
      ProductClass shippingProductClass = taxRegion.getShippingProductClass();
      if (shippingProductClass == null) {
        continue;
      }
      TaxRegion list[] = {taxRegion};
      ItemTax taxes[] = calcTaxes(shippingProductClass.getProductClassId(), list, shippingAmount);
      for (ItemTax itemTax : taxes) {
        Enumeration<ItemTax> enumeration = vector.elements();
        boolean found = false;
        while (enumeration.hasMoreElements()) {
          ItemTax masterTax = (ItemTax) enumeration.nextElement();
View Full Code Here

TOP

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

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.