Ejemplo n.º 1
0
  public List<Fieldvalues> get(Long language_id, String search, int start, int count, String sort) {
    String sql =
        DaoHelper.getSearchQuery(
            "Fieldlanguagesvalues",
            "flv",
            search,
            true,
            false,
            "flv.fieldvalues.deleted = false AND flv.language_id = :lang",
            sort,
            searchFields);
    TypedQuery<Fieldlanguagesvalues> q = em.createQuery(sql, Fieldlanguagesvalues.class);
    q.setParameter("lang", language_id);
    q.setFirstResult(start);
    q.setMaxResults(count);

    // now lets create the list of Fieldvalues
    List<Fieldlanguagesvalues> flvList = q.getResultList();
    List<Fieldvalues> r = new ArrayList<Fieldvalues>(flvList.size());
    for (Fieldlanguagesvalues flv : flvList) {
      Fieldvalues fv = flv.getFieldvalues();
      fv.setFieldlanguagesvalue(flv);
      r.add(fv);
    }
    return r;
  }
Ejemplo n.º 2
0
 @Override
 protected void onNewSubmit(AjaxRequestTarget target, Form<?> f) {
   Fieldlanguagesvalues flv = new Fieldlanguagesvalues();
   flv.setLanguage_id(panel.language.getLanguage_id());
   this.setModelObject(flv);
   target.add(this);
   target.appendJavaScript("labelsInit();");
 }
Ejemplo n.º 3
0
  @Override
  protected void onSaveSubmit(AjaxRequestTarget target, Form<?> form) {
    Fieldlanguagesvalues flv = getModelObject();
    Fieldvalues fv = flv.getFieldvalues();
    Application.getBean(FieldValueDao.class).update(fv, WebSession.getUserId());

    flv.setFieldvalues(fv);
    Application.getBean(FieldLanguagesValuesDao.class).update(flv, WebSession.getUserId());
    hideNewRecord();
    target.add(panel.listContainer);
    target.appendJavaScript("labelsInit();");
  }
Ejemplo n.º 4
0
 @Override
 protected void onRefreshSubmit(AjaxRequestTarget target, Form<?> form) {
   Fieldlanguagesvalues flv = getModelObject();
   if (flv.getFieldlanguagesvalues_id() != null) {
     flv =
         Application.getBean(FieldLanguagesValuesDao.class)
             .get(getModelObject().getFieldlanguagesvalues_id());
   } else {
     flv = new Fieldlanguagesvalues();
   }
   this.setModelObject(flv);
   target.add(this);
   target.appendJavaScript("labelsInit();");
 }
Ejemplo n.º 5
0
 public List<Fieldvalues> get(Long language_id, int start, int count) {
   TypedQuery<Fieldvalues> q = em.createNamedQuery("getFieldByLanguage", Fieldvalues.class);
   // q.setParameter("lang", language_id); //FIXME commented for now
   q.setFirstResult(start);
   q.setMaxResults(count);
   List<Fieldvalues> result = q.getResultList();
   for (Fieldvalues fv : result) {
     // FIXME ineffective !!!!!!!!!!!!!!!!!!!!
     Fieldlanguagesvalues flv = flvDaoImpl.get(fv.getFieldvalues_id(), language_id);
     if (flv == null) {
       flv = new Fieldlanguagesvalues();
       flv.setLanguage_id(language_id);
       flv.setFieldvalues(fv);
     }
     fv.setFieldlanguagesvalue(flv);
   }
   return result;
 }