package com.devicehive.vo; /* * #%L * DeviceHive Common Dao Interfaces * %% * Copyright (C) 2016 DataArt * %% * Licensed under the Apache License, Version 2.0 (the "License"); * you may not use this file except in compliance with the License. * You may obtain a copy of the License at * * http://www.apache.org/licenses/LICENSE-2.0 * * Unless required by applicable law or agreed to in writing, software * distributed under the License is distributed on an "AS IS" BASIS, * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. * See the License for the specific language governing permissions and * limitations under the License. * #L% */ import com.devicehive.json.strategies.JsonPolicyDef; import com.devicehive.model.HiveEntity; import com.google.gson.annotations.SerializedName; import javax.validation.constraints.NotNull; import javax.validation.constraints.Size; import static com.devicehive.json.strategies.JsonPolicyDef.Policy.*; public class NetworkVO implements HiveEntity { @SerializedName("id") @JsonPolicyDef({DEVICE_PUBLISHED, USER_PUBLISHED, NETWORKS_LISTED, NETWORK_PUBLISHED, NETWORK_SUBMITTED}) private Long id; @SerializedName("key") @Size(max = 64, message = "The length of key should not be more than 64 symbols.") @JsonPolicyDef({DEVICE_PUBLISHED, DEVICE_SUBMITTED, USER_PUBLISHED, NETWORKS_LISTED, NETWORK_PUBLISHED}) private String key; @SerializedName("name") @NotNull(message = "name field cannot be null.") @Size(min = 1, max = 128, message = "Field cannot be empty. The length of name should not be more than 128 " + "symbols.") @JsonPolicyDef({DEVICE_PUBLISHED, DEVICE_SUBMITTED, USER_PUBLISHED, NETWORKS_LISTED, NETWORK_PUBLISHED}) private String name; @SerializedName("description") @Size(max = 128, message = "The length of description should not be more than 128 symbols.") @JsonPolicyDef({DEVICE_PUBLISHED, DEVICE_SUBMITTED, USER_PUBLISHED, NETWORKS_LISTED, NETWORK_PUBLISHED}) private String description; private Long entityVersion; public Long getId() { return id; } public void setId(Long id) { this.id = id; } public String getKey() { return key; } public void setKey(String key) { this.key = key; } public String getName() { return name; } public void setName(String name) { this.name = name; } public String getDescription() { return description; } public void setDescription(String description) { this.description = description; } public Long getEntityVersion() { return entityVersion; } public void setEntityVersion(Long entityVersion) { this.entityVersion = entityVersion; } @Override public boolean equals(Object o) { if (this == o) { return true; } if (o == null || getClass() != o.getClass()) { return false; } NetworkVO network = (NetworkVO) o; return !(id != null ? !id.equals(network.id) : network.id != null); } @Override public int hashCode() { return id != null ? id.hashCode() : 0; } }