Package org.apache.openmeetings.persistence.beans.lang

Examples of org.apache.openmeetings.persistence.beans.lang.FieldLanguage


  private static final long serialVersionUID = -6237917782433412496L;

  public BasePage() {
    String appName = Application.getBean(ConfigurationDao.class).getAppName();

    FieldLanguage lang = WebSession.getLanguageObj();
    String code = lang.getCode();
    add(new TransparentWebMarkupContainer("html")
        .add(new AttributeModifier("xml:lang", code))
        .add(new AttributeModifier("lang", code))
        .add(new AttributeModifier("dir", Boolean.TRUE.equals(lang.getRtl()) ? "rtl" : "ltr")));
    add(new Label("pageTitle", appName));
    add(new HeaderPanel("header", appName));
  }
View Full Code Here


      try {
        flv = performReplace(query.getSingleResult());
      } catch (NoResultException ex) {
      }

      FieldLanguage fieldLanguage = fieldLanguageDaoImpl
          .getFieldLanguageById(language_id);

      log.debug("Getting FieldById for Language "
          + fieldLanguage.getName());

      // Check for Right To Left Languages
      if (fieldLanguage.getRtl()) {

        log.debug("Language requieres RTL");

        Fieldlanguagesvalues remote = flv;
        Fieldlanguagesvalues toAdd = new Fieldlanguagesvalues();
View Full Code Here

        Object[] row = (Object[])fl;
        map.put("id", row[0]);
        map.put("value", performReplace((String)row[1], appName));
        returnList.add(map);
      }
      FieldLanguage fieldLanguage = fieldLanguageDaoImpl
          .getFieldLanguageById(language_id);

      log.debug("Getting Labels for Language " + fieldLanguage.getName());

      // Check for Right To Left Languages
      if (fieldLanguage.getRtl()) {
        log.debug("Language requieres RTL!");

        List<Map<String, Object>> returnRtlList = new LinkedList<Map<String, Object>>();

        for (Iterator<Map<String, Object>> iter = returnList.iterator(); iter
View Full Code Here

      query.setParameter("language_id", language_id);
      query.setParameter("start", start);
      query.setParameter("max", start + max);

      List<Fieldlanguagesvalues> returnList = performReplace(query.getResultList());
      FieldLanguage fieldLanguage = fieldLanguageDaoImpl
          .getFieldLanguageById(language_id);

      log.debug("GEtting all fields by language : "
          + fieldLanguage.getName());

      // Check for Right To Left Languages
      if (fieldLanguage.getRtl()) {
        log.debug("language : " + fieldLanguage.getName()
            + " requieres RTL");

        List<Fieldlanguagesvalues> returnRtlList = new LinkedList<Fieldlanguagesvalues>();

        for (Iterator<Fieldlanguagesvalues> iter = returnList
            .iterator(); iter.hasNext();) {
          Fieldlanguagesvalues remote = iter.next();
          Fieldlanguagesvalues toAdd = new Fieldlanguagesvalues();
          toAdd.setFieldlanguagesvalues_id(remote
              .getFieldlanguagesvalues_id());
          toAdd.setFieldvalues_id(remote.getFieldvalues_id());
          toAdd.setLanguage_id(remote.getLanguage_id());

          String[] splitted = remote.getValue().split(" ");
          String reverseOrder = "";
          for (int i = splitted.length - 1; i >= 0; i--) {
            reverseOrder += splitted[i];
            if (splitted.length != 1) {
              reverseOrder += " ";
            }
          }
          toAdd.setValue(reverseOrder);

          returnRtlList.add(toAdd);
        }

        return returnRtlList;
      } else {
        log.debug("language : " + fieldLanguage.getName()
            + " requieres NO RTL");

        return returnList;

      }
View Full Code Here

      @Override
      public void onSubmit(AjaxRequestTarget target, Form<?> form) {
        FieldLanguageDao langDao = Application.getBean(FieldLanguageDao.class);
       
        FieldLanguage fl = new FieldLanguage();
        fl.setLanguage_id(langDao.getNextAvailableId());
        fl.setStarttime(new Date());
        fl.setDeleted(false);
        fl.setName(newLanguageName);
        fl.setRtl(false); //FIXME
        fl.setCode(newLanguageISO);
       
        try {
          langDao.updateLanguage(fl);
        } catch (Exception e) {
          // TODO add feedback message
View Full Code Here

    Long users_id = sessiondataDao.checkSession(SID);
    Long user_level = userManager.getUserLevelByID(users_id);
    if (authLevelUtil.checkAdminLevel(user_level)) {
      if (langName.length() == 0)
        return new Long(-30);
      FieldLanguage lang = fieldLanguageDaoImpl.addLanguage(0, langName, false, code);
      return lang != null ? lang.getLanguage_id() : -1;
    }
    return null;
  }
View Full Code Here

    if (rtl != null && rtl.equals("true"))
      langRtl = true;

    long ticks = System.currentTimeMillis();
    FieldLanguage lang = fieldLanguageDaoImpl.addLanguage(langId, langName,
        langRtl, code);

    SAXReader reader = new SAXReader();
    Document document = reader.read(new File(
        OmFileHelper.getLanguagesDir(), langName + ".xml"));

    Element root = document.getRootElement();

    Map<Long, Fieldlanguagesvalues> flvMap = lang.getLanguageValuesMap();
    for (@SuppressWarnings("rawtypes")
    Iterator it = root.elementIterator("string"); it.hasNext();) {
      Element item = (Element) it.next();
      // log.error(item.getName());

      Long id = Long.valueOf(item.attributeValue("id")).longValue();
      String name = item.attributeValue("name");
      String value = "";

      for (@SuppressWarnings("rawtypes")
      Iterator t2 = item.elementIterator("value"); t2.hasNext();) {
        Element val = (Element) t2.next();
        value = val.getText();
      }

      // log.error("result: "+langFieldIdIsInited+" "+id+" "+name+" "+value);

      if (flvMap.containsKey(id)) {
        Fieldlanguagesvalues flv = flvMap.get(id);
        flv.setUpdatetime(new Date());
        flv.setValue(value);
      } else {
        Fieldvalues fv = null;
        // Only do that for the first field-set
        if (!fieldCache.containsKey(id)) {
          fv = fieldManager.addFieldById(name, id);
          fieldCache.put(id, fv);
        } else {
          fv = fieldCache.get(id);
        }
        Fieldlanguagesvalues flv = new Fieldlanguagesvalues();
        flv.setStarttime(new Date());
        flv.setValue(value);
        flv.setLanguage_id(lang.getLanguage_id());
        flv.setFieldvalues(fv);
        flv.setDeleted(false);
        flvMap.put(id, flv);
      }
    }
    lang.setLanguageValues(flvMap.values());
    fieldLanguageDaoImpl.updateLanguage(lang);
    log.debug("Lang ADDED: " + lang + "; seconds passed: "
        + (System.currentTimeMillis() - ticks) / 1000);
  }
View Full Code Here

      log.debug("users_id: " + users_id);
      log.debug("user_level: " + user_level);

      if (user_level != null && user_level > 0) {
        FieldLanguage fl = getBean(FieldLanguageDao.class)
            .getFieldLanguageById(language_id);

        List<Fieldlanguagesvalues> flvList = getBean(FieldManager.class).getMixedFieldValuesList(language_id);

        if (fl != null && flvList != null) {
          Document doc = createDocument(flvList, getBean(FieldManager.class).getUntranslatedFieldValuesList(language_id));

          String requestedFile = fl.getName() + ".xml";

          httpServletResponse.reset();
          httpServletResponse.resetBuffer();
          OutputStream out = httpServletResponse.getOutputStream();
          httpServletResponse
View Full Code Here

    return q.getSingleResult() + 1;
  }
 
  public FieldLanguage addLanguage(int langId, String langName, Boolean langRtl, String code) {
    try {
      FieldLanguage fl = new FieldLanguage();
      fl.setLanguage_id((long)langId);
      fl.setStarttime(new Date());
      fl.setDeleted(false);
      fl.setName(langName);
      fl.setRtl(langRtl);
      fl.setCode(code);

      fl = em.merge(fl);

      //Eagerly FETCH values list
      TypedQuery<FieldLanguage> q = em.createQuery("select fl from FieldLanguage fl LEFT JOIN FETCH fl.languageValues WHERE fl.language_id = :langId", FieldLanguage.class);
View Full Code Here

  }

  public Long updateFieldLanguage(Long language_id, String langName,
      String code, boolean deleted) {
    try {
      FieldLanguage fl = this.getFieldLanguageById(language_id);
      fl.setUpdatetime(new Date());
      if (langName.length() > 0)
        fl.setName(langName);
      if (code.length() > 0)
        fl.setCode(code);
      fl.setDeleted(deleted);
      this.updateLanguage(fl);
      return language_id;
    } catch (Exception ex2) {
      log.error("[updateLanguage]: ", ex2);
    }
View Full Code Here

TOP

Related Classes of org.apache.openmeetings.persistence.beans.lang.FieldLanguage

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.