Coverage Report - org.kuali.rice.kim.api.identity.name.StringToKimEntityNameInfoMapAdapter
 
Classes in this File Line Coverage Branch Coverage Complexity
StringToKimEntityNameInfoMapAdapter
0%
0/15
0%
0/8
2
StringToKimEntityNameInfoMapAdapter$StringEntityNameInfoMapEntry
0%
0/11
N/A
2
 
 1  
 /**
 2  
  * Copyright 2005-2011 The Kuali Foundation
 3  
  *
 4  
  * Licensed under the Educational Community 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.opensource.org/licenses/ecl2.php
 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.kuali.rice.kim.api.identity.name;
 17  
 
 18  
 import org.kuali.rice.core.api.mo.AbstractDataTransferObject;
 19  
 import org.w3c.dom.Element;
 20  
 
 21  
 import javax.xml.bind.annotation.XmlAnyElement;
 22  
 import javax.xml.bind.annotation.XmlAttribute;
 23  
 import javax.xml.bind.annotation.XmlElement;
 24  
 import javax.xml.bind.annotation.adapters.XmlAdapter;
 25  
 import java.util.Collection;
 26  
 import java.util.HashMap;
 27  
 import java.util.Map;
 28  
 
 29  
 /**
 30  
  * Do jax-ws mapping of Map<String, String> for KIM service method parameters, etc.
 31  
  * 
 32  
  * @author Kuali Rice Team (rice.collab@kuali.org)
 33  
  *
 34  
  */
 35  0
 public class StringToKimEntityNameInfoMapAdapter extends XmlAdapter<StringToKimEntityNameInfoMapAdapter.StringEntityNameInfoMapEntry[], Map<String, EntityName>> {
 36  
 
 37  
         /**
 38  
          * This overridden method ...
 39  
          * 
 40  
          * @see javax.xml.bind.annotation.adapters.XmlAdapter#marshal(java.lang.Object)
 41  
          */
 42  
         @Override
 43  
         public StringEntityNameInfoMapEntry[] marshal(Map<String, EntityName> map) throws Exception {
 44  0
                 if(null == map) return null;
 45  0
                 StringEntityNameInfoMapEntry[] entryArray = new StringEntityNameInfoMapEntry[map.size()];
 46  0
                 int i = 0;
 47  0
                 for (Map.Entry<String, EntityName> e : map.entrySet()) {
 48  0
                         entryArray[i] = new StringEntityNameInfoMapEntry(e.getKey(), e.getValue());
 49  0
                         i++;
 50  
                 }
 51  0
                 return entryArray;
 52  
         }
 53  
 
 54  
         /**
 55  
          * This overridden method ...
 56  
          * 
 57  
          * @see javax.xml.bind.annotation.adapters.XmlAdapter#unmarshal(java.lang.Object)
 58  
          */
 59  
         @Override
 60  
         public Map<String, EntityName> unmarshal(StringEntityNameInfoMapEntry[] entryArray) throws Exception {
 61  0
                 if (null == entryArray) return null;
 62  0
                 Map<String, EntityName> resultMap = new HashMap<String, EntityName>(entryArray.length);
 63  0
                 for (int i = 0; i < entryArray.length; i++) {
 64  0
                         StringEntityNameInfoMapEntry entry = entryArray[i];
 65  0
                         resultMap.put(entry.getKey(), entry.getValue());
 66  
                 }
 67  0
                 return resultMap;
 68  
         }
 69  
 
 70  0
     public static class StringEntityNameInfoMapEntry extends AbstractDataTransferObject {
 71  
 
 72  
         private static final long serialVersionUID = 1L;
 73  
 
 74  
         @XmlAttribute
 75  
         private final String key;
 76  
 
 77  
         @XmlElement(required=true)
 78  
         private final EntityName value;
 79  
 
 80  0
         @SuppressWarnings("unused")
 81  
         @XmlAnyElement
 82  
         private final Collection<Element> _futureElements = null;
 83  
 
 84  
         /**
 85  
          * Private constructor used only by JAXB.
 86  
          */
 87  0
         public StringEntityNameInfoMapEntry() {
 88  0
             key = null;
 89  0
             value = null;
 90  0
         }
 91  
 
 92  
         public StringEntityNameInfoMapEntry(String key, EntityName value) {
 93  0
             super();
 94  
 
 95  0
             this.key = key;
 96  0
             this.value = value;
 97  0
         }
 98  
 
 99  
         public String getKey() {
 100  0
             return key;
 101  
         }
 102  
 
 103  
         public EntityName getValue() {
 104  0
             return value;
 105  
         }
 106  
     }
 107  
 }