View Javadoc

1   /**
2    *
3    * Copyright (C) 2011 Cloud Conscious, LLC. <info@cloudconscious.com>
4    *
5    * ====================================================================
6    * Licensed under the Apache License, Version 2.0 (the "License");
7    * you may not use this file except in compliance with the License.
8    * 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, software
13   * distributed under the License is distributed on an "AS IS" BASIS,
14   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
15   * See the License for the specific language governing permissions and
16   * limitations under the License.
17   * ====================================================================
18   */
19  package org.jclouds.vcloud.terremark.domain.internal;
20  
21  import java.net.URI;
22  import java.util.Map;
23  
24  import org.jclouds.vcloud.domain.ReferenceType;
25  import org.jclouds.vcloud.domain.internal.CatalogItemImpl;
26  import org.jclouds.vcloud.terremark.domain.TerremarkCatalogItem;
27  
28  /**
29   * 
30   * @author Adrian Cole
31   * 
32   */
33  public class TerremarkCatalogItemImpl extends CatalogItemImpl implements TerremarkCatalogItem {
34  
35     private final ReferenceType computeOptions;
36     private final ReferenceType customizationOptions;
37  
38     public TerremarkCatalogItemImpl(String name, URI id, String description, ReferenceType computeOptions,
39           ReferenceType customizationOptions, ReferenceType entity, Map<String, String> properties) {
40        super(name, id, description, entity, properties);
41        this.computeOptions = computeOptions;
42        this.customizationOptions = customizationOptions;
43     }
44  
45     @Override
46     public ReferenceType getComputeOptions() {
47        return computeOptions;
48     }
49  
50     @Override
51     public ReferenceType getCustomizationOptions() {
52        return customizationOptions;
53     }
54  
55     @Override
56     public int hashCode() {
57        final int prime = 31;
58        int result = super.hashCode();
59        result = prime * result + ((computeOptions == null) ? 0 : computeOptions.hashCode());
60        result = prime * result + ((customizationOptions == null) ? 0 : customizationOptions.hashCode());
61        return result;
62     }
63  
64     @Override
65     public boolean equals(Object obj) {
66        if (this == obj)
67           return true;
68        if (!super.equals(obj))
69           return false;
70        if (getClass() != obj.getClass())
71           return false;
72        TerremarkCatalogItemImpl other = (TerremarkCatalogItemImpl) obj;
73        if (computeOptions == null) {
74           if (other.computeOptions != null)
75              return false;
76        } else if (!computeOptions.equals(other.computeOptions))
77           return false;
78        if (customizationOptions == null) {
79           if (other.customizationOptions != null)
80              return false;
81        } else if (!customizationOptions.equals(other.customizationOptions))
82           return false;
83        return true;
84     }
85  
86  }