Skip to content
Snippets Groups Projects
Commit 4ed97401 authored by tjc's avatar tjc
Browse files

change name to ChadoFeature

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@4173 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 8a13b15d
Branches
Tags
No related merge requests found
......@@ -7,12 +7,12 @@
<sqlMap namespace="Feature">
<parameterMap id="schema-cvlist" class="uk.ac.sanger.ibatis.SchemaCVList">
<parameterMap id="schema-cvlist" class="uk.ac.sanger.artemis.chado.SchemaCVList">
<parameter property="schema" javaType="java.lang.String"/>
<parameter property="cvlist" javaType="java.util.List"/>
</parameterMap>
<resultMap id="select-feature-properties-result" class="uk.ac.sanger.ibatis.Feature">
<resultMap id="select-feature-properties-result" class="uk.ac.sanger.artemis.chado.ChadoFeature">
<result property="timelastmodified" column="timelastmodified"/>
<result property="id" column="id"/>
<result property="object_id" column="object_id"/>
......@@ -26,7 +26,7 @@
<result property="phase" column="phase" nullValue="10"/>
</resultMap>
<resultMap id="select-feature-result" class="uk.ac.sanger.ibatis.Feature">
<resultMap id="select-feature-result" class="uk.ac.sanger.artemis.chado.ChadoFeature">
<result property="id" column="id"/>
<result property="uniquename" column="uniquename"/>
<result property="name" column="name"/>
......@@ -38,12 +38,12 @@
<result property="strand" column="strand" nullValue="0" />
</resultMap>
<resultMap id="select-feature-sequence-result" class="uk.ac.sanger.ibatis.Feature">
<resultMap id="select-feature-sequence-result" class="uk.ac.sanger.artemis.chado.ChadoFeature">
<result property="name" column="name"/>
<result property="residues" column="residues"/>
</resultMap>
<resultMap id="select-feature-with-residues-result" class="uk.ac.sanger.ibatis.Feature">
<resultMap id="select-feature-with-residues-result" class="uk.ac.sanger.artemis.chado.ChadoFeature">
<result property="abbreviation" column="abbreviation"/>
<result property="name" column="name"/>
<result property="id" column="feature_id"/>
......@@ -52,7 +52,7 @@
<!-- get feature name -->
<select id="getFeatureName" parameterClass="uk.ac.sanger.ibatis.Feature"
<select id="getFeatureName" parameterClass="uk.ac.sanger.artemis.chado.ChadoFeature"
resultClass="java.lang.String">
SELECT
name
......@@ -68,7 +68,7 @@
</iterate>
</select>
<select id="getGffLine" parameterClass="uk.ac.sanger.ibatis.Feature"
<select id="getGffLine" parameterClass="uk.ac.sanger.artemis.chado.ChadoFeature"
resultMap="select-feature-properties-result">
SELECT
timelastmodified,
......@@ -99,7 +99,7 @@
ORDER BY f.type_id, uniquename
</select>
<select id="getSequence" parameterClass="uk.ac.sanger.ibatis.Feature"
<select id="getSequence" parameterClass="uk.ac.sanger.artemis.chado.ChadoFeature"
resultMap="select-feature-sequence-result">
SELECT
name,
......@@ -136,7 +136,7 @@
ORDER BY abbreviation
</select>
<select id="getFeature" resultMap ="select-feature-result" parameterClass="uk.ac.sanger.ibatis.Feature">
<select id="getFeature" resultMap ="select-feature-result" parameterClass="uk.ac.sanger.artemis.chado.ChadoFeature">
SELECT
$schema$.feature.feature_id AS id,
uniquename,
......
......@@ -38,7 +38,7 @@ public interface ChadoDAO
* @param schema schema/organism name or null
*
*/
public Feature getSequence(final int feature_id,
public ChadoFeature getSequence(final int feature_id,
final String schema)
throws SQLException;
......@@ -91,7 +91,7 @@ public interface ChadoDAO
/**
*
* Get available schemas (as a List of Feature objects).
* Get available schemas (as a List of ChadoFeature objects).
*
*/
public List getSchema()
......
/* Feature.java
/* ChadoFeature.java
*
* created: 2005
*
......@@ -29,7 +29,7 @@ import java.util.Date;
import java.util.Hashtable;
import java.util.Vector;
public class Feature
public class ChadoFeature
{
/** schema */
......
......@@ -35,12 +35,19 @@ import java.util.StringTokenizer;
**/
public class ChadoTransaction
{
//
// ATTRIBUTE TRANSACTIONS
/** update statement */
public static final int UPDATE = 1;
/** insert statement */
public static final int INSERT = 2;
/** delete statement */
public static final int DELETE = 3;
// FEATURE TRANSACTIONS
/** insert feature statement */
public static final int INSERT_FEATURE = 4;
/** properties store */
private List properties;
/** old properties store */
......@@ -71,6 +78,17 @@ public class ChadoTransaction
this.chadoTable = chadoTable;
}
/**
*
* @param type transaction type
* @param uniquename uniquename of feature
*
*/
public ChadoTransaction(int type, ChadoFeature new_feature)
{
this.type = type;
}
/**
*
*
......@@ -144,7 +162,7 @@ public class ChadoTransaction
{
if(constraint == null)
constraint = new Vector();
constraint.add(name+"="+"\'"+value+"\'");
constraint.add(name+"="+value);
}
......@@ -183,7 +201,6 @@ public class ChadoTransaction
return propertiesName;
}
/**
*
* Get properties to this transaction that will be changed.
......@@ -214,7 +231,6 @@ public class ChadoTransaction
return constraint;
}
/**
*
* Get uniquenames of features.
......@@ -230,21 +246,26 @@ public class ChadoTransaction
}
return names;
// String str_names[] = new String[names.size()];
// for(int i=0; i<str_names.length; i++)
// str_names[i] = (String)names.get(i);
// return str_names;
}
/**
*
* Set the feature id
*
*/
public void setFeature_id(final int feature_id)
{
this.feature_id = feature_id;
}
/**
*
* Get the feature id
*
*/
public int getFeature_id()
{
return feature_id;
}
}
......@@ -146,7 +146,7 @@ public class ChadoTransactionManager
{
feature_uniquename = JOptionPane.showInputDialog(null,
"Provide a systematic_id : ",
"systematic_id missing "+
"systematic_id missing in "+
feature.getIDString(),
JOptionPane.QUESTION_MESSAGE).trim();
}
......@@ -161,7 +161,11 @@ public class ChadoTransactionManager
else
System.out.println("HERE feature_uniquename != null "+feature_uniquename);
// ChadoTransaction tsn = new ChadoTransaction(ChadoTransaction.INSERT,
/*
ChadoTransaction tsn = new ChadoTransaction(ChadoTransaction.INSERT_FEATURE,
feature);
*/
}
......
......@@ -42,7 +42,7 @@ public class IBatisDAO implements ChadoDAO
* Get feature name given the feature_id and schema
*
*/
public String getFeatureName(final Feature feature)
public String getFeatureName(final ChadoFeature feature)
throws SQLException
{
SqlMapClient sqlMap = DbSqlConfig.getSqlMapInstance();
......@@ -60,7 +60,7 @@ public class IBatisDAO implements ChadoDAO
final String schema)
throws SQLException
{
Feature feature = new Feature();
ChadoFeature feature = new ChadoFeature();
feature.setId(feature_id);
if(schema != null)
feature.setSchema(schema);
......@@ -81,7 +81,7 @@ public class IBatisDAO implements ChadoDAO
throws SQLException
{
SqlMapClient sqlMap = DbSqlConfig.getSqlMapInstance();
Feature feature = new Feature();
ChadoFeature feature = new ChadoFeature();
feature.setId(feature_id);
if(schema != null)
feature.setSchema(schema);
......@@ -99,16 +99,16 @@ public class IBatisDAO implements ChadoDAO
* @param schema schema/organism name or null
*
*/
public Feature getSequence(final int feature_id,
public ChadoFeature getSequence(final int feature_id,
final String schema)
throws SQLException
{
SqlMapClient sqlMap = DbSqlConfig.getSqlMapInstance();
Feature feature = new Feature();
ChadoFeature feature = new ChadoFeature();
feature.setId(feature_id);
if(schema != null)
feature.setSchema(schema);
return (Feature)sqlMap.queryForObject("getSequence",
return (ChadoFeature)sqlMap.queryForObject("getSequence",
feature);
}
......@@ -150,7 +150,7 @@ public class IBatisDAO implements ChadoDAO
/**
*
* Get available schemas (as a List of Feature objects)
* Get available schemas (as a List of ChadoFeature objects)
*
*/
public List getSchema()
......
......@@ -58,7 +58,7 @@ public class JdbcDAO
return conn;
}
public Feature getSequence(final int feature_id,
public ChadoFeature getSequence(final int feature_id,
final String schema)
throws SQLException
{
......@@ -71,7 +71,7 @@ public class JdbcDAO
ResultSet rs = st.executeQuery(sql);
rs.next();
Feature feature = new Feature();
ChadoFeature feature = new ChadoFeature();
feature.setName(rs.getString("name"));
feature.setResidues(rs.getBytes("residues"));
return feature;
......@@ -135,7 +135,7 @@ public class JdbcDAO
List list = new Vector();
while(rs.next())
{
Feature feature = new Feature();
ChadoFeature feature = new ChadoFeature();
feature.setFmin( rs.getInt("fmin") );
feature.setFmax( rs.getInt("fmax") );
feature.setType_id( rs.getLong("type_id") );
......@@ -175,18 +175,18 @@ public class JdbcDAO
// merge same features in the list
int feature_size = list.size();
List flatten_list = new Vector();
Feature featNext = null;
ChadoFeature featNext = null;
for(int i = 0; i < feature_size; i++)
{
Feature feat = (Feature)list.get(i);
ChadoFeature feat = (ChadoFeature)list.get(i);
String name = feat.getUniquename();
feat.addQualifier(feat.getProp_type_id(),
feat.getValue());
if(i < feature_size - 1)
featNext = (Feature)list.get(i + 1);
featNext = (ChadoFeature)list.get(i + 1);
// merge next line if part of the same feature
while(featNext != null && featNext.getUniquename().equals(name))
......@@ -195,7 +195,7 @@ public class JdbcDAO
featNext.getValue());
i++;
if(i < feature_size - 1)
featNext = (Feature)list.get(i + 1);
featNext = (ChadoFeature)list.get(i + 1);
else
break;
}
......@@ -240,7 +240,7 @@ public class JdbcDAO
List list = new Vector();
while(rs.next())
{
Feature feature = new Feature();
ChadoFeature feature = new ChadoFeature();
feature.setId( rs.getInt("feature_id") );
feature.setAbbreviation( rs.getString("abbreviation") );
feature.setName( rs.getString("name") );
......@@ -279,7 +279,7 @@ public class JdbcDAO
/**
*
* Get available schemas (as a List of Feature objects)
* Get available schemas (as a List of ChadoFeature objects)
*
*/
public List getSchema()
......
......@@ -370,7 +370,7 @@ public class DatabaseDocument extends Document
// build feature name store
for(int i = 0; i < feature_size; i++)
{
Feature feat = (Feature)featList.get(i);
ChadoFeature feat = (ChadoFeature)featList.get(i);
String name = feat.getUniquename();
String feature_id = Integer.toString(feat.getId());
......@@ -379,7 +379,7 @@ public class DatabaseDocument extends Document
for(int i = 0; i < feature_size; i++)
{
Feature feat = (Feature)featList.get(i);
ChadoFeature feat = (ChadoFeature)featList.get(i);
int fmin = feat.getFmin() + 1;
int fmax = feat.getFmax();
long type_id = feat.getType_id();
......@@ -536,7 +536,7 @@ public class DatabaseDocument extends Document
private ByteBuffer getSequence(ChadoDAO dao, ByteBuffer buff)
throws java.sql.SQLException
{
Feature feature = dao.getSequence(Integer.parseInt(feature_id),
ChadoFeature feature = dao.getSequence(Integer.parseInt(feature_id),
schema);
buff.append("##FASTA\n>");
......@@ -582,7 +582,7 @@ public class DatabaseDocument extends Document
Iterator it_residue_features = list_residue_features.iterator();
while(it_residue_features.hasNext())
{
Feature feature = (Feature)it_residue_features.next();
ChadoFeature feature = (ChadoFeature)it_residue_features.next();
String org = feature.getAbbreviation();
String typeName = getCvtermName(feature.getType_id());
......@@ -733,7 +733,7 @@ public class DatabaseDocument extends Document
DbSqlConfig.init(new JPasswordField());
SqlMapClient sqlMap = DbSqlConfig.getSqlMapInstance();
Feature feature = new Feature();
ChadoFeature feature = new ChadoFeature();
feature.setId(Integer.parseInt(args[0]));
feature.setSchema(args[1]);
......@@ -741,7 +741,7 @@ public class DatabaseDocument extends Document
for(int i = 0; i < featureList.size(); i++)
{
feature = (Feature)featureList.get(i);
feature = (ChadoFeature)featureList.get(i);
int fmin = feature.getFmin() + 1;
int fmax = feature.getFmax();
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment