package dataaccess;
import java.sql.Connection;
import java.sql.ResultSet;
import java.sql.SQLException;
import java.sql.Statement;
import java.util.Hashtable;
import java.util.LinkedList;
import java.util.List;
import com.mysql.jdbc.jdbc2.optional.MysqlDataSource;
public class ArtifactGroupList {
private long m_group_artifact_id;
private long m_group_id;
private String m_name;
public ArtifactGroupList()
{
m_group_artifact_id=0;
m_group_id=0;
m_name=null;
}
public ArtifactGroupList(long group_artifact_id, long group_id, String name)
{
m_group_artifact_id=group_artifact_id;
m_group_id=group_id;
m_name=name;
}
public static LinkedList<Long> getGroupArtifactIDsByGroupID(long group_id)
{
MysqlDataSource l_ds = DBAccess.ReturnDataSource();
Connection l_con = null;
Statement l_stat = null;
LinkedList<Long> l_group_artifact_ids = new LinkedList<Long>();
try
{
l_con = l_ds.getConnection();
l_stat = l_con.createStatement();
ResultSet s = l_stat.executeQuery("select group_artifact_id from artifact_group_list where group_id = " + group_id);
while (s.next())
{
l_group_artifact_ids.add(s.getLong("group_artifact_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 l_group_artifact_ids;
}
}