This project has retired. For details please refer to its Attic page.
ClassificationImpl xref
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  
17  package org.apache.ws.scout.registry.infomodel;
18  
19  import javax.xml.registry.JAXRException;
20  import javax.xml.registry.LifeCycleManager;
21  import javax.xml.registry.infomodel.ClassificationScheme;
22  import javax.xml.registry.infomodel.Concept;
23  import javax.xml.registry.infomodel.RegistryObject;
24  
25  /**
26   * Implements JAXR Classification Interface.
27   * For futher details, look into the JAXR API Javadoc.
28   *
29   * @author <a href="mailto:anil@apache.org">Anil Saldhana</a>
30   * @author <a href="mailto:geirm@apache.org">Geir Magnusson Jr.</a>
31   */
32  public class ClassificationImpl extends RegistryObjectImpl
33          implements javax.xml.registry.infomodel.Classification
34  {
35  
36      private ClassificationScheme scheme = new ClassificationSchemeImpl(null);
37      private Concept concept = new ConceptImpl(null);
38      private boolean external = false;
39      private String value;
40  
41      private RegistryObject classfiedobj = null;
42  
43      /**
44       * Creates a new instance of ClassificationImpl
45       */
46      public ClassificationImpl(LifeCycleManager lifeCycleManager)
47      {
48          super(lifeCycleManager);
49      }
50  
51      public ClassificationScheme getClassificationScheme()
52              throws JAXRException
53      {
54          return scheme;
55      }
56  
57      public RegistryObject getClassifiedObject() throws JAXRException
58      {
59          return classfiedobj;
60      }
61  
62      public Concept getConcept() throws JAXRException
63      {
64          return concept;
65      }
66  
67      /**
68       *
69       * @return he value of the taxonomy element if external Classification;
70       *      the value of the  Concept representing the taxonomy element
71       *      if internal Classification
72       * @throws JAXRException
73       */
74      public String getValue() throws JAXRException
75      {
76          if (isExternal()) {
77              return value;
78          }
79          else {
80              return concept.getValue();
81          }
82      }
83  
84      public void setExternal(boolean b) {
85          this.external = b;
86      }
87  
88      public boolean isExternal() throws JAXRException
89      {
90          return external;
91      }
92  
93      public void setClassificationScheme(ClassificationScheme cscheme)
94              throws JAXRException
95      {
96          scheme = cscheme;
97  
98          /*
99           * not 100% clear, but I *think* the JavaDoc indicates that if
100          * our internality dictates that of the scheme.
101          */
102 
103        ((ClassificationSchemeImpl) scheme).setExternal(isExternal());
104     }
105 
106     public void setClassifiedObject(RegistryObject registryObject)
107             throws JAXRException
108     {
109         classfiedobj = registryObject;
110     }
111 
112     public void setConcept(Concept cpt) throws JAXRException
113     {
114         concept = cpt;
115     }
116 
117     public void setValue(String str) throws JAXRException
118     {
119         value = str;
120     }
121 
122 }