Regalamiunsorriso/decompiled-libs/www/cli-rus-2.1.9/it/acxent/pg/servlet/Foto2Svlt.java

115 lines
4.2 KiB
Java

package it.acxent.pg.servlet;
import it.acxent.db.CRAdapter;
import it.acxent.db.DBAdapter;
import it.acxent.pg.Foto;
import it.acxent.pg.FotoCR;
import it.acxent.pg.PuntoFoto;
import it.acxent.pg.Users;
import it.acxent.pg.XFotoGara;
import it.acxent.util.Vectumerator;
import javax.servlet.RequestDispatcher;
import javax.servlet.ServletRequest;
import javax.servlet.ServletResponse;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class Foto2Svlt extends _PgPageSvlt {
private static final long serialVersionUID = -3730505807508646299L;
public static final String SESS_FLG_VISTA_COMPATTA = "_FVC";
protected void caricaCombo(HttpServletRequest req, HttpServletResponse res) {}
protected void chiamaJsp(HttpServletRequest req, HttpServletResponse res) {
setJspPageRelative("fotoCR.jsp", req);
try {
caricaCombo(req, res);
RequestDispatcher rd = getServletContext().getRequestDispatcher(getJspPage(req));
rd.forward((ServletRequest)req, (ServletResponse)res);
} catch (Exception e) {
handleDebug(e);
}
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
search(req, res);
}
protected void print(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
XFotoGara bean = (XFotoGara)beanA;
}
protected void fillComboAfterSearch(CRAdapter CRA, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Foto(getApFull());
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new FotoCR(getApFull());
}
protected void search(HttpServletRequest req, HttpServletResponse res) {
try {
FotoCR CR = new FotoCR(getApFull());
Users user = new Users(getApFull(req));
user.findByPrimaryKey(getLoginUserId(req));
req.setAttribute("user", user);
if (getAct(req).equals("back")) {
CR = (FotoCR)req.getSession().getAttribute("CR_FOTO");
if (CR.getPageNumber() > 0)
req.setAttribute("pageNumber", String.valueOf(CR.getPageNumber()));
} else {
fillObject(req, CR);
}
long FVC = (req.getSession().getAttribute("_FVC") == null) ? 0L :
Long.parseLong((String)req.getSession().getAttribute("_FVC"));
if (CR.getFlgVisCompattaS().endsWith("C")) {
FVC = 1L;
req.getSession().setAttribute("_FVC", "1");
} else if (CR.getFlgVisCompattaS().endsWith("E")) {
FVC = 0L;
req.getSession().setAttribute("_FVC", "0");
}
CR.setFlgVisCompatta(FVC);
if (CR.getId_gara() != 0L) {
int l_pageRow = CR.getPageRow();
req.setAttribute("listaTipiPuntoFoto", new PuntoFoto(getApFull()).findTipiPuntoFoto(CR.getId_gara()));
req.setAttribute("listaPuntiFoto", new PuntoFoto(getApFull()).findPuntiFotoByGara(CR.getId_gara(), 0, 0));
req.getSession().setAttribute("id_gara", String.valueOf(CR.getId_gara()));
req.setAttribute("CR", CR);
req.setAttribute("bean", CR.getGara());
req.getSession().setAttribute("CR_FOTO", CR);
Vectumerator<Foto> list = new Foto(getApFull()).findByCR(CR, getPageNumber(req), l_pageRow);
DBAdapter.printDebug(true, "" + list.getTotNumberOfRecords() + " foto trovate con CR Foto");
req.setAttribute("list", list);
}
chiamaJsp(req, res);
} catch (Exception e) {
handleDebug(e);
}
}
public void _mostraFoto(HttpServletRequest req, HttpServletResponse res) {
Foto bean = new Foto(getApFull());
long l_id_foto = getRequestLongParameter(req, "id_foto");
bean.findByPrimaryKey(l_id_foto);
req.setAttribute("bean", bean);
Users user = new Users(getApFull(req));
user.findByPrimaryKey(getLoginUserId(req));
req.setAttribute("user", user);
setJspPage("/fotoView.jsp", req);
callJsp(req, res);
}
public void _vistaEstesa(HttpServletRequest req, HttpServletResponse res) {
req.getSession().setAttribute("_FVC", "0");
}
public void _vistaCompatta(HttpServletRequest req, HttpServletResponse res) {
req.getSession().setAttribute("_FVC", "1");
}
}