first commit
This commit is contained in:
commit
4d332ef662
27586 changed files with 3281783 additions and 0 deletions
378
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/Banner.java
Normal file
378
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/Banner.java
Normal file
|
|
@ -0,0 +1,378 @@
|
|||
package com.ablia.banner;
|
||||
|
||||
import com.ablia.anag.Clifor;
|
||||
import com.ablia.anag._AnagAdapter;
|
||||
import com.ablia.db.AddImgInterface;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.db.WcString;
|
||||
import com.ablia.util.StringTokenizer;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Date;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.util.Random;
|
||||
|
||||
public class Banner extends _AnagAdapter implements AddImgInterface, Serializable {
|
||||
private long id_banner;
|
||||
|
||||
private long id_tipoBanner;
|
||||
|
||||
private long flgAttivo;
|
||||
|
||||
private String descrizioneClifor;
|
||||
|
||||
private Date dataInizioCampagna;
|
||||
|
||||
private Date dataFineCampagna;
|
||||
|
||||
private long priorita;
|
||||
|
||||
private TipoBanner tipoBanner;
|
||||
|
||||
private Clifor clifor;
|
||||
|
||||
private long flgTipo;
|
||||
|
||||
private long impression;
|
||||
|
||||
private long clickThrough;
|
||||
|
||||
public Banner(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public static long TIPO_IMMAGINE = 0L;
|
||||
|
||||
public static long TIPO_TESTO = 1L;
|
||||
|
||||
private String link;
|
||||
|
||||
private String descrizioneBanner;
|
||||
|
||||
private String titolo;
|
||||
|
||||
private long id_clifor;
|
||||
|
||||
public Banner() {
|
||||
initFields();
|
||||
}
|
||||
|
||||
public void setId_banner(long newId_banner) {
|
||||
this.id_banner = newId_banner;
|
||||
}
|
||||
|
||||
public void setId_tipoBanner(long newId_tipoBanner) {
|
||||
this.id_tipoBanner = newId_tipoBanner;
|
||||
setTipoBanner(null);
|
||||
}
|
||||
|
||||
public void setId_clifor(long newId_clifor) {
|
||||
this.id_clifor = newId_clifor;
|
||||
setClifor(null);
|
||||
}
|
||||
|
||||
public void setLink(String newLink) {
|
||||
this.link = newLink;
|
||||
}
|
||||
|
||||
public void setDataInizioCampagna(Date newDataInizioCampagna) {
|
||||
this.dataInizioCampagna = newDataInizioCampagna;
|
||||
}
|
||||
|
||||
public void setDataFineCampagna(Date newDataFineCampagna) {
|
||||
this.dataFineCampagna = newDataFineCampagna;
|
||||
}
|
||||
|
||||
public void setPriorita(long newPeso) {
|
||||
this.priorita = newPeso;
|
||||
}
|
||||
|
||||
public long getId_banner() {
|
||||
return this.id_banner;
|
||||
}
|
||||
|
||||
public long getId_tipoBanner() {
|
||||
return this.id_tipoBanner;
|
||||
}
|
||||
|
||||
public long getId_clifor() {
|
||||
return this.id_clifor;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
if (this.link == null)
|
||||
return "";
|
||||
if (this.link.toLowerCase().startsWith("http://") || this.link.toLowerCase().startsWith("https://"))
|
||||
return this.link.trim();
|
||||
return "http://" + this.link.trim();
|
||||
}
|
||||
|
||||
public Date getDataInizioCampagna() {
|
||||
return this.dataInizioCampagna;
|
||||
}
|
||||
|
||||
public Date getDataFineCampagna() {
|
||||
return this.dataFineCampagna;
|
||||
}
|
||||
|
||||
public long getPriorita() {
|
||||
return this.priorita;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public void setTipoBanner(TipoBanner newTipoBanner) {
|
||||
this.tipoBanner = newTipoBanner;
|
||||
}
|
||||
|
||||
public TipoBanner getTipoBanner() {
|
||||
if (this.tipoBanner == null && getId_tipoBanner() != 0L)
|
||||
try {
|
||||
this.tipoBanner = new TipoBanner(getApFull());
|
||||
this.tipoBanner.findByPrimaryKey(new Long(getId_tipoBanner()));
|
||||
} catch (Exception e) {}
|
||||
return (this.tipoBanner == null) ? new TipoBanner() : this.tipoBanner;
|
||||
}
|
||||
|
||||
public void setClifor(Clifor newClifor) {
|
||||
this.clifor = newClifor;
|
||||
}
|
||||
|
||||
public Clifor getClifor() {
|
||||
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
|
||||
return this.clifor;
|
||||
}
|
||||
|
||||
public long getFlgAttivo() {
|
||||
return this.flgAttivo;
|
||||
}
|
||||
|
||||
public void setFlgAttivo(long flgAttivo) {
|
||||
this.flgAttivo = flgAttivo;
|
||||
}
|
||||
|
||||
public long getImpression() {
|
||||
return this.impression;
|
||||
}
|
||||
|
||||
public void setImpression(long impression) {
|
||||
this.impression = impression;
|
||||
}
|
||||
|
||||
public long getClickThrough() {
|
||||
return this.clickThrough;
|
||||
}
|
||||
|
||||
public void setClickThrough(long clickThrough) {
|
||||
this.clickThrough = clickThrough;
|
||||
}
|
||||
|
||||
public void addBannerStats(String l_entryPoint, String l_ip, String l_flgI_CT) {}
|
||||
|
||||
public String getTitolo() {
|
||||
return (this.titolo == null) ? "" : this.titolo.trim();
|
||||
}
|
||||
|
||||
public void setTitolo(String titolo) {
|
||||
this.titolo = titolo;
|
||||
}
|
||||
|
||||
public String getDescrizioneBanner() {
|
||||
return (this.descrizioneBanner == null) ? "" : this.descrizioneBanner.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneBanner(String descrizioneBanner) {
|
||||
this.descrizioneBanner = descrizioneBanner;
|
||||
}
|
||||
|
||||
public String getDescrizioneClifor() {
|
||||
if (getId_clifor() != 0L)
|
||||
return getClifor().getDescrizioneCompleta();
|
||||
return (this.descrizioneClifor == null) ? "" : this.descrizioneClifor.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneClifor(String descrizioneClifor) {
|
||||
this.descrizioneClifor = descrizioneClifor;
|
||||
}
|
||||
|
||||
public Vectumerator findByCR(BannerCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from BANNER AS A";
|
||||
String s_Sql_Order = " ORDER BY A.descrizioneClifor ";
|
||||
WcString wc = new WcString();
|
||||
if (!CR.getDescrizioneClifor().trim().isEmpty()) {
|
||||
StringTokenizer st = new StringTokenizer(CR.getDescrizioneClifor().trim(), " ");
|
||||
StringBuffer txt = new StringBuffer("(");
|
||||
while (st.hasMoreTokens()) {
|
||||
String token = st.nextToken();
|
||||
txt.append("(A.descrizioneClifor like '%" + token + "%')");
|
||||
if (st.hasMoreTokens())
|
||||
txt.append(" and ");
|
||||
}
|
||||
txt.append(")");
|
||||
wc.addWc(txt.toString());
|
||||
}
|
||||
if (CR.getFlgAttivo() == 0L) {
|
||||
wc.addWc("(A.flgAttivo is null or A.flgAttivo=0 or A.dataFineVld is null)");
|
||||
} else if (CR.getFlgAttivo() > 0L) {
|
||||
wc.addWc("A.flgAttivo = 1");
|
||||
wc.addWc("A.dataFineVld is not null");
|
||||
}
|
||||
if (CR.getDataFineCampagnaDa() != null)
|
||||
wc.addWc("A.dataFineCampagna >= ? ");
|
||||
if (CR.getDataFineCampagnaA() != null)
|
||||
wc.addWc("A.dataFineCampagna <= ? ");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_Order);
|
||||
int dataCount = 0;
|
||||
if (CR.getDataFineCampagnaDa() != null) {
|
||||
dataCount++;
|
||||
stmt.setDate(dataCount, CR.getDataFineCampagnaDa());
|
||||
}
|
||||
if (CR.getDataFineCampagnaA() != null) {
|
||||
dataCount++;
|
||||
stmt.setDate(dataCount, CR.getDataFineCampagnaA());
|
||||
}
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (Exception e) {
|
||||
handleDebug(e, 2);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPathImgBanner() {
|
||||
return getParm("PATH_IMG_BANNER").getTesto();
|
||||
}
|
||||
|
||||
protected int getStringValueCase(String l_colomnName) {
|
||||
return 0;
|
||||
}
|
||||
|
||||
public Banner getRandomBanner(long l_id_tipoBanner) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from BANNER AS A";
|
||||
String wc = "";
|
||||
String wcPrior = "";
|
||||
wc = buildWc(wc, "A.id_tipoBanner =" + l_id_tipoBanner);
|
||||
wc = buildWc(wc, "A.dataFineVld is null");
|
||||
wc = buildWc(wc, "A.flgAttivo=1");
|
||||
wc = buildWc(wc, "A.dataInizioCampagna<=?");
|
||||
wc = buildWc(wc, "A.dataFineCampagna>=?");
|
||||
int prioritySeed = (int)(Math.random() * 10.0D);
|
||||
wcPrior = " and A.priorita>" + prioritySeed;
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + wcPrior);
|
||||
stmt.setDate(1, getToday());
|
||||
stmt.setDate(2, getToday());
|
||||
Vectumerator vec = findRows(stmt, 0, 0);
|
||||
while (vec.getTotNumberOfRecords() == 0 && prioritySeed-- > 0) {
|
||||
wcPrior = " and A.priorita>" + prioritySeed;
|
||||
stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + wcPrior);
|
||||
stmt.setDate(1, getToday());
|
||||
stmt.setDate(2, getToday());
|
||||
vec = findRows(stmt, 0, 0);
|
||||
}
|
||||
int totBanner = vec.getTotNumberOfRecords();
|
||||
if (totBanner > 0) {
|
||||
int idx = (int)(Math.random() * (double)totBanner);
|
||||
return (Banner)vec.elementAt(idx);
|
||||
}
|
||||
return null;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public void addClickThrough(String ipAddress, String entryPoint) {
|
||||
try {
|
||||
if (getDBState() == 1)
|
||||
synchronized (this) {
|
||||
setClickThrough(getClickThrough() + 1L);
|
||||
ResParm resParm = save();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public void addImpression(String ipAddress, String entryPoint) {
|
||||
try {
|
||||
if (getDBState() == 1)
|
||||
synchronized (this) {
|
||||
setImpression(getImpression() + 1L);
|
||||
ResParm resParm = save();
|
||||
}
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
public long getFlgTipo() {
|
||||
return this.flgTipo;
|
||||
}
|
||||
|
||||
public void setFlgTipo(long flgTipo) {
|
||||
this.flgTipo = flgTipo;
|
||||
}
|
||||
|
||||
public static String getTipo(long l_flgTipo) {
|
||||
if (l_flgTipo == TIPO_IMMAGINE)
|
||||
return "Immagine";
|
||||
return "Testo";
|
||||
}
|
||||
|
||||
public String getTipo() {
|
||||
return getTipo(getFlgTipo());
|
||||
}
|
||||
|
||||
public Vectumerator<Banner> findRandomBannerAttivi(long l_id_tipoBanner, long totBanner) {
|
||||
String limit;
|
||||
boolean debug = false;
|
||||
String s_Sql_Find = "select DISTINCT A.* from BANNER AS A";
|
||||
String s_Sql_order = " order by rand()";
|
||||
WcString wc = new WcString();
|
||||
String wcPrior = "";
|
||||
if (totBanner == 0L) {
|
||||
limit = "";
|
||||
} else {
|
||||
limit = " limit " + totBanner;
|
||||
}
|
||||
wc.addWc("A.id_tipoBanner =" + l_id_tipoBanner);
|
||||
wc.addWc("A.dataFineVld is null");
|
||||
wc.addWc("A.flgAttivo=1");
|
||||
wc.addWc("A.dataInizioCampagna<=?");
|
||||
wc.addWc("(A.dataFineCampagna is null or A.dataFineCampagna>=?)");
|
||||
Random r = new Random();
|
||||
int prioritySeed = Math.abs(r.nextInt()) % 11;
|
||||
if (totBanner > 0L)
|
||||
wcPrior = " and A.priorita>=" + prioritySeed;
|
||||
try {
|
||||
if (debug)
|
||||
System.out.println(String.valueOf(s_Sql_Find) + wc.toString() + wcPrior + s_Sql_order + limit);
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + wcPrior + s_Sql_order + limit);
|
||||
stmt.setDate(1, getToday());
|
||||
stmt.setDate(2, getToday());
|
||||
Vectumerator<Banner> vec = findRows(stmt, 0, 0);
|
||||
if (totBanner > 0L)
|
||||
while ((long)vec.getTotNumberOfRecords() < totBanner && prioritySeed-- >= 0) {
|
||||
wcPrior = " and A.priorita>=" + prioritySeed;
|
||||
if (debug)
|
||||
System.out.println(String.valueOf(prioritySeed) + ": " + s_Sql_Find + wc.toString() + wcPrior + s_Sql_order + limit);
|
||||
stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc.toString() + wcPrior + s_Sql_order + limit);
|
||||
stmt.setDate(1, getToday());
|
||||
stmt.setDate(2, getToday());
|
||||
vec = findRows(stmt, 0, 0);
|
||||
}
|
||||
return vec;
|
||||
} catch (Exception e) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
public String getPathAttach() {
|
||||
return getPathImgBanner();
|
||||
}
|
||||
}
|
||||
188
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/BannerCR.java
Normal file
188
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/BannerCR.java
Normal file
|
|
@ -0,0 +1,188 @@
|
|||
package com.ablia.banner;
|
||||
|
||||
import com.ablia.anag.Clifor;
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import java.sql.Date;
|
||||
|
||||
public class BannerCR extends CRAdapter {
|
||||
private long id_banner;
|
||||
|
||||
private long id_tipoBanner;
|
||||
|
||||
private long id_clifor;
|
||||
|
||||
private String link;
|
||||
|
||||
private Date dataInizioCampagna;
|
||||
|
||||
private Date dataFineCampagna;
|
||||
|
||||
private long flgAttivo = -1L;
|
||||
|
||||
private long impression;
|
||||
|
||||
private long clickThrough;
|
||||
|
||||
private Date dataFineVld;
|
||||
|
||||
private long priorita;
|
||||
|
||||
private TipoBanner tipoBanner;
|
||||
|
||||
private Clifor clifor;
|
||||
|
||||
private Date dataFineCampagnaDa;
|
||||
|
||||
private Date dataFineCampagnaA;
|
||||
|
||||
private String descrizioneClifor;
|
||||
|
||||
private String descrizioneBanner;
|
||||
|
||||
public BannerCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public BannerCR() {}
|
||||
|
||||
public void setId_banner(long newId_banner) {
|
||||
this.id_banner = newId_banner;
|
||||
}
|
||||
|
||||
public void setId_tipoBanner(long newId_tipoBanner) {
|
||||
this.id_tipoBanner = newId_tipoBanner;
|
||||
setTipoBanner(null);
|
||||
}
|
||||
|
||||
public void setId_clifor(long newId_clifor) {
|
||||
this.id_clifor = newId_clifor;
|
||||
setClifor(null);
|
||||
}
|
||||
|
||||
public void setLink(String newLink) {
|
||||
this.link = newLink;
|
||||
}
|
||||
|
||||
public void setDataInizioCampagna(Date newDataInizioCampagna) {
|
||||
this.dataInizioCampagna = newDataInizioCampagna;
|
||||
}
|
||||
|
||||
public void setDataFineCampagna(Date newDataFineCampagna) {
|
||||
this.dataFineCampagna = newDataFineCampagna;
|
||||
}
|
||||
|
||||
public void setFlgAttivo(long newFlgAttivo) {
|
||||
this.flgAttivo = newFlgAttivo;
|
||||
}
|
||||
|
||||
public void setImpression(long newImpression) {
|
||||
this.impression = newImpression;
|
||||
}
|
||||
|
||||
public void setClickThrough(long newClickThrough) {
|
||||
this.clickThrough = newClickThrough;
|
||||
}
|
||||
|
||||
public void setDataFineVld(Date newDataFineVld) {
|
||||
this.dataFineVld = newDataFineVld;
|
||||
}
|
||||
|
||||
public void setPriorita(long newPriorita) {
|
||||
this.priorita = newPriorita;
|
||||
}
|
||||
|
||||
public long getId_banner() {
|
||||
return this.id_banner;
|
||||
}
|
||||
|
||||
public long getId_tipoBanner() {
|
||||
return this.id_tipoBanner;
|
||||
}
|
||||
|
||||
public long getId_clifor() {
|
||||
return this.id_clifor;
|
||||
}
|
||||
|
||||
public String getLink() {
|
||||
return (this.link == null) ? "" : this.link.trim();
|
||||
}
|
||||
|
||||
public Date getDataInizioCampagna() {
|
||||
return this.dataInizioCampagna;
|
||||
}
|
||||
|
||||
public Date getDataFineCampagna() {
|
||||
return this.dataFineCampagna;
|
||||
}
|
||||
|
||||
public long getFlgAttivo() {
|
||||
return this.flgAttivo;
|
||||
}
|
||||
|
||||
public long getImpression() {
|
||||
return this.impression;
|
||||
}
|
||||
|
||||
public long getClickThrough() {
|
||||
return this.clickThrough;
|
||||
}
|
||||
|
||||
public Date getDataFineVld() {
|
||||
return this.dataFineVld;
|
||||
}
|
||||
|
||||
public long getPriorita() {
|
||||
return this.priorita;
|
||||
}
|
||||
|
||||
public void setTipoBanner(TipoBanner newTipoBanner) {
|
||||
this.tipoBanner = newTipoBanner;
|
||||
}
|
||||
|
||||
public TipoBanner getTipoBanner() {
|
||||
this.tipoBanner = (TipoBanner)getSecondaryObject(this.tipoBanner, TipoBanner.class, getId_tipoBanner());
|
||||
return this.tipoBanner;
|
||||
}
|
||||
|
||||
public void setClifor(Clifor newClifor) {
|
||||
this.clifor = newClifor;
|
||||
}
|
||||
|
||||
public Clifor getClifor() {
|
||||
this.clifor = (Clifor)getSecondaryObject(this.clifor, Clifor.class, getId_clifor());
|
||||
return this.clifor;
|
||||
}
|
||||
|
||||
public Date getDataFineCampagnaDa() {
|
||||
return this.dataFineCampagnaDa;
|
||||
}
|
||||
|
||||
public void setDataFineCampagnaDa(Date dataFineCampagnaDa) {
|
||||
this.dataFineCampagnaDa = dataFineCampagnaDa;
|
||||
}
|
||||
|
||||
public Date getDataFineCampagnaA() {
|
||||
return this.dataFineCampagnaA;
|
||||
}
|
||||
|
||||
public void setDataFineCampagnaA(Date dataFineCampagnaA) {
|
||||
this.dataFineCampagnaA = dataFineCampagnaA;
|
||||
}
|
||||
|
||||
public String getDescrizioneClifor() {
|
||||
return (this.descrizioneClifor == null) ? "" : this.descrizioneClifor.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneClifor(String descrizioneClifor) {
|
||||
this.descrizioneClifor = descrizioneClifor;
|
||||
}
|
||||
|
||||
public String getDescrizioneBanner() {
|
||||
return (this.descrizioneBanner == null) ? "" : this.descrizioneBanner.trim();
|
||||
}
|
||||
|
||||
public void setDescrizioneBanner(String descrizioneBanner) {
|
||||
this.descrizioneBanner = descrizioneBanner;
|
||||
}
|
||||
}
|
||||
113
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/BannerStats.java
Normal file
113
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/BannerStats.java
Normal file
|
|
@ -0,0 +1,113 @@
|
|||
package com.ablia.banner;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import java.io.Serializable;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class BannerStats extends DBAdapter implements Serializable {
|
||||
private long id_bannerStats;
|
||||
|
||||
private Timestamp dataTimestamp;
|
||||
|
||||
private String entryPoint;
|
||||
|
||||
private String nazione;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private long flgI_CT;
|
||||
|
||||
public static final long FLG_IMPRESSION = 0L;
|
||||
|
||||
public static final long FLG_CLICK_THROUGH = 1L;
|
||||
|
||||
private Banner banner;
|
||||
|
||||
private long id_banner;
|
||||
|
||||
public BannerStats(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public BannerStats() {
|
||||
initFields();
|
||||
}
|
||||
|
||||
public void setId_bannerStats(long newId_stats) {
|
||||
this.id_bannerStats = newId_stats;
|
||||
}
|
||||
|
||||
public void setDataTimestamp(Timestamp newDataTimestamp) {
|
||||
this.dataTimestamp = newDataTimestamp;
|
||||
}
|
||||
|
||||
public void setEntryPoint(String newEntryPoint) {
|
||||
this.entryPoint = newEntryPoint;
|
||||
}
|
||||
|
||||
public void setNazione(String newNazione) {
|
||||
this.nazione = newNazione;
|
||||
}
|
||||
|
||||
public void setIpAddress(String newIp) {
|
||||
this.ipAddress = newIp;
|
||||
}
|
||||
|
||||
public void setId_banner(long newId_banner) {
|
||||
this.id_banner = newId_banner;
|
||||
setBanner(null);
|
||||
}
|
||||
|
||||
public long getId_bannerStats() {
|
||||
return this.id_bannerStats;
|
||||
}
|
||||
|
||||
public Timestamp getDataTimestamp() {
|
||||
return this.dataTimestamp;
|
||||
}
|
||||
|
||||
public String getEntryPoint() {
|
||||
return (this.entryPoint == null) ? "" :
|
||||
this.entryPoint;
|
||||
}
|
||||
|
||||
public String getNazione() {
|
||||
return (this.nazione == null) ? "" :
|
||||
this.nazione;
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return (this.ipAddress == null) ? "" :
|
||||
this.ipAddress;
|
||||
}
|
||||
|
||||
public long getId_banner() {
|
||||
return this.id_banner;
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public void setBanner(Banner newBanner) {
|
||||
this.banner = newBanner;
|
||||
}
|
||||
|
||||
public Banner getBanner() {
|
||||
this.banner = (Banner)getSecondaryObject(this.banner, Banner.class,
|
||||
getId_banner());
|
||||
return this.banner;
|
||||
}
|
||||
|
||||
public long getFlgI_CT() {
|
||||
return this.flgI_CT;
|
||||
}
|
||||
|
||||
public void setFlgI_CT(long flgICT) {
|
||||
this.flgI_CT = flgICT;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,87 @@
|
|||
package com.ablia.banner;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import java.sql.Timestamp;
|
||||
|
||||
public class BannerStatsCR extends CRAdapter {
|
||||
private long id_bannerStats;
|
||||
|
||||
private long id_banner;
|
||||
|
||||
private String entryPoint;
|
||||
|
||||
private String ipAddress;
|
||||
|
||||
private Timestamp dataTimestamp;
|
||||
|
||||
private long flgI_CT;
|
||||
|
||||
private Banner banner;
|
||||
|
||||
public BannerStatsCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public BannerStatsCR() {}
|
||||
|
||||
public void setId_bannerStats(long newId_bannerStats) {
|
||||
this.id_bannerStats = newId_bannerStats;
|
||||
}
|
||||
|
||||
public void setId_banner(long newId_banner) {
|
||||
this.id_banner = newId_banner;
|
||||
setBanner(null);
|
||||
}
|
||||
|
||||
public void setEntryPoint(String newEntryPoint) {
|
||||
this.entryPoint = newEntryPoint;
|
||||
}
|
||||
|
||||
public void setIpAddress(String newIpAddress) {
|
||||
this.ipAddress = newIpAddress;
|
||||
}
|
||||
|
||||
public void setDataTimestamp(Timestamp newDataTimestamp) {
|
||||
this.dataTimestamp = newDataTimestamp;
|
||||
}
|
||||
|
||||
public void setFlgI_CT(long newFlgI_CT) {
|
||||
this.flgI_CT = newFlgI_CT;
|
||||
}
|
||||
|
||||
public long getId_bannerStats() {
|
||||
return this.id_bannerStats;
|
||||
}
|
||||
|
||||
public long getId_banner() {
|
||||
return this.id_banner;
|
||||
}
|
||||
|
||||
public String getEntryPoint() {
|
||||
return (this.entryPoint == null) ? "" : this.entryPoint.trim();
|
||||
}
|
||||
|
||||
public String getIpAddress() {
|
||||
return (this.ipAddress == null) ? "" : this.ipAddress.trim();
|
||||
}
|
||||
|
||||
public Timestamp getDataTimestamp() {
|
||||
return this.dataTimestamp;
|
||||
}
|
||||
|
||||
public long getFlgI_CT() {
|
||||
return this.flgI_CT;
|
||||
}
|
||||
|
||||
public void setBanner(Banner newBanner) {
|
||||
this.banner = newBanner;
|
||||
}
|
||||
|
||||
public Banner getBanner() {
|
||||
this.banner = (Banner)getSecondaryObject(
|
||||
this.banner,
|
||||
Banner.class, getId_banner());
|
||||
return this.banner;
|
||||
}
|
||||
}
|
||||
123
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/TipoBanner.java
Normal file
123
rus/WEB-INF/lib/abliaDbCom_src/com/ablia/banner/TipoBanner.java
Normal file
|
|
@ -0,0 +1,123 @@
|
|||
package com.ablia.banner;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.util.DoubleOperator;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.Serializable;
|
||||
import java.sql.PreparedStatement;
|
||||
import java.sql.SQLException;
|
||||
|
||||
public class TipoBanner extends DBAdapter implements Serializable {
|
||||
private long id_tipoBanner;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private String larghezza;
|
||||
|
||||
private static final long SCALED_WIDTH = 80L;
|
||||
|
||||
private String altezza;
|
||||
|
||||
public TipoBanner(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public TipoBanner() {
|
||||
initFields();
|
||||
}
|
||||
|
||||
public void setId_tipoBanner(long newId_tipoBanner) {
|
||||
this.id_tipoBanner = newId_tipoBanner;
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setLarghezza(String newLarghezza) {
|
||||
this.larghezza = newLarghezza;
|
||||
}
|
||||
|
||||
public void setAltezza(String newAltezza) {
|
||||
this.altezza = newAltezza;
|
||||
}
|
||||
|
||||
public long getId_tipoBanner() {
|
||||
return this.id_tipoBanner;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione;
|
||||
}
|
||||
|
||||
public String getLarghezza() {
|
||||
return (this.larghezza == null) ? "" : this.larghezza.trim();
|
||||
}
|
||||
|
||||
public String getAltezza() {
|
||||
return (this.altezza == null) ? "" : this.altezza.trim();
|
||||
}
|
||||
|
||||
protected ResParm checkDeleteCascade() {
|
||||
return new ResParm(true);
|
||||
}
|
||||
|
||||
protected void deleteCascade() {}
|
||||
|
||||
public Vectumerator findByCR(TipoBannerCR CR, int pageNumber, int pageRows) {
|
||||
String s_Sql_Find = "select DISTINCT A.* from TIPO_BANNER AS A";
|
||||
String s_Sql_Order = " order by A.descrizione";
|
||||
String wc = "";
|
||||
if (!CR.getSearchTxt().isEmpty())
|
||||
wc = buildWc(wc, "A.descrizione like'" + CR.getSearchTxt() + "%' ");
|
||||
try {
|
||||
PreparedStatement stmt = getConn().prepareStatement(String.valueOf(s_Sql_Find) + wc + s_Sql_Order);
|
||||
return findRows(stmt, pageNumber, pageRows);
|
||||
} catch (SQLException e) {
|
||||
handleDebug(e);
|
||||
return AB_EMPTY_VECTUMERATOR;
|
||||
}
|
||||
}
|
||||
|
||||
public String getDescrizioneCompleta() {
|
||||
return String.valueOf(getDescrizione()) + " " + getLarghezza() + "x" + getAltezza();
|
||||
}
|
||||
|
||||
public String getLarghezzaScalata() {
|
||||
return getLarghezzaScalataBase();
|
||||
}
|
||||
|
||||
public String getAltezzaScalata() {
|
||||
if (getId_tipoBanner() == 0L)
|
||||
return "";
|
||||
try {
|
||||
if (getLarghezza().indexOf("%") > 0)
|
||||
return "";
|
||||
long l_larghezza = 80L, l_larghezzaScalataBase = 80L;
|
||||
try {
|
||||
l_larghezza = Long.parseLong(getLarghezza());
|
||||
l_larghezzaScalataBase = Long.parseLong(getLarghezzaScalataBase());
|
||||
} catch (Exception e) {}
|
||||
DoubleOperator dop = new DoubleOperator(getAltezza());
|
||||
dop.multiply(l_larghezzaScalataBase);
|
||||
dop.divide((float)l_larghezza);
|
||||
return String.valueOf((long)dop.getResult());
|
||||
} catch (Exception e) {
|
||||
return "Errore! " + getId_tipoBanner();
|
||||
}
|
||||
}
|
||||
|
||||
private String getLarghezzaScalataBase() {
|
||||
if (getLarghezza().indexOf("%") > 0)
|
||||
return getLarghezza();
|
||||
long l_larghezza = 80L;
|
||||
try {
|
||||
l_larghezza = Long.parseLong(getLarghezza());
|
||||
} catch (Exception e) {}
|
||||
if (l_larghezza < 80L)
|
||||
return getLarghezza();
|
||||
return String.valueOf(80L);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,52 @@
|
|||
package com.ablia.banner;
|
||||
|
||||
import com.ablia.db.ApplParmFull;
|
||||
import com.ablia.db.CRAdapter;
|
||||
|
||||
public class TipoBannerCR extends CRAdapter {
|
||||
private long id_tipoBanner;
|
||||
|
||||
private String descrizione;
|
||||
|
||||
private long larghezza;
|
||||
|
||||
private long altezza;
|
||||
|
||||
public TipoBannerCR(ApplParmFull newApplParmFull) {
|
||||
super(newApplParmFull);
|
||||
}
|
||||
|
||||
public TipoBannerCR() {}
|
||||
|
||||
public void setId_tipoBanner(long newId_tipoBanner) {
|
||||
this.id_tipoBanner = newId_tipoBanner;
|
||||
}
|
||||
|
||||
public void setDescrizione(String newDescrizione) {
|
||||
this.descrizione = newDescrizione;
|
||||
}
|
||||
|
||||
public void setLarghezza(long newLarghezza) {
|
||||
this.larghezza = newLarghezza;
|
||||
}
|
||||
|
||||
public void setAltezza(long newAltezza) {
|
||||
this.altezza = newAltezza;
|
||||
}
|
||||
|
||||
public long getId_tipoBanner() {
|
||||
return this.id_tipoBanner;
|
||||
}
|
||||
|
||||
public String getDescrizione() {
|
||||
return (this.descrizione == null) ? "" : this.descrizione.trim();
|
||||
}
|
||||
|
||||
public long getLarghezza() {
|
||||
return this.larghezza;
|
||||
}
|
||||
|
||||
public long getAltezza() {
|
||||
return this.altezza;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,86 @@
|
|||
package com.ablia.banner.admin.servlet;
|
||||
|
||||
import com.ablia.banner.Banner;
|
||||
import com.ablia.banner.BannerCR;
|
||||
import com.ablia.banner.TipoBanner;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.db.ResParm;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import com.ablia.util.AbMessages;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/banner/Banner.abl"})
|
||||
public class BannerSvlt extends AblServletSvlt {
|
||||
protected void fillComboAfterDetail(DBAdapter l_bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("nf0", getApFull(req).getNf0());
|
||||
req.setAttribute("listaTipoBanner", new TipoBanner(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("nf0", getApFull(req).getNf0());
|
||||
req.setAttribute("listaTipoBanner", new TipoBanner(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new Banner(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new BannerCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("nf0", getApFull(req).getNf0());
|
||||
req.setAttribute("listaTipoBanner", new TipoBanner(getApFull(req)).findAll());
|
||||
}
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
|
||||
Banner bean = null;
|
||||
ResParm rp = new ResParm(true, "");
|
||||
long l_id = getRequestLongParameter(req, "id_Banner");
|
||||
bean = new Banner(getApFull(req));
|
||||
try {
|
||||
bean.findByPrimaryKey(l_id);
|
||||
fillObject(req, bean);
|
||||
rp = bean.save();
|
||||
req.setAttribute("id_Banner", String.valueOf(bean.getId_banner()));
|
||||
if (!rp.getStatus()) {
|
||||
req.setAttribute("bean", bean);
|
||||
sendMessage(req, rp.getMsg());
|
||||
showBean(req, res);
|
||||
}
|
||||
} catch (Exception e) {
|
||||
forceMessage(req, AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
|
||||
showBean(req, res);
|
||||
}
|
||||
}
|
||||
|
||||
protected ResParm afterSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
|
||||
synchronized (this) {
|
||||
return super.afterSave(beanA, req, res);
|
||||
}
|
||||
}
|
||||
|
||||
public String getPathAttach(HttpServletRequest req) {
|
||||
return ((Banner)getBean(req)).getPathImgBanner();
|
||||
}
|
||||
|
||||
protected boolean isLoadImageServlet() {
|
||||
return true;
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
search(req, res);
|
||||
}
|
||||
|
||||
protected void search(HttpServletRequest req, HttpServletResponse res) {
|
||||
super.search(req, res);
|
||||
}
|
||||
|
||||
protected String getAttachPath(HttpServletRequest req) {
|
||||
return getPathAttach(req);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,39 @@
|
|||
package com.ablia.banner.admin.servlet;
|
||||
|
||||
import com.ablia.banner.TipoBanner;
|
||||
import com.ablia.banner.TipoBannerCR;
|
||||
import com.ablia.db.CRAdapter;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.servlet.AblServletSvlt;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/admin/bannerConfig/TipoBanner.abl"})
|
||||
public class TipoBannerSvlt extends AblServletSvlt {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("nf0", getApFull(req).getNf0());
|
||||
}
|
||||
|
||||
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {
|
||||
req.setAttribute("nf0", getApFull(req).getNf0());
|
||||
}
|
||||
|
||||
protected DBAdapter getBean(HttpServletRequest req) {
|
||||
return new TipoBanner(getApFull(req));
|
||||
}
|
||||
|
||||
protected CRAdapter getBeanCR(HttpServletRequest req) {
|
||||
return new TipoBannerCR(getApFull(req));
|
||||
}
|
||||
|
||||
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
|
||||
|
||||
protected boolean isSimpleServlet(HttpServletRequest req) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,41 @@
|
|||
package com.ablia.banner.servlet;
|
||||
|
||||
import com.ablia.banner.Banner;
|
||||
import com.ablia.servlet.AcServlet;
|
||||
import javax.servlet.annotation.WebServlet;
|
||||
import javax.servlet.http.HttpServletRequest;
|
||||
import javax.servlet.http.HttpServletResponse;
|
||||
|
||||
@WebServlet(urlPatterns = {"/Banner.abl"})
|
||||
public class BannerSvlt extends AcServlet {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
protected long getId(HttpServletRequest req) {
|
||||
return getRequestLongParameter(req, "id");
|
||||
}
|
||||
|
||||
protected void go(HttpServletRequest req, HttpServletResponse res) {
|
||||
long l_id = getId(req);
|
||||
Banner bean = null;
|
||||
try {
|
||||
bean = new Banner(getApFull(req));
|
||||
bean.findByPrimaryKey(l_id);
|
||||
bean.addClickThrough(req.getRemoteAddr(), req.getServletPath());
|
||||
res.sendRedirect(bean.getLink());
|
||||
} catch (Exception e) {
|
||||
handleDebug(e);
|
||||
}
|
||||
}
|
||||
|
||||
protected boolean isSecureServlet(HttpServletRequest req) {
|
||||
return false;
|
||||
}
|
||||
|
||||
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
|
||||
go(req, res);
|
||||
}
|
||||
|
||||
protected void processRequest(HttpServletRequest req, HttpServletResponse res) {
|
||||
go(req, res);
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,76 @@
|
|||
package com.ablia.banner.taglib;
|
||||
|
||||
import com.ablia.banner.Banner;
|
||||
import com.ablia.taglib.AbstractDbTag;
|
||||
import com.ablia.util.Vectumerator;
|
||||
import java.io.IOException;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
|
||||
public class BannerListTag extends AbstractDbTag {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String rowbeanname;
|
||||
|
||||
private int num;
|
||||
|
||||
private Vectumerator<Banner> theList;
|
||||
|
||||
private long bannertype;
|
||||
|
||||
public int doAfterBody() throws JspException {
|
||||
try {
|
||||
if (this.theList.hasMoreElements()) {
|
||||
Banner row = (Banner)this.theList.nextElement();
|
||||
this.pageContext.setAttribute(getRowbeanname(), row);
|
||||
this.pageContext.setAttribute("idx", new Long((long)this.theList.getIndex()));
|
||||
row.addImpression(getReq().getRemoteAddr(), getReq().getServletPath());
|
||||
return 2;
|
||||
}
|
||||
String body = getBodyContent().getString();
|
||||
this.bodyContent.getEnclosingWriter().print(body);
|
||||
return 0;
|
||||
} catch (IOException ex) {
|
||||
throw new JspTagException(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public int doStartTag() {
|
||||
this.theList = new Banner(getApFull()).findRandomBannerAttivi(getBannertype(), (long)getNum());
|
||||
if (this.theList == null)
|
||||
return 0;
|
||||
this.theList.moveFirst();
|
||||
if (this.theList.hasMoreElements()) {
|
||||
Banner row = (Banner)this.theList.nextElement();
|
||||
this.pageContext.setAttribute(getRowbeanname(), row);
|
||||
this.pageContext.setAttribute("idx", new Long((long)this.theList.getIndex()));
|
||||
row.addImpression(getReq().getRemoteAddr(), getReq().getServletPath());
|
||||
return 2;
|
||||
}
|
||||
return 0;
|
||||
}
|
||||
|
||||
public String getRowbeanname() {
|
||||
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
|
||||
}
|
||||
|
||||
public void setRowbeanname(String s) {
|
||||
this.rowbeanname = s;
|
||||
}
|
||||
|
||||
public int getNum() {
|
||||
return this.num;
|
||||
}
|
||||
|
||||
public void setNum(int num) {
|
||||
this.num = num;
|
||||
}
|
||||
|
||||
public long getBannertype() {
|
||||
return this.bannertype;
|
||||
}
|
||||
|
||||
public void setBannertype(long newTipobanner) {
|
||||
this.bannertype = newTipobanner;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,14 @@
|
|||
package com.ablia.banner.taglib;
|
||||
|
||||
import javax.servlet.jsp.tagext.TagData;
|
||||
import javax.servlet.jsp.tagext.TagExtraInfo;
|
||||
import javax.servlet.jsp.tagext.VariableInfo;
|
||||
|
||||
public class BannerListTagExtraInfo extends TagExtraInfo {
|
||||
public VariableInfo[] getVariableInfo(TagData tagdata) {
|
||||
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ? tagdata.getAttributeString("rowbeanname") : "rowBean";
|
||||
String rowBeanClass = "com.ablia.banner.Banner";
|
||||
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0),
|
||||
new VariableInfo("idx", "java.lang.Long", true, 0) };
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,118 @@
|
|||
package com.ablia.banner.taglib;
|
||||
|
||||
import com.ablia.banner.Banner;
|
||||
import com.ablia.db.DBAdapter;
|
||||
import com.ablia.taglib.AbstractDbTag;
|
||||
import javax.servlet.jsp.JspException;
|
||||
import javax.servlet.jsp.JspTagException;
|
||||
|
||||
public class BannerTag extends AbstractDbTag {
|
||||
private static final long serialVersionUID = 1L;
|
||||
|
||||
private String alt;
|
||||
|
||||
private long bannertype;
|
||||
|
||||
private long id_banner;
|
||||
|
||||
private boolean textbanner;
|
||||
|
||||
private String imgclass;
|
||||
|
||||
public int doAfterBody() throws JspException {
|
||||
try {
|
||||
Banner bean = new Banner(getApFull());
|
||||
if (getId_banner() == 0L) {
|
||||
bean = bean.getRandomBanner(getBannertype());
|
||||
} else {
|
||||
bean.findByPrimaryKey(getId_banner());
|
||||
}
|
||||
if (bean == null || bean.getId_banner() == 0L) {
|
||||
this.bodyContent.getEnclosingWriter().print("No banner found");
|
||||
} else if (bean.getFlgTipo() == Banner.TIPO_IMMAGINE) {
|
||||
String theClass = getImgclass().isEmpty() ? "" : (" class=\"" + getImgclass() + "\"");
|
||||
String beforeImage = "<p><a target=\"_blank\" href=\"" + DBAdapter.convertStringToLink(bean.getTitolo()) + "+ad-" +
|
||||
bean.getId_banner() + ".html\"><img src=\"";
|
||||
String height = " height=\"" + bean.getTipoBanner().getAltezza() + "\" ";
|
||||
String width = " width=\"" + bean.getTipoBanner().getLarghezza() + "\" ";
|
||||
if (bean.getTipoBanner().getLarghezza().indexOf("%") > 0)
|
||||
height = "";
|
||||
String afterImage = "\"" + width + height + " border=\"0\" title=\"" + bean.getTitolo() + "\" alt=\"" + bean.getTitolo() +
|
||||
"\"" + theClass + " ></a> </p>";
|
||||
String absImg = String.valueOf(bean.getPathImgBanner()) + bean.getImgFileName(1);
|
||||
if (isImageExist(absImg)) {
|
||||
bean.addImpression(getReq().getRemoteAddr(), getReq().getServletPath());
|
||||
String bodyString = String.valueOf(beforeImage) + absImg + afterImage;
|
||||
System.out.println(bodyString);
|
||||
this.bodyContent.getEnclosingWriter().print(bodyString);
|
||||
} else {
|
||||
this.bodyContent.getEnclosingWriter().print(getAlt());
|
||||
}
|
||||
} else {
|
||||
this.bodyContent.getEnclosingWriter().print(bean.getDescrizioneBanner());
|
||||
}
|
||||
return 0;
|
||||
} catch (Exception ex) {
|
||||
throw new JspTagException(ex.toString());
|
||||
}
|
||||
}
|
||||
|
||||
public int doStartTag() {
|
||||
return 2;
|
||||
}
|
||||
|
||||
public String getAlt() {
|
||||
return (this.alt == null) ? "" : this.alt;
|
||||
}
|
||||
|
||||
public long getBannertype() {
|
||||
return this.bannertype;
|
||||
}
|
||||
|
||||
private boolean isFileExist(String fileName) {
|
||||
return true;
|
||||
}
|
||||
|
||||
public boolean isImageExist(String imageName) {
|
||||
try {
|
||||
String fullImageName = String.valueOf(getDocBase()) + imageName;
|
||||
if (isFileExist(fullImageName))
|
||||
return true;
|
||||
return false;
|
||||
} catch (Exception e) {
|
||||
return false;
|
||||
}
|
||||
}
|
||||
|
||||
public void setAlt(String newAlt) {
|
||||
this.alt = newAlt;
|
||||
}
|
||||
|
||||
public void setBannertype(long newTipobanner) {
|
||||
this.bannertype = newTipobanner;
|
||||
}
|
||||
|
||||
public long getId_banner() {
|
||||
return this.id_banner;
|
||||
}
|
||||
|
||||
public void setId_banner(long id_banner) {
|
||||
this.id_banner = id_banner;
|
||||
}
|
||||
|
||||
public boolean isTextbanner() {
|
||||
return this.textbanner;
|
||||
}
|
||||
|
||||
public void setTextbanner(boolean textBanner) {
|
||||
this.textbanner = textBanner;
|
||||
}
|
||||
|
||||
public String getImgclass() {
|
||||
return (this.imgclass == null) ? "" : this.imgclass.trim();
|
||||
}
|
||||
|
||||
public void setImgclass(String imgclass) {
|
||||
this.imgclass = imgclass;
|
||||
}
|
||||
}
|
||||
|
|
@ -0,0 +1,16 @@
|
|||
package com.ablia.banner.taglib;
|
||||
|
||||
import javax.servlet.jsp.tagext.TagData;
|
||||
import javax.servlet.jsp.tagext.TagExtraInfo;
|
||||
import javax.servlet.jsp.tagext.VariableInfo;
|
||||
|
||||
public class BannerTagExtraInfo extends TagExtraInfo {
|
||||
public VariableInfo[] getVariableInfo(TagData tagdata) {
|
||||
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ?
|
||||
tagdata.getAttributeString("rowbeanname") :
|
||||
"banner";
|
||||
String rowBeanClass = "com.ablia.banner.Banner";
|
||||
return new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true,
|
||||
0) };
|
||||
}
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue