Skip to content
Snippets Groups Projects
Commit 9a246e06 authored by tjc's avatar tjc
Browse files

implement ChadoTransaction.copy() and use when commiting

git-svn-id: svn+ssh://svn.internal.sanger.ac.uk/repos/svn/pathsoft/artemis/trunk@8175 ee4ac58c-ac51-4696-9907-e4b3aa274f04
parent 37e00fd1
Branches
Tags
No related merge requests found
......@@ -92,6 +92,22 @@ public class ChadoTransaction
this.featureKey = featureKey;
}
/**
* Copy this transaction
* @return
*/
public ChadoTransaction copy()
{
final ChadoTransaction tsn = new ChadoTransaction(getType(), getFeatureObject(),
getLastModified(), getGff_feature(),
getFeatureKey(), logComment);
if(uniquename != null)
tsn.setUniquename(uniquename);
tsn.setOldUniquename(old_uniquename);
return tsn;
}
/**
* The type of SQL transaction
......@@ -170,11 +186,6 @@ public class ChadoTransaction
return gff_feature;
}
public void setGff_feature(GFFStreamFeature gff_feature)
{
this.gff_feature = gff_feature;
}
public String getFeatureKey()
{
......
......@@ -2390,20 +2390,22 @@ public class ChadoTransactionManager
final ChadoTransactionManager ctm)
{
DatabaseDocument.initMDC(dbDoc);
commitReturnValue = dbDoc.commit(ctm.getSql(), force);
final Vector sqlCopy = ctm.getSql();
commitReturnValue = dbDoc.commit(sqlCopy, force);
boolean nocommit = true;
if(System.getProperty("nocommit") == null ||
System.getProperty("nocommit").equals("false"))
nocommit = false;
if(commitReturnValue == ctm.getSql().size())
if(commitReturnValue == sqlCopy.size())
{
if(!nocommit)
{
for(int i = 0; i < ctm.getSql().size() && i < commitReturnValue; i++)
for(int i = 0; i < sqlCopy.size() && i < commitReturnValue; i++)
{
ChadoTransaction tsn = (ChadoTransaction) ctm.getSql().get(i);
ChadoTransaction tsn = (ChadoTransaction) sqlCopy.get(i);
logger4j.debug("COMMIT DONE " + tsn.getLogComment());
}
}
......@@ -2414,9 +2416,10 @@ public class ChadoTransactionManager
}
else if(commitReturnValue > 0)
{
ChadoTransaction tsn = (ChadoTransaction) ctm.getSql().get(commitReturnValue);
ChadoTransaction tsn = (ChadoTransaction) sqlCopy.get(commitReturnValue);
logger4j.warn("COMMIT FAILED AT " + tsn.getLogComment());
}
sqlCopy.clear();
}
/**
......@@ -2443,7 +2446,15 @@ public class ChadoTransactionManager
public Vector getSql()
{
return sql;
final Vector tmpSql = new Vector(sql.size());
for(int i=0;i<sql.size();i++)
{
ChadoTransaction tsn = (ChadoTransaction) sql.get(i);
tmpSql.add(tsn.copy());
}
return tmpSql;
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Please register or to comment