View Javadoc

1   /*
2    * Copyright 2001-2004 The Apache Software Foundation.
3    * 
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    * 
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    * 
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package org.apache.juddi.datatype;
17  
18  import java.util.Vector;
19  
20  /***
21   * Optional structure in InstanceDetails used for overview information about
22   * a particular TModel use within a BindingTemplate.
23   *
24   * @author Steve Viens (sviens@apache.org)
25   */
26  public class OverviewDoc implements RegistryObject
27  {
28    Vector descVector;
29    String overviewURL;
30  
31    /***
32     * Construct a new emtpy overviewDoc instance.
33     */
34    public OverviewDoc()
35    {
36    }
37  
38    /***
39     * Construct a new overviewDoc with a given overviewURL.
40     *
41     * @param url The overviewURL of this overviewDoc
42     */
43    public OverviewDoc(String url)
44    {
45      this.overviewURL = url;
46    }
47  
48    /***
49     * Construct a new overviewDoc with a given overviewURL.
50     *
51     * @param url The overviewURL of this overviewDoc
52     */
53    public OverviewDoc(OverviewURL url)
54    {
55      setOverviewURL(url);
56    }
57  
58    /***
59     * Adds the given description. If there was already a description with the
60     * same language-code as the new description, an exception will be thrown.
61     *
62     * @param desc The description to add.
63     */
64    public void addDescription(Description desc)
65    {
66      if (this.descVector == null)
67        this.descVector = new Vector();
68      this.descVector.add(desc);
69    }
70  
71    /***
72     * Sets the description list to the current one. Ignores any object in the
73     * collection that is not an "instanceof" the Description class.
74     *
75     * @param descs Descriptions of Description objects to set
76     */
77    public void setDescriptionVector(Vector descs)
78    {
79      this.descVector = descs;
80    }
81  
82    /***
83     * Returns the descriptions.
84     *
85     * @return the descriptions instance.
86     */
87    public Vector getDescriptionVector()
88    {
89      return this.descVector;
90    }
91  
92    /***
93     * Sets the overviewURL to the String value of the given URL.
94     *
95     * @param url The new overviewURL.
96     */
97    public void setOverviewURL(OverviewURL url)
98    {
99      if ((url != null) && (url.getValue() != null))
100       this.setOverviewURL(url.getValue());
101   }
102 
103   /***
104    * Sets the overviewURL to the given URL.
105    *
106    * @param url The new overviewURL.
107    */
108   public void setOverviewURL(String url)
109   {
110     this.overviewURL = url;
111   }
112 
113   /***
114    * Returns the overviewURL of this overviewDoc.
115    *
116    * @return The overviewURL of this overviewDoc, or null if there is no
117    *  overviewURL.
118    */
119   public OverviewURL getOverviewURL()
120   {
121     if (this.overviewURL != null)
122       return new OverviewURL(this.overviewURL);
123     else
124       return null;
125   }
126 
127   /***
128    * Returns the overviewURL of this overviewDoc.
129    *
130    * @return The overviewURL of this overviewDoc as a String, or null if
131    *  there is no overviewURL.
132    */
133   public String getOverviewURLString()
134   {
135     return this.overviewURL;
136   }
137 }