From: Jonathan C. <jcr...@us...> - 2007-01-17 14:44:58
|
Update of /cvsroot/gmod/apollo/src/java/apollo/dataadapter/gamexml In directory sc8-pr-cvs2.sourceforge.net:/tmp/cvs-serv24832/apollo/dataadapter/gamexml Modified Files: GAMEAdapter.java TransactionXMLAdapter.java Log Message: Moved updateExonID method from TransactionManager into ApolloNameAdapterI (where it belongs). The presence of this method in the TransactionManager class meant that the TransactionManager was in control of setting exon ids, something which should be the sole domain of the name adapter. In order to accomplish this the TransactionManager now holds a pointer to the current CurationState, which allows it to figure out the name adapter for any given feature. That in turn required some minor tweaking to a couple of the dataadapters that use the gamexml's TransactionXMLAdapter, which is one of the two classes that creates new instances of TransactionManager (the other is CurationState itself.) I debated forcing everyone to pass the CurationState to the TransactionManager's constructor but ended up making it a set method for now. Note that there are some comments in the code saying that updateExonID should be updating the exon's name, not its id, but that change doesn't appear to have been made yet. Index: GAMEAdapter.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/dataadapter/gamexml/GAMEAdapter.java,v retrieving revision 1.177 retrieving revision 1.178 diff -C2 -d -r1.177 -r1.178 *** GAMEAdapter.java 29 Dec 2006 16:38:45 -0000 1.177 --- GAMEAdapter.java 17 Jan 2007 14:44:49 -0000 1.178 *************** *** 518,522 **** "Reading transaction file...")); //java.util.List transactions = ! TransactionXMLAdapter.loadTransactions(getInput(), curation); //manager.setTransactions(transactions); } --- 518,522 ---- "Reading transaction file...")); //java.util.List transactions = ! TransactionXMLAdapter.loadTransactions(getInput(), curation, getCurationState()); //manager.setTransactions(transactions); } *************** *** 602,606 **** "Reading transaction file...")); //java.util.List transactions = ! TransactionXMLAdapter.loadTransactions(getInput(), curation_set); //manager.setTransactions(transactions); } --- 602,606 ---- "Reading transaction file...")); //java.util.List transactions = ! TransactionXMLAdapter.loadTransactions(getInput(), curation_set, getCurationState()); //manager.setTransactions(transactions); } *************** *** 2683,2687 **** //List transactions = // sets curations transactions ! adap.getTransFromTopElement(transactionsElement,curation); //if (transactions != null) curation.setTransactions(transactions); } --- 2683,2687 ---- //List transactions = // sets curations transactions ! adap.getTransFromTopElement(transactionsElement,curation,getCurationState()); //if (transactions != null) curation.setTransactions(transactions); } Index: TransactionXMLAdapter.java =================================================================== RCS file: /cvsroot/gmod/apollo/src/java/apollo/dataadapter/gamexml/TransactionXMLAdapter.java,v retrieving revision 1.42 retrieving revision 1.43 diff -C2 -d -r1.42 -r1.43 *** TransactionXMLAdapter.java 29 Dec 2006 16:38:45 -0000 1.42 --- TransactionXMLAdapter.java 17 Jan 2007 14:44:50 -0000 1.43 *************** *** 27,30 **** --- 27,31 ---- import org.w3c.dom.NodeList; + import apollo.dataadapter.CurationState; import apollo.datamodel.AnnotatedFeature; import apollo.datamodel.AnnotatedFeatureI; *************** *** 118,125 **** Needs to be static because it's called from static methods. Is this bad? sets curations transactions */ ! public static void/*List*/ loadTransactions(String fileName, CurationSet curation) throws IOException { TransactionXMLAdapter tnAdapter = new TransactionXMLAdapter(); tnAdapter.setFileName(fileName); ! tnAdapter.load(curation); // no return - sets trans } --- 119,126 ---- Needs to be static because it's called from static methods. Is this bad? sets curations transactions */ ! public static void/*List*/ loadTransactions(String fileName, CurationSet curation, CurationState cs) throws IOException { TransactionXMLAdapter tnAdapter = new TransactionXMLAdapter(); tnAdapter.setFileName(fileName); ! tnAdapter.load(curation, cs); // no return - sets trans } *************** *** 610,614 **** * @throws IOException */ ! private void /*List*/ load(CurationSet curation) throws IOException { // Check if fileName is specified if (fileName == null) --- 611,615 ---- * @throws IOException */ ! private void /*List*/ load(CurationSet curation, CurationState cs) throws IOException { // Check if fileName is specified if (fileName == null) *************** *** 635,647 **** //return ! getTransFromTopElement(root,curation); // sets cur's transactions } /** transElement is the top level "apollo/gameTransactions" xml element that contains all of the transactions */ ! void getTransFromTopElement(Element root, CurationSet curation) { //List transactionList = new ArrayList(); // rename TransactionList? TransactionManager transactionList = new TransactionManager(); if (curation.hasTransactionManager()) transactionList = curation.getTransactionManager(); --- 636,649 ---- //return ! getTransFromTopElement(root,curation,cs); // sets cur's transactions } /** transElement is the top level "apollo/gameTransactions" xml element that contains all of the transactions */ ! void getTransFromTopElement(Element root, CurationSet curation, CurationState cs) { //List transactionList = new ArrayList(); // rename TransactionList? TransactionManager transactionList = new TransactionManager(); + transactionList.setCurationState(cs); if (curation.hasTransactionManager()) transactionList = curation.getTransactionManager(); |