/******************************************************************************* * Mission Control Technologies, Copyright (c) 2009-2012, United States Government * as represented by the Administrator of the National Aeronautics and Space * Administration. All rights reserved. * The MCT platform is 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. * * MCT includes source code licensed under additional open source licenses. See * the MCT Open Source Licenses file included with this distribution or the About * MCT Licenses dialog available at runtime from the MCT Help menu for additional * information. *******************************************************************************/ package gov.nasa.arc.mct.dbpersistence.dao; import java.io.Serializable; import javax.persistence.Basic; import javax.persistence.Column; import javax.persistence.Embeddable; /** * * @author cbwebste */ @Embeddable public class ViewStatePK implements Serializable { private static final long serialVersionUID = 1L; @Basic(optional = false) @Column(name = "component_id") private String componentId; @Basic(optional = false) @Column(name = "view_type") private String viewType; public ViewStatePK() { } public String getComponentId() { return componentId; } public void setComponentId(String componentId) { this.componentId = componentId; } public String getViewType() { return viewType; } public void setViewType(String viewType) { this.viewType = viewType; } @Override public int hashCode() { int hash = 0; hash += (componentId != null ? componentId.hashCode() : 0); hash += (viewType != null ? viewType.hashCode() : 0); return hash; } @Override public boolean equals(Object object) { // TODO: Warning - this method won't work in the case the id fields are not set if (!(object instanceof ViewStatePK)) { return false; } ViewStatePK other = (ViewStatePK) object; if ((this.componentId == null && other.componentId != null) || (this.componentId != null && !this.componentId.equals(other.componentId))) { return false; } if ((this.viewType == null && other.viewType != null) || (this.viewType != null && !this.viewType.equals(other.viewType))) { return false; } return true; } @Override public String toString() { return "test.ViewStatePK[ componentId=" + componentId + ", viewType=" + viewType + " ]"; } }