Package com.jada.jpa.entity

Examples of com.jada.jpa.entity.Language


      Query query = em.createQuery(sql);
      Iterator<?> iterator = query.getResultList().iterator();
      Vector<LabelValueBean> vector = new Vector<LabelValueBean>();
      vector.add(new LabelValueBean("", ""));
      while (iterator.hasNext()) {
        Language language = (Language) iterator.next();
        LabelValueBean bean = new LabelValueBean(language.getLangName(), language.getLangId().toString());
        vector.add(bean);
      }
      LabelValueBean languages[] = new LabelValueBean[vector.size()];
      vector.copyInto(languages);
      form.setLanguages(languages);
View Full Code Here


   
    Hashtable<Long, Language> langTable = new Hashtable<Long, Language>();
    Vector<Language> languageVector = new Vector<Language>();
    Query query = em.createQuery("from Language");
    for (Iterator<?> iterator = query.getResultList().iterator(); iterator.hasNext();) {
      Language language = (Language) iterator.next();
      language.getTranslations().size();
      languageVector.add(language);
      langTable.put(language.getLangId(), language);
    }
    Language languages[] = new Language[languageVector.size()];
    languageVector.copyInto(languages);

    LabelValueBean beans[] = loadKeyFromProperties();
    englishValues = new Properties();
    for (LabelValueBean bean : beans) {
View Full Code Here

    }
    table = langTable;
  }
 
  public static String getLangTranValue(Long langId, String langTranKey) {
    Language language = (Language) table.get(langId);
    Iterator<?> iterator = language.getTranslations().iterator();
    while (iterator.hasNext()) {
      LanguageTranslation translation = (LanguageTranslation) iterator.next();
      if (translation.getLangTranKey().equals(langTranKey)) {
        return translation.getLangTranValue();
      }
View Full Code Here

    }
    return null;
  }
 
  public static String getLangTranValueByEnglishValue(Long langId, String langTranValue) throws Exception {
    Language language = (Language) table.get(langId);
    String langTranKey = (String) englishValues.get(langTranValue);
    Iterator<?> iterator = language.getTranslations().iterator();
   
    iterator = language.getTranslations().iterator();
    while (iterator.hasNext()) {
      LanguageTranslation translation = (LanguageTranslation) iterator.next();
      if (translation.getLangTranKey().equals(langTranKey)) {
        return translation.getLangTranValue();
      }
View Full Code Here

   
    SiteProfileClass siteProfileClass = new SiteProfileClass();
    siteProfileClass.setSiteProfileClassName("English");
    siteProfileClass.setSiteProfileClassNativeName("English");
    siteProfileClass.setSite(site);
    Language language = LanguageDAO.loadByLanguageName("English");
    siteProfileClass.setLanguage(language);
    siteProfileClass.setSystemRecord(Constants.VALUE_YES);
    siteProfileClass.setRecUpdateBy(userId);
    siteProfileClass.setRecUpdateDatetime(new Date(System.currentTimeMillis()));
    siteProfileClass.setRecCreateBy(userId);
View Full Code Here

  DateFormat datetimeFormatter = null;
  DateFormat fullDateFormatter = null;
  DateFormat fullDatetimeFormatter = null;

  public Formatter(SiteProfile siteProfile, SiteCurrency siteCurrency) {
      Language language = siteProfile.getSiteProfileClass().getLanguage();
      rawDecimalFormatter = NumberFormat.getInstance(new Locale("en", "US"));
      rawDecimalFormatter.setMinimumFractionDigits(2);
      Locale locale = new Locale(language.getLangLocaleLanguage(), language.getLangLocaleCountry());
      numberFormatter = NumberFormat.getInstance(locale);
      numberFormatter.setMinimumFractionDigits(0);
      decimalFormatter = NumberFormat.getInstance(locale);
      decimalFormatter.setMinimumFractionDigits(2);
      dateFormatter = DateFormat.getDateInstance(DateFormat.MEDIUM, locale);
View Full Code Here

public class LanguageDAO extends Language {
  private static final long serialVersionUID = 8230455424732766612L;

  public static Language load(Long langId) throws SecurityException, Exception {
      EntityManager em = JpaConnection.getInstance().getCurrentEntityManager();
      Language language = (Language) em.find(Language.class, langId);
    return language;
  }
View Full Code Here

          }
          itemAttributeInfos.add(itemAttributeInfo);
        }
      }
     
        Language language = contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getLanguage();
          String itemNauralKeys[] = form.getItemNaturalKeys();
          if (itemNauralKeys != null) {
            for (int i = 0; i < itemNauralKeys.length; i++) {
              Item item = DataApi.getInstance().getItem(site.getSiteId(), itemNauralKeys[i]);
              try {
              if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_RECOMMAND_BUNDLE)) {
                for (Item child : item.getChildren()) {
                  shoppingCart.setItemQty(child, 1, itemAttributeInfos, contentBean, false);
                }
              }
              else if (item.getItemTypeCd().equals(Constants.ITEM_TYPE_TEMPLATE)) {
                item = getItem(form, site.getSiteId());
                shoppingCart.setItemQty(item, 1, itemAttributeInfos, contentBean, false);
              }
              else {
                shoppingCart.setItemQty(item, 1, itemAttributeInfos, contentBean, false);
              }
              } catch (ItemNotAvailiableException itemNotAvailiableException) {
                String value = Languages.getLangTranValue(language.getLangId(), "content.text.itemQuatityNotAvailable");
              ShoppingCartItemBean itemInfo = (ShoppingCartItemBean) form.getShoppingCartItemInfos().elementAt(i);
              itemInfo.setItemQtyError(value);
              }
            }
          }
