|
| 1 | +/* |
| 2 | + * Copyright (c) 2015, EMC Corporation. |
| 3 | + * Redistribution and use in source and binary forms, with or without modification, |
| 4 | + * are permitted provided that the following conditions are met: |
| 5 | + * |
| 6 | + * + Redistributions of source code must retain the above copyright notice, |
| 7 | + * this list of conditions and the following disclaimer. |
| 8 | + * + Redistributions in binary form must reproduce the above copyright |
| 9 | + * notice, this list of conditions and the following disclaimer in the |
| 10 | + * documentation and/or other materials provided with the distribution. |
| 11 | + * + The name of EMC Corporation may not be used to endorse or promote |
| 12 | + * products derived from this software without specific prior written |
| 13 | + * permission. |
| 14 | + * |
| 15 | + * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS |
| 16 | + * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED |
| 17 | + * TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR |
| 18 | + * PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS |
| 19 | + * BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR |
| 20 | + * CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF |
| 21 | + * SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS |
| 22 | + * INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN |
| 23 | + * CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) |
| 24 | + * ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE |
| 25 | + * POSSIBILITY OF SUCH DAMAGE. |
| 26 | + */ |
| 27 | +package com.emc.rest.smart.ecs; |
| 28 | + |
| 29 | +import javax.xml.bind.annotation.XmlElement; |
| 30 | +import javax.xml.bind.annotation.XmlRootElement; |
| 31 | +import javax.xml.bind.annotation.XmlTransient; |
| 32 | +import java.util.ArrayList; |
| 33 | +import java.util.HashMap; |
| 34 | +import java.util.List; |
| 35 | +import java.util.Map; |
| 36 | + |
| 37 | +@XmlRootElement(name = "PingList") |
| 38 | +public class PingResponse { |
| 39 | + Map<String, PingItem> pingItemMap; |
| 40 | + |
| 41 | + @XmlElement(name = "PingItem") |
| 42 | + public List<PingItem> getPingItems() { |
| 43 | + if (pingItemMap == null) return null; |
| 44 | + return new ArrayList<PingItem>(pingItemMap.values()); |
| 45 | + } |
| 46 | + |
| 47 | + public void setPingItems(List<PingItem> pingItems) { |
| 48 | + if (pingItems != null) { |
| 49 | + pingItemMap = new HashMap<String, PingItem>(); |
| 50 | + for (PingItem item : pingItems) { |
| 51 | + pingItemMap.put(item.getName(), item); |
| 52 | + } |
| 53 | + } |
| 54 | + } |
| 55 | + |
| 56 | + @XmlTransient |
| 57 | + public Map<String, PingItem> getPingItemMap() { |
| 58 | + return pingItemMap; |
| 59 | + } |
| 60 | + |
| 61 | + public void setPingItemMap(Map<String, PingItem> pingItemMap) { |
| 62 | + this.pingItemMap = pingItemMap; |
| 63 | + } |
| 64 | +} |
0 commit comments