Regalamiunsorriso/decompiled-libs/www/acxent-common-1.0.1/it/acxent/newsletter/AllegatoTemplateMsg.java

136 lines
4 KiB
Java

package it.acxent.newsletter;
import it.acxent.contab._ContabAdapter;
import it.acxent.db.ApplParmFull;
import it.acxent.db.WcString;
import it.acxent.util.StringTokenizer;
import it.acxent.util.Vectumerator;
import java.io.Serializable;
import java.sql.PreparedStatement;
import java.sql.SQLException;
public class AllegatoTemplateMsg extends _ContabAdapter implements Serializable {
private long id_allegatoTemplateMsg;
private long id_templateMsg;
private String nomeFile;
private TemplateMsg templateMsg;
public AllegatoTemplateMsg(ApplParmFull newApplParmFull) {
super(newApplParmFull);
}
public AllegatoTemplateMsg() {}
public void setId_allegatoTemplateMsg(long newId_allegatoTemplateMsg) {
this.id_allegatoTemplateMsg = newId_allegatoTemplateMsg;
}
public void setId_templateMsg(long newId_templateMsg) {
this.id_templateMsg = newId_templateMsg;
setTemplateMsg(null);
}
public void setNomeFile(String newNomeFile) {
this.nomeFile = newNomeFile;
}
public long getId_allegatoTemplateMsg() {
return this.id_allegatoTemplateMsg;
}
public long getId_templateMsg() {
return this.id_templateMsg;
}
public String getNomeFile() {
return (this.nomeFile == null) ? "" : this.nomeFile.trim();
}
public void setTemplateMsg(TemplateMsg newTemplateMsg) {
this.templateMsg = newTemplateMsg;
}
public TemplateMsg getTemplateMsg() {
this.templateMsg = (TemplateMsg)getSecondaryObject(this.templateMsg, TemplateMsg.class,
getId_templateMsg());
return this.templateMsg;
}
protected void deleteCascade() {}
public Vectumerator findByCR(AllegatoTemplateMsgCR CR, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ALLEGATO_TEMPLATE_MSG 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.nomeFile like '%" + token + "%' )");
if (st.hasMoreTokens())
txt.append(" and ");
}
txt.append(")");
wc.addWc(txt.toString());
}
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find + wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
removeCPConnection();
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
public String getNomeFileCompleto() {
return getNomeFileCompleto(getTemplateMsg().getPathAllegato());
}
public String getNomeFileCompleto(String l_path) {
return l_path + l_path;
}
public String getNomeFileSuDisco() {
return "" + getId_templateMsg() + "_" + getId_templateMsg();
}
protected int getStringValueCase(String l_colomnName) {
return 0;
}
public void findByTemplateMsgNomeFile(long l_id_templateMsg, String l_id_nomeFile) {
String s_Sql_Find = "select A.* from ALLEGATO_TEMPLATE_MSG AS A";
String s_Sql_Order = "";
WcString wc = new WcString();
wc.addWc("A.id_templateMsg=" + l_id_templateMsg);
wc.addWc("A.nomeFile='" + l_id_nomeFile + "'");
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find +
wc.toString());
findFirstRecord(stmt);
} catch (SQLException e) {
handleDebug(e);
}
}
public Vectumerator findByTemplateMsg(long l_id_templateMsg, int pageNumber, int pageRows) {
String s_Sql_Find = "select A.* from ALLEGATO_TEMPLATE_MSG AS A";
String s_Sql_Order = " order by A.nomeFile";
WcString wc = new WcString();
wc.addWc("A.id_templateMsg=" + l_id_templateMsg);
try {
PreparedStatement stmt = getConn().prepareStatement(s_Sql_Find + s_Sql_Find +
wc.toString());
return findRows(stmt, pageNumber, pageRows);
} catch (SQLException e) {
handleDebug(e);
return AB_EMPTY_VECTUMERATOR;
}
}
}