first commit

This commit is contained in:
MaddoScientisto 2026-03-14 20:04:39 +01:00
commit 4d332ef662
27586 changed files with 3281783 additions and 0 deletions

View file

@ -0,0 +1,99 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
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.PreparedStatement;
import java.sql.SQLException;
public class ExcludeKeywords extends DBAdapter implements Serializable {
private String id_excludeKeywords;
private String lang;
private String theKey;
public ExcludeKeywords(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public ExcludeKeywords() {}
public void setId_excludeKeywords(String newId_excludeKeywords) {
this.id_excludeKeywords = newId_excludeKeywords;
}
public void setLang(String newLang) {
this.lang = newLang;
}
public String getId_excludeKeywords() {
return (this.id_excludeKeywords == null) ? "" :
this.id_excludeKeywords.trim();
}
public String getLang() {
return (this.lang == null) ? "" : this.lang.trim();
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public void findByKeyLang(String l_key, String lang) {
String s_Sql_Find = "select DISTINCT A.* from EXCLUDE_KEYWORDS AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.lang='" + lang + "'");
wc.addWc("A.theKey='" + prepareMySqlString(l_key, false) + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public String getTheKey() {
return (this.theKey == null) ? "" : this.theKey.trim();
}
public void setTheKey(String theKey) {
this.theKey = theKey;
}
public Vectumerator findByCR(ExcludeKeywordsCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from EXCLUDE_KEYWORDS AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
" ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token +
"%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}

View file

@ -0,0 +1,32 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
public class ExcludeKeywordsCR extends CRAdapter {
private String id_excludeKeywords;
private String theKey;
public ExcludeKeywordsCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public ExcludeKeywordsCR() {}
public void setId_excludeKeywords(String newId_excludeKeywords) {
this.id_excludeKeywords = newId_excludeKeywords;
}
public String getId_excludeKeywords() {
return (this.id_excludeKeywords == null) ? "" : this.id_excludeKeywords.trim();
}
public String getTheKey() {
return (this.theKey == null) ? "" : this.theKey.trim();
}
public void setTheKey(String theKey) {
this.theKey = theKey;
}
}

View file

@ -0,0 +1,718 @@
package com.ablia.help;
import com.ablia.common.DescTxtLang;
import com.ablia.db.AddImgInterface;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.File;
import java.io.IOException;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
public class Help extends DBAdapter implements Serializable, AddImgInterface {
private static final String INDICE_DELIM = ":";
private long id_help;
private long id_helpPadre;
private String codice;
private String descrizione_en;
private long livello;
private String indici;
private long flgFoglia;
private long flgVisibile;
private long ordine;
private long flgTipoHelp;
private String text_it;
private String text_en;
private Help helpPadre;
private String descrizione_it;
private String titolo_en;
private String titolo_it;
private String imgTmst;
public static final String COD_INTRO = "INTRO";
public static final String COD_ALL = "*";
public static final String P_HELP_IMG_PATH = "HELP_IMG_PATH";
public static final String P_HELP_PUBLIC_CODES = "HELP_PUBLIC_CODES";
public static final String P_HELP_ATTACH_PATH = "HELP_ATTACH_PATH";
public static final String P_HELP_EXPORT_PATH = "HELP_EXPORT_PATH";
public static final String ATTR_COD = "cod";
public Help(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public Help() {}
public void setId_help(long newId_help) {
this.id_help = newId_help;
}
public void setId_helpPadre(long newId_helpPadre) {
this.id_helpPadre = newId_helpPadre;
setHelpPadre(null);
}
public void setDescrizione_it(String newDescrizione_it) {
this.descrizione_it = newDescrizione_it;
}
public void setDescrizione_en(String newDescrizione_en) {
this.descrizione_en = newDescrizione_en;
}
public void setLivello(long newLivello) {
this.livello = newLivello;
}
public void setIndici(String newIndici) {
this.indici = newIndici;
}
public void setFlgFoglia(long newFlgFoglia) {
this.flgFoglia = newFlgFoglia;
}
public void setFlgVisibile(long newFlgNascondi) {
this.flgVisibile = newFlgNascondi;
}
public void setOrdine(long newOrdine) {
this.ordine = newOrdine;
}
public void setFlgTipoHelp(long newFlgTipoHelp) {
this.flgTipoHelp = newFlgTipoHelp;
}
public void setText_it(String newText_it) {
this.text_it = newText_it;
}
public void setText_en(String newText_en) {
this.text_en = newText_en;
}
public long getId_help() {
return this.id_help;
}
public long getId_helpPadre() {
return this.id_helpPadre;
}
public String getTitolo(String lang) {
return getDescTxtLang("titolo", lang);
}
public String getTitolo() {
return getTitolo("it");
}
public String getText(String lang) {
return getDescTxtLang("text", lang);
}
public String getText() {
return getText("it");
}
public String getDescrizione_en() {
return (this.descrizione_en == null) ? "" :
this.descrizione_en.trim();
}
public long getLivello() {
return this.livello;
}
public ResParm indicizzaKeyword() {
ResParm rp = new ResParm(true);
if (getId_help() > 0L) {
int MINCHAR = 4;
int MAXCHAR = 30;
int contMaxMin = 0;
String START_TAG = "<";
String END_TAG = ">";
rp = new HelpKeyword(getApFull()).deleteByHelp(getId_help());
if (rp.getStatus()) {
String lang = "it";
boolean foundTag = false;
String temp = getText_it();
temp = temp.replace(START_TAG, " " + START_TAG + " ");
temp = temp.replace(END_TAG, " " + END_TAG + " ");
temp = temp.replace("&nbsp;", " ");
temp = temp.replace(".", " ");
temp = temp.replace(",", " ");
temp = temp.replace("'", " ");
temp = temp.replace(":", " ");
temp = temp.replace(";", " ");
temp = temp.replace("!", " ");
temp = temp.replace("#", " ");
temp = temp.replace("@", " ");
StringTokenizer st = new StringTokenizer(temp, " ");
ExcludeKeywords ek = new ExcludeKeywords(getApFull());
int numKeyw = 0;
String[] sc = { "(", ")", "&egrave", "&ugrave", "&agrave",
"&igrave" };
String[] scS = { "", "", "è", "ù", "à", "ì" };
while (st.hasMoreTokens()) {
String token = st.nextToken();
for (int i = 0; i < sc.length; i++) {
if (token.indexOf(sc[i]) >= 0)
token = token.replace(sc[i], scS[i]);
}
foundTag = false;
if (token.contains(START_TAG)) {
contMaxMin++;
foundTag = true;
}
if (token.contains(END_TAG)) {
contMaxMin--;
foundTag = true;
}
if (!foundTag && contMaxMin == 0 &&
token.length() > MINCHAR &&
token.length() <= MAXCHAR) {
ek.findByKeyLang(token, lang);
if (ek.getDBState() == 0) {
HelpKeyword hk = new HelpKeyword(getApFull());
hk.setId_help(getId_help());
hk.setLang(lang);
hk.setTheKey(token);
hk.save();
numKeyw++;
System.out.println(token);
}
}
}
rp.setMsg("Creazione keyword per help con chiave " +
getCodice() + ". Create " + numKeyw + " chiavi.");
}
}
return rp;
}
public long getFlgFoglia() {
return this.flgFoglia;
}
public long getFlgVisibile() {
return this.flgVisibile;
}
public long getOrdine() {
return this.ordine;
}
public long getFlgTipoHelp() {
return this.flgTipoHelp;
}
public String getText_it() {
return (this.text_it == null) ? "" : this.text_it.trim();
}
public String getText_en() {
return (this.text_en == null) ? "" : this.text_en.trim();
}
public void setHelpPadre(Help newHelpPadre) {
this.helpPadre = newHelpPadre;
}
public Help getHelpPadre() {
this.helpPadre = (Help)getSecondaryObject((DBAdapter)this.helpPadre, Help.class,
getId_helpPadre());
return this.helpPadre;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
public Vectumerator findByCR(HelpCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select distinct A.* from HELP AS A left join HELP_KEYWORD AS B on A.id_help=B.id_help";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
" ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.codice like '%" + token +
"%' or B.theKey like '%" + token +
"%' or A.titolo_it like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
if (CR.getId_helpPadre() != 0L)
wc.addWc("A.id_helpPadre=" + CR.getId_helpPadre());
if (CR.getFlgVisibile() == 0L) {
wc.addWc("(A.flgVisibile is null or A.flgVisibile=" +
CR.getFlgVisibile() + ")");
} else if (CR.getFlgVisibile() > 0L) {
wc.addWc("A.flgVisibile=" + CR.getFlgVisibile());
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public ResParm addNuovoSottoHelp(Help l_help) {
Help sf = new Help(getApFull());
sf.setDescrizione_it(l_help.getDescrizione_it());
sf.setId_helpPadre(getId_help());
ResParm rp = new ResParm();
rp = sf.save();
return rp;
}
public ResParm addHelpFiglio(Help l_help) {
Help bean = new Help(getApFull());
bean.findByPrimaryKey(l_help.getId_help());
if (((bean.getId_help() == 0L) ? true : false) | (indiciContains(bean.getId_help()) ? false : true)) {
bean.setId_helpPadre(getId_help());
bean.setLivello(l_help.getLivello());
return bean.save();
}
return new ResParm(false,
"Impossibile aggiungere figlio: legame circolare! ");
}
protected String calcolaIndici() {
StringBuffer idx = new StringBuffer(":");
idx.append(calcolaIndiciR());
idx.append(":");
return idx.toString();
}
private StringBuffer calcolaIndiciR() {
StringBuffer idx = new StringBuffer(String.valueOf(getId_help()));
if (getId_helpPadre() != 0L) {
idx.insert(0, ":");
idx.insert(0, (CharSequence)getHelpPadre().calcolaIndiciR());
}
return idx;
}
private long calcolaOrdine() {
try {
String s_sqlFind = "select max(ordine) as _max from HELP WHERE id_help!=" +
getId_help();
if (getId_helpPadre() != 0L) {
s_sqlFind = String.valueOf(s_sqlFind) + " and id_helpPadre=" +
getId_helpPadre();
} else {
s_sqlFind = String.valueOf(s_sqlFind) +
" and (id_helpPadre=0 or id_helpPadre is null)";
}
PreparedStatement ps = getConn().prepareStatement(s_sqlFind);
long res = (long)getMax(ps, true) + 1L;
long decine = res / 10L;
return (decine + 1L) * 10L;
} catch (Exception e) {
handleDebug(e);
return 0L;
}
}
protected void deleteCascade() {
Vectumerator<Help> figli = findFigli(new HelpCR(), 0, 0);
while (figli.hasMoreElements())
figli.nextElement().delete();
}
private Vectumerator xfindFigli(boolean soloVisibili, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from HELP AS A";
String s_Sql_Order = " order by A.ordine, A.descrizione_it";
WcString wc = new WcString();
if (getId_help() == 0L) {
wc.addWc("(A.id_helpPadre=0 or A.id_helpPadre is null)");
} else {
wc.addWc("A.id_helpPadre=" + getId_help());
}
if (soloVisibili)
wc.addWc("(A.flgVisibile=1)");
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findFigliVisibili(int pageNumber, int pageRows) {
HelpCR CR = new HelpCR(getApFull());
CR.setFlgVisibile(1L);
return findFigli(CR, pageNumber, pageRows);
}
public Vectumerator findPadri() {
Vectumerator<Help> vec = new Vectumerator();
Help currentPadre = getHelpPadre();
while (currentPadre.getId_help() != 0L) {
vec.add(currentPadre);
currentPadre = currentPadre.getHelpPadre();
}
vec.setOrderBackward();
return vec;
}
protected boolean indiciContains(long l_key) {
StringTokenizer st = new StringTokenizer(getIndici(), ":");
String s_key = String.valueOf(l_key);
while (st.hasMoreTokens()) {
if (st.nextToken().equals(s_key))
return true;
}
return false;
}
public boolean isFoglia() {
Vectumerator vec = findFigli(1, 1);
if (vec.hasMoreElements())
return false;
return true;
}
protected void prepareSave(PreparedStatement ps) throws SQLException, Exception {
setFlgFoglia((long)(isFoglia() ? 1L : 0L));
if (getOrdine() == 0L)
setOrdine(calcolaOrdine());
if (getId_helpPadre() == 0L) {
setLivello(0L);
} else {
setLivello(getHelpPadre().getLivello() + 1L);
}
super.prepareSave(ps);
}
public ResParm save() {
setIndici(calcolaIndici());
boolean newRecord = (getId_help() == 0L);
String idxPadre = getHelpPadre().getIndici();
String temp = ":" + getId_help() + ":";
if (getId_help() == 0L || idxPadre.indexOf(temp) < 0 || (
getId_help() != 0L && getId_help() != getId_helpPadre())) {
ResParm resParm = super.save();
if (resParm.getStatus() && newRecord) {
setIndici(calcolaIndici());
resParm = super.save();
}
return resParm;
}
ResParm rp = new ResParm(false,
"Impossibile salvare!. Legame circolare.");
return rp;
}
protected boolean useNullFor0() {
return false;
}
public String getCodice() {
return (this.codice == null) ? "" : this.codice.trim();
}
public void setCodice(String codice) {
this.codice = codice;
}
public String getDescrizioneCompleta() {
if (getId_help() == 0L)
return "";
return String.valueOf(getCodice()) + " - " + getTitolo_it();
}
public String getTitolo_en() {
return (this.titolo_en == null) ? "" : this.titolo_en;
}
public void setTitolo_en(String titoloEn) {
this.titolo_en = titoloEn;
}
public String getTitolo_it() {
return (this.titolo_it == null) ? "" : this.titolo_it;
}
public void setTitolo_it(String titoloIt) {
this.titolo_it = titoloIt;
}
public String getDescrizioneCompleta(String lang) {
return String.valueOf(getCodice()) + " - " + getTitolo_it();
}
public Vectumerator findFigli(int pageNumber, int pageRows) {
HelpCR CR = new HelpCR(getApFull());
return findFigli(CR, pageNumber, pageRows);
}
public Vectumerator findFigli(HelpCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from HELP AS A";
String s_Sql_Order = " order by A.ordine, A.titolo_it";
WcString wc = new WcString();
if (getId_help() == 0L) {
wc.addWc("(A.id_helpPadre=0 or A.id_helpPadre is null)");
} else {
wc.addWc("A.id_helpPadre=" + getId_help());
}
if (CR.getFlgVisibile() == 0L) {
wc.addWc("(A.flgVisibile=0 or A.flgVisibile is null)");
} else if (CR.getFlgVisibile() == 1L) {
wc.addWc("A.flgVisibile=1");
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public String getDescrizione4Script() {
return prepareScriptString(getTitolo());
}
public String getDescrizione4Script(String lang) {
return prepareScriptString(getTitolo(lang));
}
public String getDescrizionePadri() {
Vectumerator<Help> vec = findPadri();
StringBuffer temp = new StringBuffer();
while (vec.hasMoreElements()) {
Help row = vec.nextElement();
temp.append(row.getCodice());
if (vec.hasMoreElements())
temp.append("-");
}
return temp.toString();
}
public String getDescrizione_it() {
return (this.descrizione_it == null) ? "" :
this.descrizione_it.trim();
}
public void findByCodice(String l_codice) {
String s_Sql_Find = "select A.* from HELP AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.codice='" + l_codice + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public ResParm addAllegato(HelpAllegato row) {
HelpAllegato bean = new HelpAllegato(getApFull());
bean.findByHelpNomeFile(row.getId_help(), row.getNomeFile());
if (bean.getDBState() == 1)
return new ResParm(false, "Nome File Duplicato");
row.setDBState(0);
ResParm rp = row.save();
return rp;
}
public ResParm delAllegato(HelpAllegato row) {
HelpAllegato bean = new HelpAllegato(getApFull());
bean.findByPrimaryKey(row.getId_helpAllegato());
return bean.delete();
}
public Vectumerator getHelpAllegati() {
return new HelpAllegato(getApFull()).findById_help(getId_help(), 0, 0);
}
public ResParm addHelp(HelpRel row) {
HelpRel bean = new HelpRel(getApFull());
if (row.getId_helpRel() != 0L) {
bean.findByPrimaryKey(row.getId_helpRel());
} else {
bean.findById_helpId_help1(row.getId_help(), row.getId_help1());
}
if (bean.getDBState() == 1) {
row.setDBState(bean.getDBState());
row.setId_helpRel(bean.getId_helpRel());
}
ResParm rp = row.save();
return rp;
}
private String prepareTextHtml(String l_text, HttpServletRequest req) {
String res = l_text;
res = l_text.replaceAll("v/_img", "_img");
return res;
}
public Vectumerator getHelpRel() {
return new HelpRel(getApFull()).findById_help(getId_help(), 0, 0);
}
public String getTextHelpHtml_it(HttpServletRequest req) {
return prepareTextHtml(getText_it(), req);
}
public ResParm delHelp(HelpRel row) {
HelpRel bean = new HelpRel(getApFull());
bean.findByPrimaryKey(row.getId_helpRel());
return bean.delete();
}
public String getTextHelpHtml_en(HttpServletRequest req) {
return prepareTextHtml(getText_en(), req);
}
public String getImgTmst() {
return this.imgTmst;
}
public void setImgTmst(String imgTmst) {
this.imgTmst = imgTmst;
}
public String getImgFileName(int imgNumber) {
return getImgFileName(imgNumber, getImgTmst());
}
public String getImgFileName(int imgNumber, String oldTmst) {
if (oldTmst == null)
oldTmst = "";
return String.valueOf(getId_help()) + "_" + oldTmst + "_" + imgNumber + ".jpg";
}
public String getPathAllegato() {
return getParm("HELP_ATTACH_PATH").getTesto();
}
public String getPathAssolutoExport() {
return String.valueOf(getDocBase()) + getPathTmp() +
getParm("HELP_EXPORT_PATH").getTesto();
}
public String getIndici() {
return (this.indici == null) ? "" : this.indici.trim();
}
public String getTextBreve() {
int LEN = 200;
if (getText().length() <= LEN)
return getText();
return String.valueOf(getText().substring(0, LEN)) + "....";
}
public String getPathAttach() {
return getParm("HELP_IMG_PATH").getTesto();
}
public boolean useDescLangTables() {
return true;
}
public void setText(String newText) {
setDescTxtLang("text", "it", newText);
}
public ResParm exportHelp() {
ResParm rp = new ResParm(true);
HelpAllegato ha = new HelpAllegato(getApFull());
HelpRel hr = new HelpRel(getApFull());
HelpKeyword hkw = new HelpKeyword(getApFull());
try {
copyDir(String.valueOf(getDocBase()) + getPathAllegato(), String.valueOf(getPathAssolutoExport()) +
"_atch/");
copyDir(String.valueOf(getDocBase()) + getPathAttach(), String.valueOf(getPathAssolutoExport()) +
"_img/");
} catch (IOException e) {
rp.setMsg("Errore nella copia delle directory _atch / _img.");
rp.setStatus(false);
e.printStackTrace();
}
DescTxtLang dtl = new DescTxtLang(getApFull());
boolean ok = zipDir(new File(getPathAssolutoExport()), String.valueOf(getDocBase()) +
getPathTmp() + "helpExp.zip", false);
if (!ok) {
rp.setMsg("Errore nella preparazione dello zip.");
rp.setStatus(false);
} else {
rp.setMsg("Esportazione eseguita con successo.");
}
return rp;
}
public ResParm importHelp() {
ResParm rp = new ResParm(true);
File dir = new File(getPathAssolutoExport());
if (dir.exists())
deleteDir(dir);
unzipAndrea(String.valueOf(getDocBase()) + getPathTmp() + "helpExp.zip");
rp = xmlImport(String.valueOf(getPathAssolutoExport()) + "help.xml");
HelpAllegato ha = new HelpAllegato(getApFull());
rp.append(ha.xmlImport(String.valueOf(getPathAssolutoExport()) + "helpAll.xml"));
HelpRel hr = new HelpRel(getApFull());
rp.append(hr.xmlImport(String.valueOf(getPathAssolutoExport()) + "helpRel.xml"));
HelpKeyword hkw = new HelpKeyword(getApFull());
rp.append(hkw.xmlImport(String.valueOf(getPathAssolutoExport()) + "helpKey.xml"));
DescTxtLang dtl = new DescTxtLang(getApFull());
rp.append(dtl.xmlImport(String.valueOf(getPathAssolutoExport()) + "desc_txt_lang.xml"));
try {
copyDir(String.valueOf(getPathAssolutoExport()) + "_atch/", String.valueOf(getDocBase()) +
getPathAllegato());
copyDir(String.valueOf(getPathAssolutoExport()) + "_img/", String.valueOf(getDocBase()) +
getPathAttach());
} catch (IOException e) {
rp.setMsg("Errore nella copia delle directory _atch / _img.");
rp.setStatus(false);
e.printStackTrace();
}
return rp;
}
}

View file

@ -0,0 +1,162 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.db.WcString;
import com.ablia.util.StringTokenizer;
import com.ablia.util.Vectumerator;
import java.io.File;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
import javax.servlet.http.HttpServletRequest;
public class HelpAllegato extends DBAdapter implements Serializable {
private long id_helpAllegato;
private long id_help;
private String nomeFile;
private Help help;
private long flgTipoAllegato;
public HelpAllegato(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public HelpAllegato() {}
public void setId_helpAllegato(long newId_allegato) {
this.id_helpAllegato = newId_allegato;
}
public void setId_help(long newId_help) {
this.id_help = newId_help;
setHelp(null);
}
public void setNomeFile(String newNomeFile) {
this.nomeFile = newNomeFile;
}
public long getId_helpAllegato() {
return this.id_helpAllegato;
}
public long getId_help() {
return this.id_help;
}
public String getNomeFile() {
return (this.nomeFile == null) ? "" : this.nomeFile;
}
public String getNomeFileCompleto() {
return getNomeFileCompleto(getHelp().getPathAttach());
}
private String getNomeFileCompleto(String l_path) {
return String.valueOf(l_path) + getNomeFileSuDisco();
}
public String xgetNomeFileAbsUrl(HttpServletRequest req) {
return String.valueOf(req.getContextPath().equals("/") ? "" : req.getContextPath()) +
"/" + getParm("HELP_ATTACH_PATH").getTesto() +
getId_help() + "_" + getNomeFile();
}
public void setHelp(Help newHelp) {
this.help = newHelp;
}
public Help getHelp() {
this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, getId_help());
return this.help;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {
new File(getNomeFileCompleto()).delete();
}
public Vectumerator findByCR(HelpAllegatoCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from ALLEGATO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
" ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token +
"%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findById_help(long l_id_help, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from HELP_ALLEGATO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_help=" + l_id_help);
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findByHelpNomeFile(long l_id_help, String l_id_nomeFile) {
String s_Sql_Find = "select DISTINCT A.* from HELP_ALLEGATO AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_help=" + l_id_help);
wc.addWc("A.nomeFile='" + l_id_nomeFile + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public long getFlgTipoAllegato() {
return this.flgTipoAllegato;
}
public void setFlgTipoAllegato(long flgTipoAllegato) {
this.flgTipoAllegato = flgTipoAllegato;
}
public String xgetNomeFileRel() {
return String.valueOf(getParm("HELP_ATTACH_PATH").getTesto()) + getId_help() + "_" +
getNomeFile();
}
public String getNomeFileSuDisco() {
return String.valueOf(getId_help()) + "_" + getNomeFile();
}
}

View file

@ -0,0 +1,57 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
public class HelpAllegatoCR extends CRAdapter {
private long id_helpAllegato;
private long id_help;
private String nomeFile;
private Help help;
public HelpAllegatoCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public HelpAllegatoCR() {}
public void setId_helpAllegato(long newId_allegato) {
this.id_helpAllegato = newId_allegato;
}
public void setId_help(long newId_help) {
this.id_help = newId_help;
setHelp(null);
}
public void setNomeFile(String newNomeFile) {
this.nomeFile = newNomeFile;
}
public long getId_helpAllegato() {
return this.id_helpAllegato;
}
public long getId_help() {
return this.id_help;
}
public String getNomeFile() {
return (this.nomeFile == null) ? "" : this.nomeFile;
}
public void setHelp(Help newHelp) {
this.help = newHelp;
}
public Help getHelp() {
this.help = (Help)getSecondaryObject(
(DBAdapter)this.help,
Help.class, getId_help());
return this.help;
}
}

View file

@ -0,0 +1,187 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
public class HelpCR extends CRAdapter {
private long id_help;
private long id_helpPadre;
private String descrizione_it;
private String descrizione_en;
private long livello;
private String indici;
private long flgFoglia;
private long flgVisibile = -1L;
private long ordine;
private long flgTipoHelp;
private String text_it;
private String text_en;
private String keywords_it;
private String keywords_en;
private Help helpPadre;
private String codice;
private String strPathExport;
public HelpCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public HelpCR() {}
public void setId_help(long newId_help) {
this.id_help = newId_help;
}
public void setId_helpPadre(long newId_helpPadre) {
this.id_helpPadre = newId_helpPadre;
setHelpPadre(null);
}
public void setDescrizione_it(String newDescrizione_it) {
this.descrizione_it = newDescrizione_it;
}
public void setDescrizione_en(String newDescrizione_en) {
this.descrizione_en = newDescrizione_en;
}
public void setLivello(long newLivello) {
this.livello = newLivello;
}
public void setIndici(String newIndici) {
this.indici = newIndici;
}
public void setFlgFoglia(long newFlgFoglia) {
this.flgFoglia = newFlgFoglia;
}
public void setFlgVisibile(long newFlgNascondi) {
this.flgVisibile = newFlgNascondi;
}
public void setOrdine(long newOrdine) {
this.ordine = newOrdine;
}
public void setFlgTipoHelp(long newFlgTipoHelp) {
this.flgTipoHelp = newFlgTipoHelp;
}
public void setText_it(String newText_it) {
this.text_it = newText_it;
}
public void setText_en(String newText_en) {
this.text_en = newText_en;
}
public void setKeywords_it(String newKeywords_it) {
this.keywords_it = newKeywords_it;
}
public void setKeywords_en(String newKeywords_en) {
this.keywords_en = newKeywords_en;
}
public long getId_help() {
return this.id_help;
}
public long getId_helpPadre() {
return this.id_helpPadre;
}
public String getDescrizione_it() {
return (this.descrizione_it == null) ? "" : this.descrizione_it.trim();
}
public String getDescrizione_en() {
return (this.descrizione_en == null) ? "" : this.descrizione_en.trim();
}
public long getLivello() {
return this.livello;
}
public String getIndici() {
return (this.indici == null) ? "" : this.indici.trim();
}
public long getFlgFoglia() {
return this.flgFoglia;
}
public long getFlgVisibile() {
return this.flgVisibile;
}
public long getOrdine() {
return this.ordine;
}
public long getFlgTipoHelp() {
return this.flgTipoHelp;
}
public String getText_it() {
return (this.text_it == null) ? "" : this.text_it.trim();
}
public String getText_en() {
return (this.text_en == null) ? "" : this.text_en.trim();
}
public String getKeywords_it() {
return (this.keywords_it == null) ? "" : this.keywords_it.trim();
}
public String getKeywords_en() {
return (this.keywords_en == null) ? "" : this.keywords_en.trim();
}
public void setHelpPadre(Help newHelpPadre) {
this.helpPadre = newHelpPadre;
}
public Help getHelpPadre() {
this.helpPadre = (Help)getSecondaryObject(
(DBAdapter)this.helpPadre,
Help.class, getId_helpPadre());
return this.helpPadre;
}
public String getCodice() {
return (this.codice == null) ? "" : this.codice.trim();
}
public void setCodice(String codice) {
this.codice = codice;
}
public String getStrPathExport() {
return (this.strPathExport == null) ? "xyz" : this.strPathExport;
}
public void setStrPathExport(String pathExport) {
this.strPathExport = pathExport;
}
}

View file

@ -0,0 +1,112 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
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.PreparedStatement;
import java.sql.SQLException;
public class HelpKeyword extends DBAdapter implements Serializable {
private long id_helpKeyword;
private String lang;
private String theKey;
private long id_help;
private Help help;
public HelpKeyword(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public HelpKeyword() {}
public void setId_helpKeyword(long newId_helpKeyword) {
this.id_helpKeyword = newId_helpKeyword;
}
public void setLang(String newLang) {
this.lang = newLang;
}
public void setTheKey(String newTheKey) {
this.theKey = newTheKey;
}
public void setId_help(long newId_help) {
this.id_help = newId_help;
setHelp(null);
}
public long getId_helpKeyword() {
return this.id_helpKeyword;
}
public String getLang() {
return (this.lang == null) ? "" : this.lang.trim();
}
public String getTheKey() {
return (this.theKey == null) ? "" : this.theKey.trim();
}
public long getId_help() {
return this.id_help;
}
public void setHelp(Help newHelp) {
this.help = newHelp;
}
public Help getHelp() {
this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, getId_help());
return this.help;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator findByCR(HelpKeywordCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from HELP_KEYWORD AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
" ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token +
"%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
protected ResParm deleteByHelp(long l_id_help) {
String s_sql_delete = "delete from HELP_KEYWORD where id_help=" +
l_id_help;
return delete(s_sql_delete);
}
}

View file

@ -0,0 +1,67 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
public class HelpKeywordCR extends CRAdapter {
private long id_helpKeyword;
private String lang;
private String theKey;
private long id_help;
private Help help;
public HelpKeywordCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public HelpKeywordCR() {}
public void setId_helpKeyword(long newId_helpKeyword) {
this.id_helpKeyword = newId_helpKeyword;
}
public void setLang(String newLang) {
this.lang = newLang;
}
public void setTheKey(String newTheKey) {
this.theKey = newTheKey;
}
public void setId_help(long newId_help) {
this.id_help = newId_help;
setHelp(null);
}
public long getId_helpKeyword() {
return this.id_helpKeyword;
}
public String getLang() {
return (this.lang == null) ? "" : this.lang.trim();
}
public String getTheKey() {
return (this.theKey == null) ? "" : this.theKey.trim();
}
public long getId_help() {
return this.id_help;
}
public void setHelp(Help newHelp) {
this.help = newHelp;
}
public Help getHelp() {
this.help = (Help)getSecondaryObject(
(DBAdapter)this.help,
Help.class, getId_help());
return this.help;
}
}

View file

@ -0,0 +1,155 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.DBAdapter;
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.PreparedStatement;
import java.sql.SQLException;
public class HelpRel extends DBAdapter implements Serializable {
private long id_helpRel;
private long id_help1;
private long id_help;
private Help help1;
private Help help;
public HelpRel(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public HelpRel() {}
public void setId_helpRel(long newId_helpRel) {
this.id_helpRel = newId_helpRel;
}
public void setId_help1(long newId_help1) {
this.id_help1 = newId_help1;
setHelp1(null);
}
public void setId_help(long newId_help2) {
this.id_help = newId_help2;
setHelp(null);
}
public long getId_helpRel() {
return this.id_helpRel;
}
public long getId_help1() {
return this.id_help1;
}
public long getId_help() {
return this.id_help;
}
public void setHelp1(Help newHelp1) {
this.help1 = newHelp1;
}
public Help getHelp1() {
this.help1 = (Help)getSecondaryObject((DBAdapter)this.help1, Help.class, getId_help1());
return this.help1;
}
public void setHelp(Help newHelp2) {
this.help = newHelp2;
}
public Help getHelp() {
this.help = (Help)getSecondaryObject((DBAdapter)this.help, Help.class, getId_help());
return this.help;
}
protected ResParm checkDeleteCascade() {
return new ResParm(true);
}
protected void deleteCascade() {}
public Vectumerator findByCR(HelpRelCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from HELP_REL AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
if (!CR.getSearchTxt().trim().isEmpty()) {
StringTokenizer st = new StringTokenizer(CR.getSearchTxt().trim(),
" ");
StringBuffer txt = new StringBuffer("(");
while (st.hasMoreTokens()) {
String token = st.nextToken();
txt.append("(A.Cognome like '%" + token +
"%' or A.Nome like '%" + token + "%')");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public Vectumerator findById_help(long l_id_help, int pageNumber, int pageRows) {
String s_Sql_Find = "select DISTINCT A.* from HELP_REL AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("(id_help1=" + l_id_help + " or id_help=" + l_id_help +
")");
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public void findById_helpId_help1(long l_id_help, long l_id_help1) {
String s_Sql_Find = "select DISTINCT A.* from HELP_REL AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("((id_help1=" + l_id_help1 + " and id_help=" + l_id_help +
") or(id_help1=" + l_id_help + " and id_help=" + l_id_help1 +
"))");
try {
PreparedStatement stmt = getConn().prepareStatement(
String.valueOf(s_Sql_Find) + wc.toString() + s_Sql_Order);
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public Help getHelpAssociato(long l_id) {
if (l_id == getId_help1())
return getHelp();
if (l_id == getId_help())
return getHelp1();
return new Help(getApFull());
}
public long getId_help1(long l_id) {
if (l_id == getId_help1())
return getId_help();
if (l_id == getId_help())
return getId_help1();
return 0L;
}
}

View file

@ -0,0 +1,71 @@
package com.ablia.help;
import com.ablia.db.ApplParmFull;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
public class HelpRelCR extends CRAdapter {
private String id_helpRel;
private long id_help1;
private long id_help2;
private Help help1;
private Help help2;
public HelpRelCR(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public HelpRelCR() {}
public void setId_helpRel(String newId_helpRel) {
this.id_helpRel = newId_helpRel;
}
public void setId_help1(long newId_help1) {
this.id_help1 = newId_help1;
setHelp1(null);
}
public void setId_help2(long newId_help2) {
this.id_help2 = newId_help2;
setHelp2(null);
}
public String getId_helpRel() {
return (this.id_helpRel == null) ? "" : this.id_helpRel.trim();
}
public long getId_help1() {
return this.id_help1;
}
public long getId_help2() {
return this.id_help2;
}
public void setHelp1(Help newHelp1) {
this.help1 = newHelp1;
}
public Help getHelp1() {
this.help1 = (Help)getSecondaryObject(
(DBAdapter)this.help1,
Help.class, getId_help1());
return this.help1;
}
public void setHelp2(Help newHelp2) {
this.help2 = newHelp2;
}
public Help getHelp2() {
this.help2 = (Help)getSecondaryObject(
(DBAdapter)this.help2,
Help.class, getId_help2());
return this.help2;
}
}

View file

@ -0,0 +1,33 @@
package com.ablia.help.servlet;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.help.ExcludeKeywords;
import com.ablia.help.ExcludeKeywordsCR;
import com.ablia.servlet.AblServletSvlt;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class ExcludeKeywordsSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter bean, HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new ExcludeKeywords(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new ExcludeKeywordsCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected boolean isSimpleServlet(HttpServletRequest req) {
return true;
}
}

View file

@ -0,0 +1,201 @@
package com.ablia.help.servlet;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.db.ResParm;
import com.ablia.help.Help;
import com.ablia.help.HelpAllegato;
import com.ablia.help.HelpCR;
import com.ablia.help.HelpRel;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.AbMessages;
import com.ablia.util.Vectumerator;
import java.io.File;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelpASvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {
long l_id = 0L;
ResParm rp = new ResParm(true, "");
l_id = getRequestLongParameter(req, "id_help");
Help bean = new Help(getApFull(req));
try {
bean.findByPrimaryKey(l_id);
if (getAct(req).equals("addAllegato")) {
HelpAllegato row = new HelpAllegato(getApFull(req));
fillObject(req, row);
rp = bean.addAllegato(row);
rp.append(creaFileAllegato(bean, req, res));
sendMessage(req, rp.getMsg());
showBean(req, res);
} else if (getAct(req).equals("delAllegato")) {
HelpAllegato row = new HelpAllegato(getApFull(req));
fillObject(req, row);
rp = bean.delAllegato(row);
sendMessage(
req,
String.valueOf(AbMessages.getMessage(getLocale(req),
"SAVE_OK")) + ": Allegato Cancellato");
showBean(req, res);
} else if (getAct(req).equals("addHelp")) {
HelpRel row = new HelpRel(getApFull(req));
if (getRequestLongParameter(req, "id_help") != 0L) {
fillObject(req, row);
rp = bean.addHelp(row);
sendMessage(req, rp.getMsg());
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req),
"READ_FAIL"));
}
showBean(req, res);
} else if (getAct(req).equals("delHelp")) {
HelpRel row = new HelpRel(getApFull(req));
if (getRequestLongParameter(req, "id_help") != 0L) {
fillObject(req, row);
bean.delHelp(row);
sendMessage(req, AbMessages.getMessage(getLocale(req),
"DELETE_OK"));
} else {
sendMessage(req, AbMessages.getMessage(getLocale(req),
"READ_FAIL"));
}
showBean(req, res);
}
} catch (Exception e) {
forceMessage(req,
AbMessages.getMessage(getLocale(req), "SAVE_FAIL"));
showBean(req, res);
}
}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Help bean = (Help)beanA;
req.setAttribute("listaAllegati", bean.getHelpAllegati());
req.setAttribute("listaHelpRel", bean.getHelpRel());
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Help(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new HelpCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected boolean isSimpleServlet(HttpServletRequest req) {
return false;
}
protected void xmanageMultipartRequest(HttpServletRequest req, HttpServletResponse res) {
String targetDir = getParm("PATH_TMP").getTesto();
String[] fileNameParameters = { "nomeFile" };
try {
if (getLoginUserGrant(req, new Help().getTableBeanName()) >= 3L) {
if (manageMultipartRequestParameters(req, 2000,
fileNameParameters, null, null, targetDir)) {
processNoEncTypeRequest(req, res);
} else {
sendGrantMessage(req, AbMessages.getMessage(getLocale(req),
"MR_FILE_ERROR"));
showBean(req, res);
}
} else {
sendGrantMessage(req, AbMessages.getMessage(getLocale(req),
"GRANT_NO_RW"));
showBean(req, res);
}
} catch (Exception e) {
handleDebug(e);
}
}
protected ResParm creaFileAllegato(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
synchronized (this) {
ResParm rp = new ResParm(true, "");
Help bean = (Help)beanA;
String targetDir = String.valueOf(getDocBase()) + bean.getPathAllegato();
File pathDir = new File(targetDir);
if (!pathDir.exists())
pathDir.mkdirs();
String targetFile = String.valueOf(targetDir) + bean.getId_help() + "_";
Vectumerator<String> completeFileNames = (Vectumerator)
req.getAttribute("completeAttachName");
Vectumerator<String> fileNames = (Vectumerator)
req.getAttribute("attachName");
if (completeFileNames.hasMoreElements()) {
String sourceFile = completeFileNames.nextElement();
String fileName = fileNames.elementAt(0);
targetFile = String.valueOf(targetFile) + fileName;
if (isFileExist(sourceFile)) {
new File(targetFile).delete();
new File(sourceFile).renameTo(new File(targetFile));
}
}
return rp;
}
}
protected boolean isLoadImageServlet() {
return true;
}
protected ResParm afterImgFileSave(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Help bean = (Help)beanA;
String oldImgTmst = bean.getImgTmst();
ResParm rp = super.afterImgFileSave(bean, req, res);
String temp = bean.getText();
long l_totImgNumber = getRequestLongParameter(req, "totImgNumber");
if (l_totImgNumber == 0L)
l_totImgNumber = 4L;
for (int i = 1; (long)i <= l_totImgNumber; i++)
temp = temp.replaceAll(bean.getImgFileName(i, oldImgTmst),
bean.getImgFileName(i));
bean.setText(temp);
rp.append(bean.save());
return rp;
}
protected void otherCommands(HttpServletRequest req, HttpServletResponse res) {
if (getCmd(req).equals("idx")) {
Help bean = new Help(getApFull(req));
long l_id_help = getRequestLongParameter(req, "id_help");
bean.findByPrimaryKey(l_id_help);
ResParm rp = bean.indicizzaKeyword();
sendMessage(req, rp.getMsg());
showBean(req, res);
} else if (getCmd(req).equals("idxAll")) {
Help bean = new Help(getApFull(req));
HelpCR CR = new HelpCR(getApFull(req));
fillObject(req, CR);
Vectumerator<Help> vec = bean.findByCR(CR, 0, 0);
int numHelpIdx = 0;
while (vec.hasMoreElements()) {
Help row = vec.nextElement();
ResParm rp = row.indicizzaKeyword();
if (rp.getStatus())
numHelpIdx++;
}
sendMessage(req, "Numero record indicizzati: " + numHelpIdx);
search(req, res);
} else if (getCmd(req).equals("exporta")) {
Help hlp = new Help(getApFull(req));
ResParm rp = hlp.exportHelp();
req.setAttribute("strPathExport", String.valueOf(getPathTmp()) + "helpExp.zip");
sendMessage(req, rp.getMsg());
search(req, res);
} else if (getCmd(req).equals("importa")) {
Help hlp = new Help(getApFull(req));
ResParm rp = hlp.importHelp();
sendMessage(req, rp.getMsg());
search(req, res);
}
super.otherCommands(req, res);
}
}

View file

@ -0,0 +1,89 @@
package com.ablia.help.servlet;
import com.ablia.db.CRAdapter;
import com.ablia.db.DBAdapter;
import com.ablia.help.Help;
import com.ablia.help.HelpCR;
import com.ablia.servlet.AblServletSvlt;
import com.ablia.util.StringTokenizer;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
public class HelpSvlt extends AblServletSvlt {
private static final long serialVersionUID = 1L;
protected void addRows(HttpServletRequest req, HttpServletResponse res) {}
protected void fillComboAfterDetail(DBAdapter beanA, HttpServletRequest req, HttpServletResponse res) {
Help bean = (Help)beanA;
req.setAttribute("listaAllegati", bean.getHelpAllegati());
req.setAttribute("listaPadri", bean.findPadri());
req.setAttribute("listaHelpRel", bean.getHelpRel());
}
protected void fillComboAfterSearch(CRAdapter CR, HttpServletRequest req, HttpServletResponse res) {}
protected DBAdapter getBean(HttpServletRequest req) {
return new Help(getApFull(req));
}
protected CRAdapter getBeanCR(HttpServletRequest req) {
return new HelpCR(getApFull(req));
}
protected void prepareNewRecord(HttpServletRequest req, HttpServletResponse res) {}
protected void sqlActions(HttpServletRequest req, HttpServletResponse res) {
showBean(req, res);
}
protected void search(HttpServletRequest req, HttpServletResponse res) {
HelpCR CR = new HelpCR(getApFull(req));
fillObject(req, CR);
if (CR.getSearchTxt().isEmpty()) {
sendMessage(req, "Campo di ricerca vuoto");
} else {
Help help = new Help(getApFull(req));
req.setAttribute("list",
help.findByCR(CR, getPageNumber(req), getPageRow()));
}
req.setAttribute("CR", CR);
setJspPageRelative("helpCR.jsp", req);
callJsp(req, res);
}
protected boolean isSecureServlet(HttpServletRequest req) {
if (getParm("HELP_PUBLIC_CODES").getTesto().trim()
.equals("*"))
return false;
if (getParm("HELP_PUBLIC_CODES").getTesto().trim()
.isEmpty())
return true;
StringTokenizer st = new StringTokenizer(getParm(
"HELP_PUBLIC_CODES").getTesto().trim(), ",");
while (st.hasMoreTokens()) {
String cod = st.nextToken().trim().toLowerCase();
if (getRequestParameter(req, "cod").toLowerCase()
.indexOf(cod) >= 0)
return false;
}
return true;
}
protected void showBean(HttpServletRequest req, HttpServletResponse res) {
String l_codice = getRequestParameter(req, "cod");
if (!l_codice.isEmpty()) {
Help bean = new Help(getApFull(req));
bean.findByCodice(l_codice);
req.setAttribute("bean", bean);
if (bean.getDBState() == 0)
sendMessage(req, "ERRORE: help per " + l_codice +
" non presente.");
}
super.showBean(req, res);
}
protected String getLoginPage(HttpServletRequest req, HttpServletResponse res) {
return "admin/help/v/helpView.jsp";
}
}

View file

@ -0,0 +1,121 @@
package com.ablia.help.taglib;
import com.ablia.db.DBAdapter;
import com.ablia.help.Help;
import com.ablia.help.HelpCR;
import com.ablia.taglib.AbstractDbTag;
import com.ablia.util.Vectumerator;
import java.io.IOException;
import javax.servlet.jsp.JspException;
public class HelpListJQTreeTag extends AbstractDbTag {
private StringBuffer bodyString;
private Help help;
private long id_help;
private boolean solovisibili;
private HelpCR CR = new HelpCR();
public int doAfterBody() throws JspException {
try {
if (isSolovisibili())
this.CR.setFlgVisibile(1L);
String body = getBodyContent().getString().trim();
if (!body.isEmpty()) {
this.bodyString = new StringBuffer();
this.bodyString.append("<ul id=\"mymenu\" class=\"filetree\">");
Vectumerator<Help> vec = getHelp().findFigli(this.CR, 0, 0);
while (vec.hasMoreElements())
aggiungiFigli(this.bodyString, vec.nextElement());
this.bodyString.append("</ul>");
}
} catch (Exception e) {
this.bodyString.append("Nessu argomento visibile...");
}
return 0;
}
public int doEndTag() throws JspException {
try {
if (getBodyContent() == null)
throw new JspException(
"Tag tarlist: doEndTag(): body content must be NOT empty");
getBodyContent().getEnclosingWriter().print(this.bodyString);
} catch (IOException ioe) {
throw new JspException("Tag HelpListJQTreeTag: doEndTag(): " +
ioe.getMessage());
}
return super.doEndTag();
}
public int doStartTag() {
return 2;
}
protected StringBuffer aggiungiFigli(StringBuffer sb, Help currentHelp) {
long numris = 0L;
if (currentHelp.getId_help() != 0L) {
Vectumerator<Help> vec1 = currentHelp.findFigli(this.CR, 0, 0);
if (vec1.getTotNumberOfRecords() > 0) {
if (currentHelp.getId_help() != 0L) {
sb.append("<li><span class=\"folder\"><a href=\"javascript:selectHelp('");
sb.append(currentHelp.getCodice());
sb.append("')\">");
sb.append(currentHelp.getDescrizione4Script());
sb.append("</a></span>");
}
sb.append("<ul>");
while (vec1.hasMoreElements())
aggiungiFigli(sb, vec1.nextElement());
sb.append("</ul>");
sb.append("</li>\n");
} else {
sb.append("<li><a href=\"javascript:selectHelp('");
sb.append(currentHelp.getCodice());
sb.append("')\">");
sb.append(currentHelp.getDescrizione4Script());
sb.append("</a></li>\n");
}
}
return sb;
}
public Help getHelp() {
if (this.help == null && getId_help() != 0L)
try {
DBAdapter help = getHelpBean();
help.findByPrimaryKey(getId_help());
} catch (Exception e) {
e.printStackTrace();
}
return (this.help == null) ? (Help)getHelpBean() : this.help;
}
public long getId_help() {
return this.id_help;
}
public void setHelp(Help help) {
this.help = help;
}
public void setId_help(long id_help) {
this.id_help = id_help;
setHelp(null);
}
protected DBAdapter getHelpBean() {
return new Help(getApFull());
}
public boolean isSolovisibili() {
return this.solovisibili;
}
public void setSolovisibili(boolean solovisibili) {
this.solovisibili = solovisibili;
}
}

View file

@ -0,0 +1,166 @@
package com.ablia.help.taglib;
import com.ablia.db.DBAdapter;
import com.ablia.help.Help;
import com.ablia.help.HelpCR;
import com.ablia.taglib.AbstractDbTag;
import com.ablia.util.ReturnItem;
import com.ablia.util.Vectumerator;
import java.io.IOException;
import javax.servlet.jsp.JspException;
public class HelpListTreeTag extends AbstractDbTag {
private StringBuffer bodyString;
private long id_help;
private Help help;
private boolean solovisibili;
public int doAfterBody() throws JspException {
try {
String body = getBodyContent().getString().trim();
if (!body.isEmpty()) {
this.bodyString = new StringBuffer();
this.bodyString.append("<script>\nif (document.getElementById) {\n\t");
aggiungiFigli(this.bodyString, getHelp());
this.bodyString.append("document.write(_" + getId_help() + ");");
this.bodyString.append("\n}</script>");
}
return 0;
} catch (Exception e) {
throw new JspException("Tag tarlist: doAfterBody(): " +
e.getMessage());
}
}
public int doEndTag() throws JspException {
try {
if (getBodyContent() == null)
throw new JspException(
"Tag tarlist: doEndTag(): body content must be NOT empty");
getBodyContent().getEnclosingWriter().print(this.bodyString);
} catch (IOException ioe) {
throw new JspException("Tag HelpListTreeTag: doEndTag(): " +
ioe.getMessage());
}
return super.doEndTag();
}
public int doStartTag() {
return 2;
}
protected StringBuffer aggiungiFigli(StringBuffer sb, Help currentHelp) {
HelpCR CR = new HelpCR();
if (isSolovisibili())
CR.setFlgVisibile(1L);
Vectumerator<Help> vec = currentHelp.findFigli(CR, 0, 0);
ReturnItem RI = (ReturnItem)getReq().getAttribute("RI");
if (RI != null) {
RI.setRiValues("");
RI.addRiValues(currentHelp.getId_help());
RI.addRiValues(currentHelp.getDescrizioneCompleta());
}
if (vec.hasMoreElements()) {
sb.append("var _");
sb.append(currentHelp.getId_help());
if (currentHelp.getId_help() != getId_help()) {
sb.append("=new WebFXTreeItem(\"");
} else {
sb.append("=new WebFXTree(\"");
}
if (currentHelp.getId_help() != 0L) {
sb.append(currentHelp.getDescrizione4Script());
} else {
sb.append("Elenco Argomenti");
}
if (RI != null) {
sb.append("\",\"javascript:selectKey(");
sb.append(RI.getSelectedKey());
sb.append(")\");\n\t");
} else {
sb.append("\",\"javascript:selectHelp('");
sb.append(currentHelp.getCodice());
sb.append("')\");\n\t");
}
if (currentHelp.getId_help() != 0L) {
sb.append("_" + currentHelp.getId_helpPadre());
sb.append(".add(_");
sb.append(currentHelp.getId_help());
sb.append(");\n\t");
}
while (vec.hasMoreElements())
aggiungiFigli(sb, vec.nextElement());
} else {
sb.append("_" + currentHelp.getId_helpPadre());
sb.append(".add(new WebFXTreeItem(\"");
sb.append(currentHelp.getDescrizione4Script());
if (RI != null) {
sb.append("\",\"javascript:selectKey(");
sb.append(RI.getSelectedKey());
sb.append(")\"));\n\t");
} else {
sb.append("\",\"javascript:selectHelp('");
sb.append(currentHelp.getCodice());
sb.append("')\"));\n\t");
}
}
return sb;
}
private String getCbName(String fbn) {
int idxStart = fbn.substring(0, fbn.length() - 1).lastIndexOf("/") + 1;
int idxEnd = fbn.length() - 1;
return fbn.substring(idxStart, idxEnd);
}
private String getParentBranchName(String fbn) {
int idxStart = 0;
int idxEnd = fbn.substring(0, fbn.length() - 1).lastIndexOf("/") + 1;
return fbn.substring(idxStart, idxEnd);
}
private String getLeafName(String fbn) {
int idxStart = fbn.substring(0, fbn.length() - 1).lastIndexOf("/") + 1;
int idxEnd = fbn.length();
return fbn.substring(idxStart, idxEnd);
}
public long getId_help() {
return this.id_help;
}
public Help getHelp() {
if (this.help == null && getId_help() != 0L)
try {
DBAdapter help = getHelpBean();
help.findByPrimaryKey(getId_help());
} catch (Exception e) {
e.printStackTrace();
}
return (this.help == null) ? (Help)getHelpBean() : this.help;
}
public void setId_help(long id_help) {
this.id_help = id_help;
setHelp(null);
}
public void setHelp(Help help) {
this.help = help;
}
protected DBAdapter getHelpBean() {
return new Help(getApFull());
}
public boolean isSolovisibili() {
return this.solovisibili;
}
public void setSolovisibili(boolean solovisibili) {
this.solovisibili = solovisibili;
}
}

View file

@ -0,0 +1,134 @@
package com.ablia.help.taglib;
import com.ablia.help.Help;
import com.ablia.help.HelpCR;
import com.ablia.taglib.AbstractDbTag;
import com.ablia.util.Vectumerator;
import java.io.IOException;
import java.io.Writer;
import javax.servlet.jsp.JspException;
public class WhileHelpTag extends AbstractDbTag {
private String rowbeanname;
private Vectumerator theList;
private String lang;
private long id_HelpPadre;
private long id_HelpPadreSelected;
private long id_reparto;
private String flgStockOfferte;
public int doAfterBody() throws JspException {
try {
boolean flgOk = false;
Help obj = null;
while (this.theList.hasMoreElements()) {
if (!(obj = this.theList.nextElement()).getDescrizioneCompleta(getLang()).equals(
"")) {
flgOk = true;
break;
}
}
if (flgOk) {
this.pageContext.setAttribute(getRowbeanname(), obj);
return 2;
}
this.bodyContent.writeOut((Writer)this.bodyContent.getEnclosingWriter());
return 0;
} catch (IOException ioexception) {
throw new JspException(ioexception.getMessage());
} catch (Exception exception) {
throw new JspException(exception.getMessage());
}
}
public void doInitBody() {}
public int doStartTag() {
try {
if (getId_HelpPadre() != 0L &&
getId_HelpPadre() != getId_HelpPadreSelected())
return 0;
Help bean = new Help(getApFull());
if (getId_HelpPadre() != 0L)
bean.findByPrimaryKey(getId_HelpPadre());
HelpCR CR = new HelpCR();
CR.setFlgVisibile(1L);
this.theList = bean.findFigli(CR, 0, 0);
} catch (Exception e) {
this.theList = new Vectumerator();
}
if (this.theList == null)
return 0;
this.pageContext.getRequest().setAttribute("listaTipi", this.theList);
this.theList.moveFirst();
boolean flgOk = false;
Help obj = null;
while (this.theList.hasMoreElements()) {
if (!(obj = this.theList.nextElement()).getDescrizioneCompleta(getLang()).equals(
"")) {
flgOk = true;
break;
}
}
if (flgOk) {
this.pageContext.setAttribute(getRowbeanname(), obj);
return 2;
}
return 0;
}
public String getRowbeanname() {
return (this.rowbeanname == null) ? "rowBean" : this.rowbeanname;
}
public void setRowbeanname(String s) {
this.rowbeanname = s;
}
public long getId_HelpPadreSelected() {
return this.id_HelpPadreSelected;
}
public void setId_HelpPadreSelected(long id_HelpPadreSelected) {
this.id_HelpPadreSelected = id_HelpPadreSelected;
}
public String getLang() {
return (this.lang == null) ? "" : this.lang;
}
public void setLang(String lang) {
this.lang = lang;
}
public long getId_HelpPadre() {
return this.id_HelpPadre;
}
public void setId_HelpPadre(long id_HelpPadre) {
this.id_HelpPadre = id_HelpPadre;
}
public long getId_reparto() {
return this.id_reparto;
}
public void setId_reparto(long id_reparto) {
this.id_reparto = id_reparto;
}
public String getFlgStockOfferte() {
return (this.flgStockOfferte == null) ? "" :
this.flgStockOfferte;
}
public void setFlgStockOfferte(String flgStato) {
this.flgStockOfferte = flgStato;
}
}

View file

@ -0,0 +1,16 @@
package com.ablia.help.taglib;
import javax.servlet.jsp.tagext.TagData;
import javax.servlet.jsp.tagext.TagExtraInfo;
import javax.servlet.jsp.tagext.VariableInfo;
public class WhileHelpTagExtraInfo extends TagExtraInfo {
public VariableInfo[] getVariableInfo(TagData tagdata) {
String rowBeanName = (tagdata.getAttributeString("rowbeanname") != null) ?
tagdata.getAttributeString("rowbeanname") :
"rowBean";
String rowBeanClass = "com.ablia.help.Help";
return
new VariableInfo[] { new VariableInfo(rowBeanName, rowBeanClass, true, 0) };
}
}

View file

@ -0,0 +1,3 @@
Help_0_00_130510
02-05-2014 Allineamento a nuovo versionamento.