Package sn.unitech.stock.bean

Source Code of sn.unitech.stock.bean.SysGroupProdBean$AllRefs

package sn.unitech.stock.bean;

import java.io.Serializable;
import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import javax.faces.bean.ManagedBean;
import javax.faces.bean.ViewScoped;
import javax.faces.event.ActionEvent;
import javax.faces.model.DataModel;
import javax.faces.model.ListDataModel;

import sn.unitech.common.dao.ReadProperties;
import sn.unitech.stock.entity.SysActivite;
import sn.unitech.stock.entity.SysAdherGroupProd;
import sn.unitech.stock.entity.SysGroupProd;
import sn.unitech.stock.entity.SysProduit;
import sn.unitech.stock.metier.SysGroupProdM;
import sn.unitech.stock.metier.iface.ISysGroupProdM;

@ManagedBean
@ViewScoped
public class SysGroupProdBean implements Serializable{
 
  private ReadProperties readProperties=ReadProperties.getReadProperties();
  ISysGroupProdM sysGroupProdM =new SysGroupProdM<SysGroupProd>();
  private SysGroupProd sysGroupProd=new SysGroupProd();
  private SysAdherGroupProd sysAdherGroupProd=new SysAdherGroupProd();
  private AllRefs allRefs=new AllRefs() ;
  private CMessages cmessages =new CMessages();
  private CItems citems=new CItems();
  private Cproperties cproperties = citems;

  public SysGroupProdBean(){
   
  }

  ParamsUser getParamsUser(){ //alias
    return ((ParamsUser)ToolsBean.getToolsBean().getAttribute(ToolsBean.idParamUser));
  }

  public void saveClasseProduit(ActionEvent a){
    this.sysGroupProd.setSysActivite(new SysActivite(Integer.parseInt(this.cproperties.idActivite)));
    this.sysAdherGroupProd.setSysAdherent(getParamsUser().adherent);
    if(this.sysGroupProdM.saveGroupProduit(sysGroupProd,sysAdherGroupProd)){
    this.setSysGroupProd(new SysGroupProd());
    this.setSysAdherGroupProd(new SysAdherGroupProd());
    this.cmessages.setSaveMessage(ToolsBean.getToolsBean().getBundleMessage("msgSucces"));
    }else this.cmessages.setSaveMessage(ToolsBean.getToolsBean().getBundleMessage("msgEchec"));

  }

  public SysGroupProd getSysGroupProd() {
    return sysGroupProd;
  }

  public void setSysGroupProd(SysGroupProd sysGroupProd) {
    this.sysGroupProd = sysGroupProd;
  }

  public SysAdherGroupProd getSysAdherGroupProd() {
    return sysAdherGroupProd;
  }

  public void setSysAdherGroupProd(SysAdherGroupProd sysAdherGroupProd) {
    this.sysAdherGroupProd = sysAdherGroupProd;
  }
 
  public class Cproperties implements Serializable{
        String idActivite;
        boolean showActivite;
    public String getIdActivite() {
      return idActivite;
    }
    public void setIdActivite(String idActivite) {
      this.idActivite = idActivite;
    }
    public boolean isShowActivite() {
      return showActivite;
    }
    public void setShowActivite(boolean showActivite) {
      this.showActivite = showActivite;
    }
   
  }

  public class CItems extends Cproperties implements Serializable{

    Map<String,String> itemsAllActivite;
        DataModel<SysGroupProd>   dataListGroupProd=new ListDataModel<SysGroupProd>(new ArrayList<SysGroupProd>());

   
    public CItems(){
        itemsAllActivite=sysGroupProdM.findAllActivite(readProperties.read("FamilleProduit.jpqlActivite"),ToolsBean.getToolsBean().defaultParametter());
        this.showActivite=itemsAllActivite.size()>1;
        this.setIdActivite(itemsAllActivite.values().iterator().next());
    }

    public Map<String, String> getItemsAllActivite() {
      return itemsAllActivite;
    }

    public void setItemsAllActivite(Map<String, String> itemsAllActivite) {
      this.itemsAllActivite = itemsAllActivite;
    }

    public DataModel<SysGroupProd> getDataListGroupProd() {
      Map param=new HashMap<Integer,String>();
      param.put(0,getParamsUser().adherent.getIdAdherent());
      this.dataListGroupProd.setWrappedData((List<SysGroupProd>) sysGroupProdM.listGroupsProd(readProperties.read("FamilleProduit.jpqlAllGroupProd"),param));
      return dataListGroupProd;
    }

    public void setDataListGroupProd(DataModel<SysGroupProd> dataListGroupProd) {
      this.dataListGroupProd = dataListGroupProd;
    }
   
  }

  public class AllRefs implements Serializable{
   
  }

  public class CMessages implements Serializable{
      public String saveMessage;
     
    public String getSaveMessage() {
      return saveMessage;
    }

    public void setSaveMessage(String saveMessage) {
      this.saveMessage = saveMessage;
    }

  }

  public AllRefs getAllRefs() {
    return allRefs;
  }

  public void setAllRefs(AllRefs allRefs) {
    this.allRefs = allRefs;
  }

  public CMessages getCmessages() {
    return cmessages;
  }

  public void setCmessages(CMessages cmessages) {
    this.cmessages = cmessages;
  }

  public CItems getCitems() {
    return citems;
  }

  public void setCitems(CItems citems) {
    this.citems = citems;
  }

  public Cproperties getCproperties() {
    return cproperties;
  }

  public void setCproperties(Cproperties cproperties) {
    this.cproperties = cproperties;
  }

 
}
TOP

Related Classes of sn.unitech.stock.bean.SysGroupProdBean$AllRefs

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.