This project has retired. For details please refer to its Attic page.
Coverage Report
Coverage Report - org.apache.ws.scout.registry.infomodel.AssociationImpl
 
Classes in this File Line Coverage Branch Coverage Complexity
AssociationImpl
64%
31/48
50%
5/10
1.412
 
 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  10
     private Concept type = null;
 36  10
     private RegistryObject source = null;
 37  10
     private RegistryObject target = null;
 38  10
     private boolean isConfirmed = true;
 39  10
     private boolean isConfirmedBySourceOwner = true;
 40  10
     private boolean isConfirmedByTargetOwner = true;
 41  10
     private boolean isExtramural = true;
 42  
 
 43  
     public AssociationImpl(LifeCycleManager lifeCycleManager)
 44  
     {
 45  10
         super(lifeCycleManager);
 46  10
     }
 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  8
         return type;
 56  
     }
 57  
 
 58  
     public RegistryObject getSourceObject() throws JAXRException
 59  
     {
 60  32
         return source;
 61  
     }
 62  
 
 63  
     public RegistryObject getTargetObject() throws JAXRException
 64  
     {
 65  24
         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  16
         type = concept;
 91  16
     }
 92  
 
 93  
     public void setSourceObject(RegistryObject ro) throws JAXRException
 94  
     {
 95  8
         source = ro;
 96  8
     }
 97  
 
 98  
     public void setTargetObject(RegistryObject ro) throws JAXRException
 99  
     {
 100  8
         target = ro;
 101  8
     }
 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  14
       String id = null;
 110  14
       Key key = null;
 111  
       try
 112  
       {
 113  14
          id = source.getKey().getId();
 114  14
          id += "|" + target.getKey().getId();
 115  14
          Key k = null;
 116  14
          if(type != null ) k = type.getKey();
 117  14
          if(k == null || k.getId() == "" ) id +="|NULL";
 118  
          else
 119  14
           id+="|"+k.getId();
 120  14
          id += "|" + "Concept";  //UDDI: KeyedReference->Key Name
 121  
          //String val = "NULL"; KS unused
 122  14
          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  14
       }
 130  
 
 131  14
       if(id != null) key = new KeyImpl(id);
 132  14
       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  
 }