Examples of FieldLanguage


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

    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

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

      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

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

    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

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

      log.debug("users_id: "+users_id);
      log.debug("user_level: "+user_level);
     
      if (user_level!=null && user_level > 0) {
        FieldLanguage fl = FieldLanguageDaoImpl.getInstance().getFieldLanguageById(language_id);

        List<Fieldvalues> fvList = Fieldmanagment.getInstance().getMixedFieldValuesList(language_id);
       
        if (fl!=null && fvList!=null) {
          Document doc = this.createDocument(fvList);
         
          String requestedFile = fl.getName()+".xml";
         
          httpServletResponse.reset();
          httpServletResponse.resetBuffer();
          OutputStream out = httpServletResponse.getOutputStream();
          httpServletResponse.setContentType("APPLICATION/OCTET-STREAM");
View Full Code Here

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

      Object idf = PersistenceSessionUtil.createSession();
      EntityManager session = PersistenceSessionUtil.getSession();
      EntityTransaction tx = session.getTransaction();
      tx.begin();

      FieldLanguage fl = new FieldLanguage();
      fl.setStarttime(new Date());
      fl.setDeleted("false");
      fl.setName(langName);
      fl.setRtl(langRtl);

      fl = session.merge(fl);
      session.flush();
      Long languages_id = fl.getLanguage_id();

      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
     
      return languages_id;
View Full Code Here

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

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

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

      EntityTransaction tx = session.getTransaction();
      tx.begin();
      Query query = session.createQuery(hql);
      query.setParameter("deleted", "true");
      query.setParameter("language_id", language_id);
      FieldLanguage fl = null;
      try {
        fl = (FieldLanguage) query.getSingleResult();
          } catch (NoResultException ex) {
          }
      tx.commit();
View Full Code Here

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

          } catch (NoResultException ex) {
          }
      tx.commit();
      PersistenceSessionUtil.closeSession(idf);
     
      FieldLanguage fieldLanguage = FieldLanguageDaoImpl.getInstance().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

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

          map.put("id", fl.getFieldvalues_id());
          map.put("value", fl.getValue());
          returnList.add(map);
        }
      }
      FieldLanguage fieldLanguage = FieldLanguageDaoImpl.getInstance().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> returnRtlList = new LinkedList<Map>();
        //List<Fieldlanguagesvalues> returnRtlList = new LinkedList<Fieldlanguagesvalues>();
       
View Full Code Here

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

//        log.debug("IDs: "+flang.getFieldlanguagesvalues_id()+" "+flang.getFieldvalues_id());
//       
//      }
     
     
      FieldLanguage fieldLanguage = FieldLanguageDaoImpl.getInstance().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
TOP
Copyright © 2018 www.massapi.com. 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.