Method.java
/*
* Copyright 2019 Global Crop Diversity Trust
*
* 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.
*/
package org.gringlobal.model;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.genesys.blocks.model.Copyable;
import org.gringlobal.compatibility.LookupDisplay;
import org.gringlobal.custom.validation.javax.CodeValueField;
import org.gringlobal.custom.validation.javax.OneLine;
import org.gringlobal.model.community.CommunityCodeValues;
import static org.gringlobal.model.community.CommunityCodeValues.CODE_VALUE_LENGTH;
/**
* Auto-generated by:
* org.apache.openjpa.jdbc.meta.ReverseMappingTool$AnnotatedCodeGenerator
*/
@Entity
@Table(name = "method")
@JsonIdentityInfo(scope = Method.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Getter
@Setter
@NoArgsConstructor
public class Method extends CooperatorOwnedModel implements Copyable<Method> {
private static final long serialVersionUID = 1073929267585374029L;
/** ID */
@Id
@JsonProperty
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "method_id", columnDefinition = "int")
private Long id;
@Basic
@Column(name = "elevation_meters")
private Integer elevationMeters;
@Basic
@Column(name = "formatted_locality")
@Lob
private String formattedLocality;
@ManyToOne(fetch = FetchType.LAZY, cascade = {})
@JoinColumn(name = "geography_id")
private Geography geography;
@Basic
@Column(name = "georeference_annotation")
@Lob
private String georeferenceAnnotation;
@Basic
@Size(max = 10)
@CodeValueField(CommunityCodeValues.GEOREFERENCE_DATUM)
@Column(name = "georeference_datum", length = 10)
private String georeferenceDatum;
@Basic
@Size(max = CODE_VALUE_LENGTH)
@Column(name = "georeference_protocol_code", length = CODE_VALUE_LENGTH)
@CodeValueField("GEOREFERENCE_PROTOCOL")
private String georeferenceProtocolCode;
@Basic
private Double latitude;
@Basic
private Double longitude;
@Basic
@Column(name = "materials_and_methods")
@Lob
private String materialsAndMethods;
@Basic
@NotNull
@Size(min = 1, max = 100)
@OneLine
@Column(nullable = false, length = 100)
@LookupDisplay
private String name;
@Basic
@Size(max = CODE_VALUE_LENGTH)
@CodeValueField(CommunityCodeValues.METHOD_STUDY_TYPE)
@Column(name = "study_reason_code", length = CODE_VALUE_LENGTH)
private String studyReasonCode;
@Basic
private Integer uncertainty;
public Method(final Long id) {
this.id = id;
}
@Override
public void lazyLoad() {
super.lazyLoad();
lazyLoad(this.geography);
}
@Override
public boolean canEqual(Object other) {
return other instanceof Method;
}
}