[Nmrshiftdb-devel] CVS: nmrshiftdb/src/java/org/openscience/nmrshiftdb/util AllInOne.java,1.6,1.7 Su
Brought to you by:
steinbeck
|
From: Stefan K. <sh...@us...> - 2002-05-31 14:02:27
|
Update of /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/util
In directory usw-pr-cvs1:/tmp/cvs-serv666/src/java/org/openscience/nmrshiftdb/util
Modified Files:
AllInOne.java SubmittingData.java
Log Message:
Added the links to submit and results
Index: AllInOne.java
===================================================================
RCS file: /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/util/AllInOne.java,v
retrieving revision 1.6
retrieving revision 1.7
diff -C2 -r1.6 -r1.7
*** AllInOne.java 30 May 2002 15:02:22 -0000 1.6
--- AllInOne.java 31 May 2002 14:02:21 -0000 1.7
***************
*** 31,34 ****
--- 31,36 ----
private DBBond[] bonds;
private Vector chemNames;
+ private Vector spectrumLinks;
+ private Vector moleculeLinks;
***************
*** 47,52 ****
* @param bonds The bonds
* @param chemNames The chemical names, Vector of DBChemicalName
*/
! public AllInOne(DBMolecule mol, DBSpectrum spec, Vector conditions, Vector spectrumConditions, DBSignal[] signals, Vector shifts, Vector signalAtoms, DBAtom[] atoms, Vector bondAtoms, DBBond[] bonds, Vector chemNames) {
this.mol = mol;
this.spec = spec;
--- 49,56 ----
* @param bonds The bonds
* @param chemNames The chemical names, Vector of DBChemicalName
+ * @param moleculeHyperlinks The links for the molecule, Vector of DBMoleculeHyperlinks
+ * @param spectrumHyperlinks The links for the spectrum, Vector of DBSpectrumHyperlinks
*/
! public AllInOne(DBMolecule mol, DBSpectrum spec, Vector conditions, Vector spectrumConditions, DBSignal[] signals, Vector shifts, Vector signalAtoms, DBAtom[] atoms, Vector bondAtoms, DBBond[] bonds, Vector chemNames, Vector moleculeLinks, Vector spectrumLinks) {
this.mol = mol;
this.spec = spec;
***************
*** 60,63 ****
--- 64,69 ----
this.bonds = bonds;
this.chemNames = chemNames;
+ this.moleculeLinks = moleculeLinks;
+ this.spectrumLinks = spectrumLinks;
}
***************
*** 135,138 ****
--- 141,150 ----
chemName.save();
}
+ for(int i=0;i<moleculeLinks.size();i++){
+ DBMoleculeHyperlink chemName=(DBMoleculeHyperlink)moleculeLinks.get(i);
+ chemName.setNew(true);
+ chemName.setDBMolecule(mol);
+ chemName.save();
+ }
}
crit = new Criteria();
***************
*** 186,189 ****
--- 198,207 ----
speccond.setConditionId(cond.getConditionId());
speccond.save();
+ }
+ for(int i=0;i<spectrumLinks.size();i++){
+ DBSpectrumHyperlink chemName=(DBSpectrumHyperlink)spectrumLinks.get(i);
+ chemName.setNew(true);
+ chemName.setDBSpectrum(spec);
+ chemName.save();
}
Index: SubmittingData.java
===================================================================
RCS file: /cvsroot/nmrshiftdb/nmrshiftdb/src/java/org/openscience/nmrshiftdb/util/SubmittingData.java,v
retrieving revision 1.20
retrieving revision 1.21
diff -C2 -r1.20 -r1.21
*** SubmittingData.java 30 May 2002 15:59:18 -0000 1.20
--- SubmittingData.java 31 May 2002 14:02:21 -0000 1.21
***************
*** 24,37 ****
--- 24,69 ----
//These attributes are used by the save functions
+ /**
+ *Description of the Field
+ */
public Vector chemNames = null;
+ /**
+ *Description of the Field
+ */
public DBAtom[] dbatoms = null;
+ /**
+ *Description of the Field
+ */
public DBBond[] dbbonds = null;
+ /**
+ *Description of the Field
+ */
public DBAtomCount[] dbatomcount = null;
+ /**
+ *Description of the Field
+ */
public Vector bondAtoms = null;
+ /**
+ *Description of the Field
+ */
public Vector dbconditions = null;
+ /**
+ *Description of the Field
+ */
public Vector spectrumConditions = null;
+ /**
+ *Description of the Field
+ */
public DBSignal[] signals = null;
+ /**
+ *Description of the Field
+ */
public Vector shifts = null;
+ /**
+ *Description of the Field
+ */
public Vector signalAtoms = null;
+ public Vector spectrumHyperlinks = null;
+ public Vector moleculeHyperlinks = null;
//These attributes represent the collected data of a submit process
String molecule = "";
***************
*** 44,48 ****
int level = 1;
DBSpectrumType choosenSpectrumType = null;
! private boolean keepAssignmentEntries = false;
--- 76,82 ----
int level = 1;
DBSpectrumType choosenSpectrumType = null;
! boolean keepAssignmentEntries = false;
! String moleculeLinks = "";
! String spectrumLinks = "";
***************
*** 122,125 ****
--- 156,179 ----
/**
+ *Sets the moleculeLink attribute of the SubmittingData object
+ *
+ * @param link The new moleculeLink value
+ */
+ public void setMoleculeLinks(String link) {
+ moleculeLinks = link;
+ }
+
+
+ /**
+ *Sets the spectrumLink attribute of the SubmittingData object
+ *
+ * @param link The new spectrumLink value
+ */
+ public void setSpectrumLinks(String link) {
+ spectrumLinks = link;
+ }
+
+
+ /**
*Sets the signalstable attribute of the SubmittingData object
*
***************
*** 228,231 ****
--- 282,305 ----
+ /**
+ *Gets the moleculeLink attribute of the SubmittingData object
+ *
+ * @return The moleculeLink value
+ */
+ public String getMoleculeLinks() {
+ return (moleculeLinks);
+ }
+
+
+ /**
+ *Gets the spectrumLink attribute of the SubmittingData object
+ *
+ * @return The spectrumLink value
+ */
+ public String getSpectrumLinks() {
+ return (spectrumLinks);
+ }
+
+
/**
***************
*** 330,337 ****
* @param userKey The submitter
* @param chemName The chemical names, as typed by the user
* @return The saved molecule
* @exception Exception Something wrong with the database
*/
! public DBMolecule saveMolecule(Molecule mol, Molecule molWithH, String structureFile, Date now, String casNumber, String nmrshiftdbnr, NumberKey userKey, String chemName) throws Exception {
SmilesGenerator sg = new SmilesGenerator();
MFAnalyser mfa = new MFAnalyser(molWithH);
--- 404,412 ----
* @param userKey The submitter
* @param chemName The chemical names, as typed by the user
+ * @param spectrumLinks The links for the molecule
* @return The saved molecule
* @exception Exception Something wrong with the database
*/
! public DBMolecule saveMolecule(Molecule mol, Molecule molWithH, String structureFile, Date now, String casNumber, String nmrshiftdbnr, NumberKey userKey, String chemName, String moleculeLinks) throws Exception {
SmilesGenerator sg = new SmilesGenerator();
MFAnalyser mfa = new MFAnalyser(molWithH);
***************
*** 354,358 ****
dbmol.save();
Log.debug("after insert bonds");
! StringTokenizer tokenizer = new StringTokenizer(chemName, "\n");
chemNames = new Vector();
while (tokenizer.hasMoreTokens()) {
--- 429,433 ----
dbmol.save();
Log.debug("after insert bonds");
! StringTokenizer tokenizer = new StringTokenizer(chemName, "\n\r");
chemNames = new Vector();
while (tokenizer.hasMoreTokens()) {
***************
*** 409,412 ****
--- 484,504 ----
}
Log.debug("after insert bonds");
+ moleculeHyperlinks=new Vector();
+ StringTokenizer st=new StringTokenizer(moleculeLinks, "\n\r");
+ while (st.hasMoreTokens()) {
+ String line=st.nextToken();
+ StringTokenizer localst=new StringTokenizer(line, ";");
+ DBMoleculeHyperlink mhl=new DBMoleculeHyperlink();
+ mhl.setDBMolecule(dbmol);
+ mhl.setHyperlink(localst.nextToken());
+ if(localst.hasMoreTokens())
+ mhl.setDescription(localst.nextToken());
+ else
+ mhl.setDescription("<i>No description available</i>");
+ if(!moleculeHyperlinks.contains(mhl))
+ mhl.save();
+ moleculeHyperlinks.add(mhl);
+ }
+ Log.debug("after insert molcule links");
return (dbmol);
}
***************
*** 425,433 ****
* @param signalstable The signals as a vector of valueTriples
* @param molWithH The molecule as cdk molecule including implicit hs
! * @param reiewFlag The reviewFlag set to the spectra
* @return The saved spectrum
* @exception Exception Something wrong with the database
*/
! public DBSpectrum saveSpectrum(Date now, String literature, DBMolecule dbmol, NumberKey userKey, DBSpectrumType choosenSpectrumType, String spectrumForApplet, String nmrshiftdbnr, Vector originalConditions, Vector signalstable, Molecule molWithH, String reviewFlag) throws Exception {
DBSpectrum spectrum = new DBSpectrum();
spectrum.setDate(now);
--- 517,527 ----
* @param signalstable The signals as a vector of valueTriples
* @param molWithH The molecule as cdk molecule including implicit hs
! * @param nmrshiftdbnr The nmrshiftdb number
! * @param reviewFlag The value the reviewFlag should be set to
! * @param spectrumLinks The links for the spectrum
* @return The saved spectrum
* @exception Exception Something wrong with the database
*/
! public DBSpectrum saveSpectrum(Date now, String literature, DBMolecule dbmol, NumberKey userKey, DBSpectrumType choosenSpectrumType, String spectrumForApplet, String nmrshiftdbnr, Vector originalConditions, Vector signalstable, Molecule molWithH, String reviewFlag, String spectrumLinks) throws Exception {
DBSpectrum spectrum = new DBSpectrum();
spectrum.setDate(now);
***************
*** 557,560 ****
--- 651,674 ----
spectrum.setFingerprint(SpectrumUtils.makeFingerprint(spectrum));
spectrum.save();
+ spectrumHyperlinks=new Vector();
+ StringTokenizer st=new StringTokenizer(spectrumLinks, "\n\r");
+ while (st.hasMoreTokens()) {
+ String line=st.nextToken();
+ StringTokenizer localst=new StringTokenizer(line, ";");
+ DBSpectrumHyperlink shl=new DBSpectrumHyperlink();
+ shl.setDBSpectrum(spectrum);
+ String link=localst.nextToken();
+ if(link.length()<8||!link.substring(0,7).equals("http://"))
+ link="http://"+link;
+ shl.setHyperlink(link);
+ if(localst.hasMoreTokens())
+ shl.setDescription(localst.nextToken());
+ else
+ shl.setDescription("<i>No description available</i>");
+ if(!spectrumHyperlinks.contains(shl))
+ shl.save();
+ spectrumHyperlinks.add(shl);
+ }
+ Log.debug("after insert spectrum links");
return spectrum;
}
|