/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package action;
import bo.Geolog;
import net.sourceforge.stripes.action.DefaultHandler;
import net.sourceforge.stripes.action.ForwardResolution;
import net.sourceforge.stripes.action.Resolution;
import dao.GeologDao;
import daoI.IGeologDao;
import java.util.List;
public class GeologiActionBean extends BaseActionBean {
private List<Geolog> geologi;
private List<Geolog> geologiIA;
private List validareR;
private List refuzareR;
private Geolog geolog;
private List stergeR;
private List<Geolog> geologiPtStergere;
public List getGeologi() {
return geologi;
}
@DefaultHandler
public Resolution afisareGeologi() {
IGeologDao geolog = new GeologDao();
geologi = geolog.getAll();
return new ForwardResolution("/WEB-INF/jsp/geologi.jsp");
}
public Resolution validareConturi() {
IGeologDao geolog = new GeologDao();
geologiIA = geolog.getAllNVGeo();
return new ForwardResolution("/WEB-INF/jsp/validareConturi.jsp");
}
public Resolution stergereConturiGeologi() {
IGeologDao geologDao = new GeologDao();
geologiPtStergere = geologDao.getGeologiPtStergere();
return new ForwardResolution("/WEB-INF/jsp/stergereConturiGeologi.jsp");
}
public Resolution submitStergere() {
IGeologDao geologDao = new GeologDao();
int i;
if (getStergeR() != null) {
for (i = 0; i < getStergeR().size(); i++) {
geologDao.delete(Integer.parseInt(getStergeR().get(i).toString()));
}
}
IGeologDao geolog = new GeologDao();
geologiPtStergere = geologDao.getGeologiPtStergere();
return new ForwardResolution("/WEB-INF/jsp/stergereConturiGeologi.jsp");
}
public Resolution datePersonale() {
IGeologDao geologDao = new GeologDao();
int idGeo = Integer.parseInt(getContext().getRequest().getSession(true).getAttribute("user").toString());
setGeolog(geologDao.getGeologByID(idGeo));
return new ForwardResolution("/WEB-INF/jsp/datePersonale.jsp");
}
public Resolution submitDatePersonale() {
IGeologDao geologDao = new GeologDao();
geologDao.saveOrUpdate(getGeolog());
return new ForwardResolution("/WEB-INF/jsp/datePersonale.jsp");
}
public Resolution submit() {
IGeologDao geologDao = new GeologDao();
Geolog g;
int i;
if (getValidareR() != null) {
for (i = 0; i < getValidareR().size(); i++) {
g = geologDao.getGeologByID(Integer.parseInt(getValidareR().get(i).toString()));
g.setConfirmare("acceptat");
geologDao.saveOrUpdate(g);
}
}
if (getRefuzareR() != null) {
for (i = 0; i < getRefuzareR().size(); i++) {
g = geologDao.getGeologByID(Integer.parseInt(getRefuzareR().get(i).toString()));
g.setConfirmare("refuzat");
geologDao.saveOrUpdate(g);
}
}
// pt popularea listei pt stergere
geologiPtStergere = geologDao.getGeologiPtStergere();
return new ForwardResolution("/WEB-INF/jsp/stergereConturiGeologi.jsp");
}
public Resolution logout() {
getContext().getRequest().getSession(true).setAttribute("user", 0);
return new ForwardResolution("/WEB-INF/jsp/home.jsp");
}
public boolean getGeologiIAIsNotNull() {
if (getGeologiIA().size() > 0) {
return true;
} else {
return false;
}
}
/**
* @return the geologiIA
*/
public List<Geolog> getGeologiIA() {
return geologiIA;
}
/**
* @param geologiIA the geologiIA to set
*/
public void setGeologiIA(List<Geolog> geologiIA) {
this.geologiIA = geologiIA;
}
/**
* @return the validareR
*/
public List getValidareR() {
return validareR;
}
/**
* @param validareR the validareR to set
*/
public void setValidareR(List validareR) {
this.validareR = validareR;
}
/**
* @return the refuzareR
*/
public List getRefuzareR() {
return refuzareR;
}
/**
* @param refuzareR the refuzareR to set
*/
public void setRefuzareR(List refuzareR) {
this.refuzareR = refuzareR;
}
/**
* @return the geolog
*/
public Geolog getGeolog() {
return geolog;
}
/**
* @param geolog the geolog to set
*/
public void setGeolog(Geolog geolog) {
this.geolog = geolog;
}
/**
* @return the stergeR
*/
public List getStergeR() {
return stergeR;
}
/**
* @param stergeR the stergeR to set
*/
public void setStergeR(List stergeR) {
this.stergeR = stergeR;
}
public boolean getExistaGeologiPtStergere() {
if (getGeologiPtStergere() != null && getGeologiPtStergere().size() > 0) {
return true;
} else {
return false;
}
}
/**
* @return the geologiPtStergere
*/
public List<Geolog> getGeologiPtStergere() {
return geologiPtStergere;
}
/**
* @param geologiPtStergere the geologiPtStergere to set
*/
public void setGeologiPtStergere(List<Geolog> geologiPtStergere) {
this.geologiPtStergere = geologiPtStergere;
}
}