EMMA Coverage Report (generated Mon Oct 17 05:41:20 EDT 2011)
[all classes][org.jclouds.vcloud.domain.internal]

COVERAGE SUMMARY FOR SOURCE FILE [OrgImpl.java]

nameclass, %method, %block, %line, %
OrgImpl.java100% (1/1)75%  (9/12)55%  (211/381)52%  (39/75)

COVERAGE BREAKDOWN BY CLASS AND METHOD

nameclass, %method, %block, %line, %
     
class OrgImpl100% (1/1)75%  (9/12)55%  (211/381)52%  (39/75)
compareTo (ReferenceType): int 0%   (0/1)0%   (0/11)0%   (0/1)
getTasks (): List 0%   (0/1)0%   (0/3)0%   (0/1)
hashCode (): int 0%   (0/1)0%   (0/98)0%   (0/10)
equals (Object): boolean 100% (1/1)57%  (77/135)44%  (19/43)
OrgImpl (String, String, URI, String, String, Map, Map, Map, ReferenceType, I... 100% (1/1)100% (59/59)100% (13/13)
getCatalogs (): Map 100% (1/1)100% (3/3)100% (1/1)
getDescription (): String 100% (1/1)100% (3/3)100% (1/1)
getFullName (): String 100% (1/1)100% (3/3)100% (1/1)
getNetworks (): Map 100% (1/1)100% (3/3)100% (1/1)
getTasksList (): ReferenceType 100% (1/1)100% (3/3)100% (1/1)
getVDCs (): Map 100% (1/1)100% (3/3)100% (1/1)
toString (): String 100% (1/1)100% (57/57)100% (1/1)

1/**
2 * Licensed to jclouds, Inc. (jclouds) under one or more
3 * contributor license agreements.  See the NOTICE file
4 * distributed with this work for additional information
5 * regarding copyright ownership.  jclouds licenses this file
6 * to you under the Apache License, Version 2.0 (the
7 * "License"); you may not use this file except in compliance
8 * with the License.  You may obtain a copy of the License at
9 *
10 *   http://www.apache.org/licenses/LICENSE-2.0
11 *
12 * Unless required by applicable law or agreed to in writing,
13 * software distributed under the License is distributed on an
14 * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
15 * KIND, either express or implied.  See the License for the
16 * specific language governing permissions and limitations
17 * under the License.
18 */
19package org.jclouds.vcloud.domain.internal;
20 
21import static com.google.common.base.Preconditions.checkNotNull;
22 
23import java.net.URI;
24import java.util.List;
25import java.util.Map;
26 
27import org.jclouds.javax.annotation.Nullable;
28 
29import org.jclouds.vcloud.domain.ReferenceType;
30import org.jclouds.vcloud.domain.Org;
31import org.jclouds.vcloud.domain.Task;
32 
33import com.google.common.collect.Iterables;
34import com.google.common.collect.Lists;
35import com.google.common.collect.Maps;
36 
37/**
38 * Locations of resources in vCloud
39 * 
40 * @author Adrian Cole
41 * 
42 */
43public class OrgImpl extends ReferenceTypeImpl implements Org {
44   private final String fullName;
45   @Nullable
46   private final String description;
47   private final Map<String, ReferenceType> catalogs = Maps.newLinkedHashMap();
48   private final Map<String, ReferenceType> vdcs = Maps.newLinkedHashMap();
49   private final Map<String, ReferenceType> networks = Maps.newLinkedHashMap();
50   private final ReferenceType tasksList;
51   private final List<Task> tasks = Lists.newArrayList();
52 
53   public OrgImpl(String name, String type, URI id, String fullName, String description,
54            Map<String, ReferenceType> catalogs, Map<String, ReferenceType> vdcs, Map<String, ReferenceType> networks,
55            @Nullable ReferenceType tasksList, Iterable<Task> tasks) {
56      super(name, type, id);
57      this.fullName = checkNotNull(fullName, "fullName");
58      this.description = description;
59      this.catalogs.putAll(checkNotNull(catalogs, "catalogs"));
60      this.vdcs.putAll(checkNotNull(vdcs, "vdcs"));
61      this.networks.putAll(checkNotNull(networks, "networks"));
62      this.tasksList = tasksList;
63      Iterables.addAll(this.tasks, checkNotNull(tasks, "tasks"));
64   }
65 
66   @Override
67   public String getFullName() {
68      return fullName;
69   }
70 
71   @Override
72   public String getDescription() {
73      return description;
74   }
75 
76   @Override
77   public Map<String, ReferenceType> getCatalogs() {
78      return catalogs;
79   }
80 
81   @Override
82   public Map<String, ReferenceType> getVDCs() {
83      return vdcs;
84   }
85 
86   @Override
87   public Map<String, ReferenceType> getNetworks() {
88      return networks;
89   }
90 
91   @Override
92   public ReferenceType getTasksList() {
93      return tasksList;
94   }
95 
96   @Override
97   public List<Task> getTasks() {
98      return tasks;
99   }
100 
101   @Override
102   public int hashCode() {
103      final int prime = 31;
104      int result = super.hashCode();
105      result = prime * result + ((catalogs == null) ? 0 : catalogs.hashCode());
106      result = prime * result + ((description == null) ? 0 : description.hashCode());
107      result = prime * result + ((fullName == null) ? 0 : fullName.hashCode());
108      result = prime * result + ((networks == null) ? 0 : networks.hashCode());
109      result = prime * result + ((tasks == null) ? 0 : tasks.hashCode());
110      result = prime * result + ((tasksList == null) ? 0 : tasksList.hashCode());
111      result = prime * result + ((vdcs == null) ? 0 : vdcs.hashCode());
112      return result;
113   }
114 
115   @Override
116   public boolean equals(Object obj) {
117      if (this == obj)
118         return true;
119      if (!super.equals(obj))
120         return false;
121      if (getClass() != obj.getClass())
122         return false;
123      OrgImpl other = (OrgImpl) obj;
124      if (catalogs == null) {
125         if (other.catalogs != null)
126            return false;
127      } else if (!catalogs.equals(other.catalogs))
128         return false;
129      if (description == null) {
130         if (other.description != null)
131            return false;
132      } else if (!description.equals(other.description))
133         return false;
134      if (fullName == null) {
135         if (other.fullName != null)
136            return false;
137      } else if (!fullName.equals(other.fullName))
138         return false;
139      if (networks == null) {
140         if (other.networks != null)
141            return false;
142      } else if (!networks.equals(other.networks))
143         return false;
144      if (tasks == null) {
145         if (other.tasks != null)
146            return false;
147      } else if (!tasks.equals(other.tasks))
148         return false;
149      if (tasksList == null) {
150         if (other.tasksList != null)
151            return false;
152      } else if (!tasksList.equals(other.tasksList))
153         return false;
154      if (vdcs == null) {
155         if (other.vdcs != null)
156            return false;
157      } else if (!vdcs.equals(other.vdcs))
158         return false;
159      return true;
160   }
161 
162   @Override
163   public int compareTo(ReferenceType o) {
164      return (this == o) ? 0 : getHref().compareTo(o.getHref());
165   }
166 
167   @Override
168   public String toString() {
169      return "[href=" + getHref() + ", name=" + getName() + ", type=" + getType() + ", fullName=" + fullName
170               + ", description=" + description + ", catalogs=" + catalogs + ", networks=" + networks + ", tasksList="
171               + tasksList + ", vdcs=" + vdcs + ", tasks=" + tasks + "]";
172   }
173 
174}

[all classes][org.jclouds.vcloud.domain.internal]
EMMA 2.0.5312 (C) Vladimir Roubtsov