This project has retired. For details please refer to its Attic page.
Coverage Report
Coverage Report - org.apache.ws.scout.registry.infomodel.ClassificationImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
ClassificationImpl
75%
18/24
50%
1/2
1.182
 
 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  50
     private ClassificationScheme scheme = new ClassificationSchemeImpl(null);
 37  50
     private Concept concept = new ConceptImpl(null);
 38  50
     private boolean external = false;
 39  
     private String value;
 40  
 
 41  50
     private RegistryObject classfiedobj = null;
 42  
 
 43  
     /**
 44  
      * Creates a new instance of ClassificationImpl
 45  
      */
 46  
     public ClassificationImpl(LifeCycleManager lifeCycleManager)
 47  
     {
 48  50
         super(lifeCycleManager);
 49  50
     }
 50  
 
 51  
     public ClassificationScheme getClassificationScheme()
 52  
             throws JAXRException
 53  
     {
 54  18
         return scheme;
 55  
     }
 56  
 
 57  
     public RegistryObject getClassifiedObject() throws JAXRException
 58  
     {
 59  0
         return classfiedobj;
 60  
     }
 61  
 
 62  
     public Concept getConcept() throws JAXRException
 63  
     {
 64  18
         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  18
         if (isExternal()) {
 77  18
             return value;
 78  
         }
 79  
         else {
 80  0
             return concept.getValue();
 81  
         }
 82  
     }
 83  
 
 84  
     public void setExternal(boolean b) {
 85  18
         this.external = b;
 86  18
     }
 87  
 
 88  
     public boolean isExternal() throws JAXRException
 89  
     {
 90  102
         return external;
 91  
     }
 92  
 
 93  
     public void setClassificationScheme(ClassificationScheme cscheme)
 94  
             throws JAXRException
 95  
     {
 96  48
         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  48
        ((ClassificationSchemeImpl) scheme).setExternal(isExternal());
 104  48
     }
 105  
 
 106  
     public void setClassifiedObject(RegistryObject registryObject)
 107  
             throws JAXRException
 108  
     {
 109  0
         classfiedobj = registryObject;
 110  0
     }
 111  
 
 112  
     public void setConcept(Concept cpt) throws JAXRException
 113  
     {
 114  0
         concept = cpt;
 115  0
     }
 116  
 
 117  
     public void setValue(String str) throws JAXRException
 118  
     {
 119  48
         value = str;
 120  48
     }
 121  
 
 122  
 }