# Init

Se carga el DataModel con los registros indicados en page y rowPage

```java
 @PostConstruct
    public void init() {
        try {

            writable = false;

            bodegaList = new ArrayList<>();
            bodegaFiltered = new ArrayList<>();
            bodega = new Bodega();
            bodegaDataModel = new BodegaDataModel(bodegaList);
            String idbodega = FacesContext.getCurrentInstance().getExternalContext().getRequestParameterMap().get("idbodega");

            if (idbodega != null) {
                Optional<Bodega> optional = bodegaRepository.find("idbodega", idbodega);
                if (optional.isPresent()) {
                    bodega = optional.get();
                    bodegaSelected = bodega;
                    writable = true;
                    RequestContext.getCurrentInstance().update(":form:content");
                }
            } else {

                if (FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("pagebodega") != null) {
                    String temp = FacesContext.getCurrentInstance().getExternalContext().getSessionMap().get("pagebodega").toString();
                    if (temp != null) {
                        page = Integer.parseInt(temp);
                        Integer c = bodegaRepository.sizeOfPage(rowPage);
                        page = page > c ? c : page;

                    }

                }
                move();

            }

        } catch (Exception e) {
            JsfUtil.errorMessage("init() " + e.getLocalizedMessage());
        }
    }// </editor-fold>
```
