package dataaccess;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.text.DateFormat;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.LinkedList;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
public class CVS_modul {
private long m_modul_id;
private String m_modul_name;
private String m_modul_working_file;
private String m_modul_head;
private String m_modul_branch;
private long m_modul_group_id;
private final static DateFormat df = new SimpleDateFormat("yyyy-MM-dd");
public static LinkedList<Long> getModules (Date i_von, Date i_bis, long i_modul_group_id)
{
MysqlDataSource l_ds = DBAccess.ReturnDataSource();
Connection l_con = null;
Statement l_stat = null;
LinkedList<Long> modul_ids = new LinkedList<Long>();
try
{
l_con = l_ds.getConnection();
l_stat = l_con.createStatement();
ResultSet s = l_stat.executeQuery("select modul_id from cvs_modul where modul_id in (select distinct(revision_modul_id) from cvs_revision where from_unixtime(revision_date) > '" +
df.format(i_von) + "' and from_unixtime(revision_date) < '" + df.format(i_bis) + "') and modul_group_id = " + i_modul_group_id);
while (s.next())
{
modul_ids.add(s.getLong("modul_id"));
}
}
catch (Exception e)
{
return null;
}
finally
{
try {
l_stat.close();
l_con.close();
} catch (SQLException e) {
// TODO Auto-generated catch block
e.printStackTrace();
}
}
return modul_ids;
}
public long getM_modul_id() {
return m_modul_id;
}
public void setM_modul_id(long mModulId) {
m_modul_id = mModulId;
}
public String getM_modul_name() {
return m_modul_name;
}
public void setM_modul_name(String mModulName) {
m_modul_name = mModulName;
}
public String getM_modul_working_file() {
return m_modul_working_file;
}
public void setM_modul_working_file(String mModulWorkingFile) {
m_modul_working_file = mModulWorkingFile;
}
public String getM_modul_head() {
return m_modul_head;
}
public void setM_modul_head(String mModulHead) {
m_modul_head = mModulHead;
}
public String getM_modul_branch() {
return m_modul_branch;
}
public void setM_modul_branch(String mModulBranch) {
m_modul_branch = mModulBranch;
}
public long getM_modul_group_id() {
return m_modul_group_id;
}
public void setM_modul_group_id(long mModulGroupId) {
m_modul_group_id = mModulGroupId;
}
}