Docjar: A Java Source and Docuemnt Enginecom.*    java.*    javax.*    org.*    all    new    plug-in

Quick Search    Search Deep

Source code: org/biomage/BioMaterial/BioSource.java


1   /***************************************************************************  
2    *                                                                         *
3    * C O P Y R I G H T   N O T I C E                                         * 
4    *  Copyright (c) 2001 by:                                                 *
5    *    * The MicroArray Gene Expression Database group (MGED)               *
6    *    * Rosetta Inpharmatics                                               *
7    *                                                                         *
8    *    All Rights Reserved.                                                 *
9    *                                                                         *
10   * Permission is hereby granted, free of charge, to any person             *
11   * obtaining a copy of this software and associated documentation files    *
12   * (the "Software"), to deal in the Software without restriction,          *
13   * including without limitation the rights to use, copy, modify, merge,    *
14   * publish, distribute, sublicense, and/or sell copies of the Software,    *
15   * and to permit persons to whom the Software is furnished to do so,       *
16   * subject to the following conditions:                                    *
17   *                                                                         *
18   * The above copyright notice and this permission notice shall be          *
19   * included in all copies or substantial portions of the Software.         *
20   *                                                                         *
21   * THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND,         *
22   * EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF      * 
23   * MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND                   *
24   * NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS     *
25   * BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN      *
26   * ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN       *
27   * CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE        *
28   * SOFTWARE.                                                               *
29   ***************************************************************************
30   *                                                                         *
31   * Created by the create_mage_java_classes java program based on the       * 
32   * information in the xmi file created from the MAGE-OM UML model,         *
33   * copyright European Bioinformatics Institute (EBI) for MGED and Rosetta  *
34   * Informatics.                                                            *
35   *                                                                         *
36   * The ideas and work are built on the previous work in perl of Jason      *
37   * Stewart, Open Informatics, and Robert M. Hubley, Institute for Systems  *
38   * Biology                                                                 *
39   *                                                                         *
40   * @author  Michael Miller, Rosetta Inpharmatics                           *
41   * @version Revision: 1.0                                                  *
42   * @date    Thu, Feb 21, 2002 10:46:07 AM                                  *
43   *                                                                         *
44   ***************************************************************************
45   */
46  
47  /**
48   *  org.biomage.BioMaterial
49   *  
50   */
51  package org.biomage.BioMaterial;
52  
53  /**
54   *  Import list for BioSource
55   *  
56   */
57  import java.io.Serializable;
58  import java.util.*;
59  import org.xml.sax.Attributes;
60  import java.io.Writer;
61  import java.io.IOException;
62  import org.biomage.Interface.HasSourceContact;
63  import org.biomage.AuditAndSecurity.Contact;
64  
65  /**
66   *  The BioSource is the original source material before any treatment 
67   *  events.  It is also a top node of the directed acyclic graph generated 
68   *  by treatments.   The association to OntologyEntry allows enumeration of 
69   *  a BioSource's inherent properties.
70   *  
71   */
72  public
73  class BioSource
74      extends BioMaterial
75      implements Serializable,
76          HasSourceContact
77  {
78      /**
79       *  The BioSource's source is the provider of the biological material 
80       *  (a cell line, strain, etc...).  This could be the ATTC (American 
81       *  Tissue Type Collection).
82       *  
83       */
84      private Contact sourceContact;
85  
86  
87      /**
88       *  Default constructor.
89       *  
90       */
91      public
92      BioSource()
93      {
94          super();
95      }
96  
97      /**
98       *  Attribute constructor.
99       *  
100      *  Looks up the attributes in the parameter and casts them from strings 
101      *  appropriately
102      *  @param atts: the attribute list.
103      *  
104      */
105     // TODO Work in progress (attribute constructor).
106     public
107     BioSource(Attributes atts)
108     {
109         super(atts);
110 
111     }
112 
113     /**
114      *  writeMAGEML
115      *  <p>
116      *  This method is responsible for assembling the attribute and 
117      *  association data into XML. It creates the object tag and then calls 
118      *  the writeAttributes and writeAssociation methods.
119      *  <p>
120      *  
121      */
122     public
123     void
124     writeMAGEML(Writer out)
125     throws IOException
126     {
127         out.write("<BioSource");
128         writeAttributes(out);
129         out.write(">");
130         writeAssociations(out);
131         out.write("</BioSource>");
132     }
133 
134     /**
135      *  writeAttributes
136      *  <p>
137      *  This method is responsible for assembling the attribute data into 
138      *  XML. It calls the super method to write out all attributes of this 
139      *  class and it's ancestors.
140      *  <p>
141      *  
142      */
143     public
144     void
145     writeAttributes(Writer out)
146     throws IOException
147     {
148         super.writeAttributes(out);
149     }
150 
151     /**
152      *  writeAssociations
153      *  <p>
154      *  This method is responsible for assembling the association data 
155      *  into XML. It calls the super method to write out all associations of 
156      *  this class's ancestors.
157      *  <p>
158      *  
159      */
160     public
161     void
162     writeAssociations(Writer out)
163     throws IOException
164     {
165         super.writeAssociations(out);
166         if ( sourceContact != null ){
167             out.write("<SourceContact_assnref>");
168             out.write("<Contact_ref identifier=\"" + sourceContact.getIdentifier() + "\"/>");
169             out.write("</SourceContact_assnref>");
170         }
171     }
172 
173     /**
174      *  Set method for sourceContact
175      *  <p>
176      *  @param value to set
177      *  <p>
178      *  
179      */
180     public
181     void
182     setSourceContact(
183         Contact sourceContact
184     )
185     {
186         this.sourceContact = sourceContact;
187     }
188 
189     /**
190      *  Get method for sourceContact
191      *  <p>
192      *  @return value of the attribute
193      *  <p>
194      *  
195      */
196     public
197     Contact
198     getSourceContact()
199     {
200         return sourceContact;
201     }
202 
203 }