SourceDescriptor.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.Basic;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.Lob;
import javax.persistence.Table;
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.component.elastic.ElasticLoader;
import org.gringlobal.custom.validation.javax.CodeValueField;
import org.gringlobal.custom.validation.javax.OneLine;
import static org.gringlobal.model.community.CommunityCodeValues.CODE_VALUE_LENGTH;
/**
* Auto-generated by:
* org.apache.openjpa.jdbc.meta.ReverseMappingTool$AnnotatedCodeGenerator
*/
@Entity
@Table(name = "source_descriptor")
@JsonIdentityInfo(scope = SourceDescriptor.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Getter
@Setter
@NoArgsConstructor
public class SourceDescriptor extends TranslatedCooperatorOwnedModel<SourceDescriptorLang, SourceDescriptor> implements Copyable<SourceDescriptor>, ElasticLoader {
private static final long serialVersionUID = -916418662730604731L;
@Id
@JsonProperty
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "source_descriptor_id", columnDefinition = "int")
private Long id;
@Basic
@Column(name = "category_code", nullable = false, length = CODE_VALUE_LENGTH)
@CodeValueField("SOURCE_DESCRIPTOR_CATEGORY")
private String categoryCode;
@Basic
@Size(max = 30)
@OneLine
@Column(name = "coded_name", nullable = false, length = 30)
@LookupDisplay
private String codedName;
@Basic
@Column(name = "data_type_code", nullable = false, length = CODE_VALUE_LENGTH)
@CodeValueField("CROP_TRAIT_DATA_TYPE")
private String dataTypeCode;
@Basic
@Size(min = 1, max = 1)
@Column(name = "is_coded", nullable = false, length = 1)
private String isCoded;
@Basic
@Column(name = "max_length")
private Integer maxLength;
@Basic
@Size(max = 13)
@OneLine
@Column(name = "numeric_format", length = 15)
private String numericFormat;
@Basic
@Column(name = "numeric_maximum")
private Double numericMaximum;
@Basic
@Column(name = "numeric_minimum")
private Double numericMinimum;
@Basic
@Size(max = 300)
@OneLine
@Column(name = "ontology_url", length = 300)
private String ontologyUrl;
@Basic
@Size(max = 50)
@OneLine
@Column(name = "original_value_format", length = 50)
private String originalValueFormat;
@Basic
@Column(name = "original_value_type_code", length = CODE_VALUE_LENGTH)
@CodeValueField("CROP_TRAIT_DATA_TYPE")
private String originalValueTypeCode;
@Basic
@Column
@Lob
private String note;
public SourceDescriptor(final Long id) {
this.id = id;
}
@Override
public void prepareForIndexing() {
this.lazyLoad();
if (this.langs != null) {
this.langs.size();
}
}
@Override
public boolean canEqual(Object other) {
return other instanceof SourceDescriptor;
}
}