DescriptorLang.java

  1. /*
  2.  * Copyright 2024 Global Crop Diversity Trust
  3.  *
  4.  * Licensed under the Apache License, Version 2.0 (the "License");
  5.  * you may not use this file except in compliance with the License.
  6.  * You may obtain a copy of the License at
  7.  *
  8.  *   http://www.apache.org/licenses/LICENSE-2.0
  9.  *
  10.  * Unless required by applicable law or agreed to in writing, software
  11.  * distributed under the License is distributed on an "AS IS" BASIS,
  12.  * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
  13.  * See the License for the specific language governing permissions and
  14.  * limitations under the License.
  15.  */

  16. package org.genesys.server.model.traits;

  17. import com.fasterxml.jackson.annotation.JsonIdentityInfo;
  18. import com.fasterxml.jackson.annotation.ObjectIdGenerators;
  19. import lombok.Getter;
  20. import lombok.NoArgsConstructor;
  21. import lombok.Setter;
  22. import org.genesys.server.model.impl.LangModel;
  23. import org.genesys.server.model.impl.SubsetLang;

  24. import javax.persistence.AssociationOverride;
  25. import javax.persistence.Entity;
  26. import javax.persistence.JoinColumn;
  27. import javax.persistence.Lob;
  28. import javax.persistence.Table;
  29. import javax.persistence.UniqueConstraint;

  30. @Entity
  31. @Table(name = "descriptor_lang", uniqueConstraints = { @UniqueConstraint(columnNames = { "descriptorId", "lang" }) })
  32. @JsonIdentityInfo(scope = SubsetLang.class, generator = ObjectIdGenerators.PropertyGenerator.class, property = "id")
  33. @AssociationOverride(name = "entity", joinColumns = { @JoinColumn(name = "descriptorId") })
  34. @Getter
  35. @Setter
  36. @NoArgsConstructor
  37. public class DescriptorLang extends LangModel<DescriptorLang, Descriptor> {

  38.     @Lob
  39.     private String description;

  40.     @Override
  41.     public boolean canEqual(Object other) {
  42.         return other instanceof DescriptorLang;
  43.     }
  44. }