View Full Code Here

    }

    public boolean validateUpdateQty(ShoppingCartActionForm form, ContentBean contentBean) throws Exception {
      boolean hasError = false;
      String itemQtys[] = form.getItemQtys();
      Language language = contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getLanguage();
      if (itemQtys != null) {
        for (int i = 0; i < itemQtys.length; i++) {
          ShoppingCartItemBean itemInfo = (ShoppingCartItemBean) form.getShoppingCartItemInfos().elementAt(i);
          if (itemQtys[i].trim().length() == 0) {
            continue;
          }
          if (!Format.isInt(itemQtys[i])) {
            hasError = true;
            String value = Languages.getLangTranValue(language.getLangId(), "content.error.int.invalid");
            itemInfo.setItemQtyError(value);
          }
          else {
            int intValue = Format.getInt(itemQtys[i]);
            if (intValue < 0) {
              hasError = true;
              String value = Languages.getLangTranValue(language.getLangId(), "content.error.int.invalid");
              itemInfo.setItemQtyError(value);
            }
          }
        }
      }
View Full Code Here

      ShoppingCartActionForm form = (ShoppingCartActionForm) actionForm;
      ShoppingCart shoppingCart = ShoppingCart.getSessionInstance(request, true);
      ActionMessages messages = new ActionMessages();
    this.initAddressInfo(form, site, shoppingCart, request, messages);
      this.initCartInfo(form, site, shoppingCart, request, messages);
      Language language = contentBean.getContentSessionBean().getSiteProfile().getSiteProfileClass().getLanguage();
      boolean hasError = validateUpdateQty(form, getContentBean(request));
      if (hasError) {
          String itemNaturalKeys[] = form.getItemNaturalKeys();
          String itemQtys[] = form.getItemQtys();
        for (int i = 0; i < itemNaturalKeys.length; i++) {
          ShoppingCartItemBean bean = (ShoppingCartItemBean) form.getShoppingCartItemInfos().elementAt(i);
          bean.setItemQty(itemQtys[i]);
        }
      }
      else {
          String itemNaturalKeys[] = form.getItemNaturalKeys();
          String itemQtys[] = form.getItemQtys();
          if (itemNaturalKeys != null) {
            for (int i = 0; i < itemNaturalKeys.length; i++) {
              int qty = 0;
              if (itemQtys[i].trim().length() != 0) {
                qty = Format.getInt(itemQtys[i]);
              }
          Item item = DataApi.getInstance().getItem(site.getSiteId(), itemNaturalKeys[i]);
          try {
            shoppingCart.setItemQty(item, qty, null, contentBean, true);
            } catch (ItemNotAvailiableException itemNotAvailiableException) {
              String value = Languages.getLangTranValue(language.getLangId(), "content.text.itemQuatityNotAvailable");
              ShoppingCartItemBean itemInfo = (ShoppingCartItemBean) form.getShoppingCartItemInfos().elementAt(i);
              itemInfo.setItemQtyError(value);
              hasError = true;
            }
            }
View Full Code Here

TOP

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

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.