AccessionIpr.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 java.util.Date;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.genesys.blocks.model.Copyable;
import org.gringlobal.custom.validation.javax.CodeValueField;
import com.fasterxml.jackson.annotation.JsonIdentityInfo;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.ObjectIdGenerators;
import static org.gringlobal.model.community.CommunityCodeValues.CODE_VALUE_LENGTH;
/**
* Auto-generated by:
* org.apache.openjpa.jdbc.meta.ReverseMappingTool$AnnotatedCodeGenerator
*/
@Entity
@Table(name = "accession_ipr")
@JsonIdentityInfo(scope = AccessionIpr.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
@Getter
@Setter
@NoArgsConstructor
public class AccessionIpr extends CooperatorOwnedModel implements Copyable<AccessionIpr> {
private static final long serialVersionUID = 96253871118732230L;
@Basic
@Column(name = "accepted_date")
private Date acceptedDate;
@NotNull
@ManyToOne(fetch = FetchType.LAZY, cascade = {})
@JoinColumn(name = "accession_id", nullable = false)
private Accession accession;
@ManyToOne(fetch = FetchType.LAZY, cascade = {})
@JoinColumn(name = "cooperator_id")
private Cooperator cooperator;
@Basic
@Column(name = "expected_date")
private Date expectedDate;
@Basic
@Column(name = "expired_date")
private Date expiredDate;
@Id
@JsonProperty
@GeneratedValue(strategy = GenerationType.IDENTITY)
@Column(name = "accession_ipr_id", columnDefinition = "int")
private Long id;
@Basic
@Size(max = 100)
@Column(name = "ipr_crop_name", length = 100)
private String iprCropName;
@Basic
@Size(max = 2000)
@Column(name = "ipr_full_name", length = 2000)
private String iprFullName;
@Basic
@Size(max = 50)
@Column(name = "ipr_number", length = 50)
private String iprNumber;
@Basic
@Column(name = "issued_date")
private Date issuedDate;
@Basic
@Column
@Lob
private String note;
@Basic
@NotNull
@Column(name = "type_code", nullable = false, length = CODE_VALUE_LENGTH)
@CodeValueField("ACCESSION_RESTRICTION_TYPE")
private String typeCode;
public AccessionIpr(final Long id) {
this.id = id;
}
@Override
public void lazyLoad() {
super.lazyLoad();
lazyLoad(this.accession, true);
}
@Override
public boolean canEqual(Object other) {
return other instanceof AccessionIpr;
}
}