Coverage Report - org.apache.ws.scout.registry.infomodel.AssociationImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
AssociationImpl
0%
0/48
0%
0/10
1.353
 
 1  
 /**
 2  
  *
 3  
  * Copyright 2004 The Apache Software Foundation
 4  
  *
 5  
  *  Licensed under the Apache License, Version 2.0 (the "License");
 6  
  *  you may not use this file except in compliance with the License.
 7  
  *  You may obtain a copy of the License at
 8  
  *
 9  
  *     http://www.apache.org/licenses/LICENSE-2.0
 10  
  *
 11  
  *  Unless required by applicable law or agreed to in writing, software
 12  
  *  distributed under the License is distributed on an "AS IS" BASIS,
 13  
  *  WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 14  
  *  See the License for the specific language governing permissions and
 15  
  *  limitations under the License.
 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.Association;
 22  
 import javax.xml.registry.infomodel.Concept;
 23  
 import javax.xml.registry.infomodel.InternationalString;
 24  
 import javax.xml.registry.infomodel.Key;
 25  
 import javax.xml.registry.infomodel.RegistryObject;
 26  
 
 27  
 /**
 28  
  * Implements JAXR Association Interface.
 29  
  * For futher details, look into the JAXR API Javadoc.
 30  
  *
 31  
  * @author Anil Saldhana  <anil@apache.org>
 32  
  */
 33  
 public class AssociationImpl extends RegistryObjectImpl implements Association
 34  
 {
 35  0
     private Concept type = null;
 36  0
     private RegistryObject source = null;
 37  0
     private RegistryObject target = null;
 38  0
     private boolean isConfirmed = true;
 39  0
     private boolean isConfirmedBySourceOwner = true;
 40  0
     private boolean isConfirmedByTargetOwner = true;
 41  0
     private boolean isExtramural = true;
 42  
 
 43  
     public AssociationImpl(LifeCycleManager lifeCycleManager)
 44  
     {
 45  0
         super(lifeCycleManager);
 46  0
     }
 47  
 
 48  
     public AssociationImpl(LifeCycleManager lifeCycleManager, InternationalString n)
 49  
     {
 50  0
         super(lifeCycleManager, n);
 51  0
     }
 52  
 
 53  
     public Concept getAssociationType() throws JAXRException
 54  
     {
 55  0
         return type;
 56  
     }
 57  
 
 58  
     public RegistryObject getSourceObject() throws JAXRException
 59  
     {
 60  0
         return source;
 61  
     }
 62  
 
 63  
     public RegistryObject getTargetObject() throws JAXRException
 64  
     {
 65  0
         return target;
 66  
     }
 67  
 
 68  
     public boolean isConfirmed() throws JAXRException
 69  
     {
 70  0
         return isConfirmed;
 71  
     }
 72  
 
 73  
     public boolean isConfirmedBySourceOwner() throws JAXRException
 74  
     {
 75  0
         return isConfirmedBySourceOwner;
 76  
     }
 77  
 
 78  
     public boolean isConfirmedByTargetOwner() throws JAXRException
 79  
     {
 80  0
         return isConfirmedByTargetOwner;
 81  
     }
 82  
 
 83  
     public boolean isExtramural() throws JAXRException
 84  
     {
 85  0
         return isExtramural;
 86  
     }
 87  
 
 88  
     public void setAssociationType(Concept concept) throws JAXRException
 89  
     {
 90  0
         type = concept;
 91  0
     }
 92  
 
 93  
     public void setSourceObject(RegistryObject ro) throws JAXRException
 94  
     {
 95  0
         source = ro;
 96  0
     }
 97  
 
 98  
     public void setTargetObject(RegistryObject ro) throws JAXRException
 99  
     {
 100  0
         target = ro;
 101  0
     }
 102  
 
 103  
    /**
 104  
     * There is an impedance mismatch as specified in the JAXR specification
 105  
     * Section D-11
 106  
     */
 107  
    public Key getKey()
 108  
    {
 109  0
       String id = null;
 110  0
       Key key = null;
 111  
       try
 112  
       {
 113  0
          id = source.getKey().getId();
 114  0
          id += "|" + target.getKey().getId();
 115  0
          Key k = null;
 116  0
          if(type != null ) k = type.getKey();
 117  0
          if(k == null || k.getId() == "" ) id +="|NULL";
 118  
          else
 119  0
           id+="|"+k.getId();
 120  0
          id += "|" + "Concept";  //UDDI: KeyedReference->Key Name
 121  
          //String val = "NULL"; KS unused
 122  0
          if(type!= null)  id += "|" + type.getValue();
 123  0
          else  id +="|NULL";
 124  
 
 125  
       }
 126  0
       catch (JAXRException e)
 127  
       {
 128  0
         throw new RuntimeException(e);
 129  0
       }
 130  
 
 131  0
       if(id != null) key = new KeyImpl(id);
 132  0
       return key;
 133  
    }
 134  
 
 135  
    public void setConfirmed(boolean b)
 136  
    {
 137  0
       this.isConfirmed = b;
 138  0
    }
 139  
 
 140  
    public void setConfirmedBySourceOwner(boolean b)
 141  
    {
 142  0
       isConfirmedBySourceOwner = b;
 143  0
    }
 144  
 
 145  
    public void setConfirmedByTargetOwner(boolean b)
 146  
    {
 147  0
       isConfirmedByTargetOwner = b;
 148  0
    }
 149  
 
 150  
    public void setExtramural(boolean b)
 151  
    {
 152  0
       isExtramural = b;
 153  0
    } 
 154  
 
 155  
 }