| 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.trmk.vcloud_0_8.domain; |
| 20 | |
| 21 | /** |
| 22 | * The response lists which customization options are supported for this |
| 23 | * particular vApp. The possible customization options are Network and Password. |
| 24 | * |
| 25 | * @author Adrian Cole |
| 26 | * @see <a |
| 27 | * href="https://community.vcloudexpress.terremark.com/en-us/product_docs/w/wiki/6-using-the-vcloud-express-api.aspx" |
| 28 | * >Terremark documentation</a> |
| 29 | */ |
| 30 | public class CustomizationParameters { |
| 31 | private final boolean customizeNetwork; |
| 32 | private final boolean customizePassword; |
| 33 | private final boolean customizeSSH; |
| 34 | |
| 35 | public CustomizationParameters(boolean customizeNetwork, |
| 36 | boolean customizePassword, boolean customizeSSH) { |
| 37 | this.customizeNetwork = customizeNetwork; |
| 38 | this.customizePassword = customizePassword; |
| 39 | this.customizeSSH = customizeSSH; |
| 40 | } |
| 41 | |
| 42 | public boolean canCustomizeNetwork() { |
| 43 | return customizeNetwork; |
| 44 | } |
| 45 | |
| 46 | public boolean canCustomizePassword() { |
| 47 | return customizePassword; |
| 48 | } |
| 49 | |
| 50 | public boolean canCustomizeSSH() { |
| 51 | return customizeSSH; |
| 52 | } |
| 53 | |
| 54 | @Override |
| 55 | public int hashCode() { |
| 56 | final int prime = 31; |
| 57 | int result = 1; |
| 58 | result = prime * result + (customizeNetwork ? 1231 : 1237); |
| 59 | result = prime * result + (customizePassword ? 1231 : 1237); |
| 60 | result = prime * result + (customizeSSH ? 1231 : 1237); |
| 61 | return result; |
| 62 | } |
| 63 | |
| 64 | @Override |
| 65 | public boolean equals(Object obj) { |
| 66 | if (this == obj) |
| 67 | return true; |
| 68 | if (obj == null) |
| 69 | return false; |
| 70 | if (getClass() != obj.getClass()) |
| 71 | return false; |
| 72 | CustomizationParameters other = (CustomizationParameters) obj; |
| 73 | if (customizeNetwork != other.customizeNetwork) |
| 74 | return false; |
| 75 | if (customizePassword != other.customizePassword) |
| 76 | return false; |
| 77 | if (customizeSSH != other.customizeSSH) |
| 78 | return false; |
| 79 | return true; |
| 80 | } |
| 81 | |
| 82 | @Override |
| 83 | public String toString() { |
| 84 | return "CustomizationParameters [customizeNetwork=" + customizeNetwork |
| 85 | + ", customizePassword=" + customizePassword + ", customizeSSH=" |
| 86 | + customizeSSH + "]"; |
| 87 | } |
| 88 | } |