Commit 29a3b548 authored by Matija Obreza's avatar Matija Obreza

Merge branch '375-remaining-api-v1-with-validation' into 'master'

Resolve "Remaining API v1 with validation"

Closes #375

See merge request genesys-pgr/genesys-server!294
parents 28a381b2 61ad9a46
Pipeline #8042 passed with stages
in 11 minutes and 46 seconds
......@@ -28,6 +28,8 @@ import org.genesys2.server.model.impl.FaoInstitute;
import org.springframework.data.elasticsearch.annotations.Document;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.net.URL;
import java.util.ArrayList;
import java.util.HashSet;
......@@ -50,10 +52,14 @@ public class Partner extends UuidModel implements SelfCleaning, AclAwareModel {
private static final long serialVersionUID = 7972197553356837382L;
/// partner short name (acronym or abbr.)
@Size(max = 20)
@NotNull
@Column(length = 20, nullable = false, unique = true)
private String shortName;
/// partner name
@Size(max = 200)
@NotNull
@Column(length = 200, nullable = false)
private String name;
......@@ -63,14 +69,17 @@ public class Partner extends UuidModel implements SelfCleaning, AclAwareModel {
private String description;
/// partner email
@Size(max = 100)
@Column(length = 100)
private String email;
/// partner phone number
@Size(max = 100)
@Column(length = 100)
private String phone;
/// partner address
@Size(max = 500)
@Column(length = 500)
private String address;
......
......@@ -31,6 +31,8 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.ArrayList;
import java.util.List;
......@@ -103,12 +105,14 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
/**
* User-specified version tag. E.g. "1.0", "1.1"
*/
@NotNull
@Column(nullable = false, updatable = false)
private String versionTag;
/**
* Trait title in English.
*/
@NotNull
@Column(nullable = false)
private String title;
......@@ -119,15 +123,18 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
private String description;
/** Descriptor data type. */
@NotNull
@Enumerated(EnumType.STRING)
@Column(nullable = false)
private DataType dataType;
/** The key. */
@NotNull
@Column(name = "keyDescriptor", nullable = false)
private boolean key;
/** The publisher. */
@Size(max = 200)
@Column(length = 200)
private String publisher;
......@@ -147,10 +154,12 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
private Double maxValue;
/** The uom. */
@Size(max = 20)
@Column(name = "uom", length = 20)
private String uom;
/** The preferred column name in databases and spreadsheets. */
@Size(max = 50)
@Column(name = "columnName", length = 50)
private String columnName;
......@@ -183,6 +192,7 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
private List<VocabularyTerm> terms;
/** The owner. */
@NotNull
@JsonIdentityReference(alwaysAsId = false)
@ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "partnerId", updatable = false)
......@@ -201,10 +211,12 @@ public class Descriptor extends UuidModel implements SelfCleaning, Publishable,
private List<Dataset> datasets;
/** The crop. */
@Size(max = Crop.CROP_SHORTNAME_LENGTH)
@Column(name = "crop", length = Crop.CROP_SHORTNAME_LENGTH, nullable = true)
private String crop;
/** Descriptor classification. */
@NotNull
@Enumerated(EnumType.STRING)
@Column(length = 20, nullable = false)
private Category category;
......
......@@ -33,6 +33,8 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
import java.util.Map;
......@@ -62,6 +64,7 @@ public class DescriptorList extends UuidModel implements Publishable, SelfCleani
/**
* Trait title in English.
*/
@NotNull
@Column(nullable = false)
private String title;
......@@ -81,6 +84,7 @@ public class DescriptorList extends UuidModel implements Publishable, SelfCleani
/**
* User-specified version tag. E.g. "1.0", "1.1"
*/
@NotNull
@Column(nullable = false, updatable = false)
private String versionTag;
......@@ -99,6 +103,7 @@ public class DescriptorList extends UuidModel implements Publishable, SelfCleani
List<Descriptor> descriptors;
/** The owner. */
@NotNull
@ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "partnerId", updatable = false)
@JsonView({ JsonViews.Public.class })
......@@ -109,6 +114,7 @@ public class DescriptorList extends UuidModel implements Publishable, SelfCleani
private String publisher;
/** The crop. */
@Size(max = Crop.CROP_SHORTNAME_LENGTH)
@Column(name = "crop", length = Crop.CROP_SHORTNAME_LENGTH, nullable = true)
private String crop;
......
......@@ -28,6 +28,8 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.util.List;
/**
......@@ -60,12 +62,14 @@ public class ControlledVocabulary extends UuidModel implements Publishable, Self
/**
* Trait title in English.
*/
@Size(max = 200)
@Column(nullable = true, length = 200)
private String publisher;
/**
* Trait title in English.
*/
@NotNull
@Column(nullable = false)
private String title;
......@@ -99,6 +103,7 @@ public class ControlledVocabulary extends UuidModel implements Publishable, Self
private int termCount;
/** The owner. */
@NotNull
@ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "partnerId", updatable = false)
@JsonIdentityReference(alwaysAsId = false)
......
......@@ -27,6 +27,8 @@ import org.springframework.data.elasticsearch.annotations.Field;
import org.springframework.data.elasticsearch.annotations.FieldType;
import javax.persistence.*;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import java.text.MessageFormat;
/**
......@@ -51,12 +53,15 @@ public class VocabularyTerm extends BasicModel implements SelfCleaning {
private static final long serialVersionUID = 6568957772654494563L;
/** Term code. */
@NotNull
@Size(max = 50)
@Column(nullable = false, length = 50)
private String code;
/**
* Term title in English.
*/
@NotNull
@Column(nullable = false)
private String title;
......
......@@ -24,6 +24,8 @@ import org.genesys.catalog.model.traits.DescriptorList;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import javax.validation.Valid;
/**
* DescriptorList service interface.
*
......@@ -45,7 +47,7 @@ public interface DescriptorListService {
* @param input new descriptionList
* @return new descriptionList in Db
*/
DescriptorList createDescriptorList(DescriptorList input);
DescriptorList createDescriptorList(@Valid DescriptorList input);
/**
* Update descriptorList.
......@@ -53,7 +55,7 @@ public interface DescriptorListService {
* @param input new values
* @return updated descriptorList
*/
DescriptorList updateDescriptorList(DescriptorList input);
DescriptorList updateDescriptorList(@Valid DescriptorList input);
/**
* Remove descriptor of descriptorList.
......
......@@ -24,6 +24,7 @@ import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import org.springframework.security.access.method.P;
import javax.validation.Valid;
import java.io.IOException;
import java.io.OutputStream;
import java.util.List;
......@@ -40,7 +41,7 @@ public interface DescriptorService {
* @param descriptor the descriptor
* @return the descriptor
*/
Descriptor createDescriptor(Descriptor descriptor);
Descriptor createDescriptor(@Valid Descriptor descriptor);
/**
* Search matching descriptor.
......@@ -56,7 +57,7 @@ public interface DescriptorService {
* @param descriptor updatable descriptor
* @return updated descriptor
*/
Descriptor updateDescriptor(Descriptor descriptor);
Descriptor updateDescriptor(@Valid Descriptor descriptor);
/**
* copy descriptor.
......
......@@ -22,6 +22,7 @@ import org.genesys2.server.service.filter.InstituteFilter;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import javax.validation.Valid;
import java.util.Set;
import java.util.UUID;
......@@ -46,7 +47,7 @@ public interface PartnerService {
* @param input new Partner
* @return saved partner in db.
*/
Partner createPartner(Partner input);
Partner createPartner(@Valid Partner input);
/**
* Update partner data based on UUID.
......@@ -54,7 +55,7 @@ public interface PartnerService {
* @param input partner with new data
* @return updated partner
*/
Partner updatePartner(Partner input);
Partner updatePartner(@Valid Partner input);
/**
* Load partner by uuid of partner.
......
......@@ -22,6 +22,7 @@ import org.genesys2.server.exception.NotFoundElement;
import org.springframework.data.domain.Page;
import org.springframework.data.domain.Pageable;
import javax.validation.Valid;
import java.util.List;
import java.util.UUID;
......@@ -36,7 +37,7 @@ public interface VocabularyService {
* @param input create-by-example data
* @return persisted vocabulary
*/
ControlledVocabulary createVocabulary(ControlledVocabulary input);
ControlledVocabulary createVocabulary(@Valid ControlledVocabulary input);
/**
* Load vocabulary by it's UUID.
......@@ -61,7 +62,7 @@ public interface VocabularyService {
* @param input updated vocabulary definition
* @return persisted vocabulary
*/
ControlledVocabulary updateVocabulary(ControlledVocabulary input);
ControlledVocabulary updateVocabulary(@Valid ControlledVocabulary input);
/**
* Update persisted vocabulary or register a new controlled vocabulary.
......@@ -70,7 +71,7 @@ public interface VocabularyService {
* @param updated updated vocabulary definition
* @return persisted vocabulary
*/
ControlledVocabulary autoUpdateOrCreateVocabulary(UUID uuid, ControlledVocabulary updated);
ControlledVocabulary autoUpdateOrCreateVocabulary(UUID uuid, @Valid ControlledVocabulary updated);
/**
* Delete vocabulary.
......
......@@ -60,6 +60,9 @@ import org.springframework.transaction.annotation.Transactional;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
/**
* Service for working with {@link DescriptorList}.
......@@ -68,6 +71,7 @@ import com.querydsl.core.types.Predicate;
*/
@Service
@Transactional(readOnly = true)
@Validated
public class DescriptorListServiceImpl implements DescriptorListService {
private static final Logger LOG = LoggerFactory.getLogger(org.genesys.catalog.service.impl.DescriptorListServiceImpl.class);
......@@ -97,7 +101,7 @@ public class DescriptorListServiceImpl implements DescriptorListService {
@Transactional
@Override
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#input.owner, 'write')")
public DescriptorList createDescriptorList(final DescriptorList input) {
public DescriptorList createDescriptorList(@Valid final DescriptorList input) {
LOG.info("Create descriptor list {}", input);
final DescriptorList descriptorList = new DescriptorList();
......@@ -117,7 +121,7 @@ public class DescriptorListServiceImpl implements DescriptorListService {
@Transactional
@Override
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#input, 'WRITE')")
public DescriptorList updateDescriptorList(final DescriptorList input) {
public DescriptorList updateDescriptorList(@Valid final DescriptorList input) {
LOG.info("Updating descriptor list {}", input);
final DescriptorList descriptorList = descriptorListRepository.findByUuidAndVersion(input.getUuid(), input.getVersion());
......
......@@ -25,6 +25,7 @@ import java.util.List;
import java.util.UUID;
import javax.persistence.EntityManager;
import javax.validation.Valid;
import org.genesys.catalog.model.Partner;
import org.genesys.catalog.model.dataset.Dataset;
......@@ -63,12 +64,14 @@ import org.springframework.transaction.annotation.Transactional;
import com.querydsl.core.BooleanBuilder;
import com.querydsl.core.types.Predicate;
import org.springframework.validation.annotation.Validated;
/**
* The Class DescriptorServiceImpl.
*/
@Service("catalogDescriptorService")
@Transactional(readOnly = true)
@Validated
public class DescriptorServiceImpl implements DescriptorService {
/** The Constant LOG. */
......@@ -100,7 +103,7 @@ public class DescriptorServiceImpl implements DescriptorService {
@Transactional
@Override
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#input.owner, 'write')")
public Descriptor createDescriptor(final Descriptor input) {
public Descriptor createDescriptor(@Valid final Descriptor input) {
LOG.info("Creating descriptor: {} - {}", input.getTitle(), input.getDataType());
updateTerms(input);
......@@ -148,7 +151,7 @@ public class DescriptorServiceImpl implements DescriptorService {
@Transactional
@Override
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#descriptor, 'WRITE')")
public Descriptor updateDescriptor(final Descriptor descriptor) {
public Descriptor updateDescriptor(@Valid final Descriptor descriptor) {
LOG.info("Updating descriptor uuid={} id={}", descriptor.getUuid(), descriptor.getId());
final Descriptor loaded = reloadDescriptor(descriptor);
final Partner owner = loaded.getOwner();
......
......@@ -50,6 +50,9 @@ import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.security.acls.domain.BasePermission;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
import javax.validation.Valid;
/**
......@@ -57,6 +60,7 @@ import org.springframework.transaction.annotation.Transactional;
*/
@Service
@Transactional(readOnly = true)
@Validated
public class PartnerServiceImpl implements PartnerService, InitializingBean {
private static final Logger LOG = LoggerFactory.getLogger(org.genesys.catalog.service.impl.PartnerServiceImpl.class);
......@@ -105,7 +109,7 @@ public class PartnerServiceImpl implements PartnerService, InitializingBean {
@Transactional
@Override
@PreAuthorize("hasRole('ADMINISTRATOR')")
public Partner createPartner(final Partner input) {
public Partner createPartner(@Valid final Partner input) {
LOG.debug("Creating partner: {} - {}", input.getShortName(), input.getName());
final Partner partner = new Partner();
partner.setUuid(input.getUuid());
......@@ -120,7 +124,7 @@ public class PartnerServiceImpl implements PartnerService, InitializingBean {
@Override
@Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#input, 'write')")
public Partner updatePartner(final Partner input) {
public Partner updatePartner(@Valid final Partner input) {
LOG.info("Updating partner: uuid={} id={}", input.getUuid(), input.getId());
final Partner partner = loadPartner(input);
copyValues(partner, input);
......
......@@ -21,13 +21,13 @@ import java.util.UUID;
import java.util.stream.Collectors;
import javax.persistence.EntityManager;
import javax.validation.Valid;
import org.genesys.catalog.model.filters.ControlledVocabularyFilter;
import org.genesys.catalog.model.vocab.ControlledVocabulary;
import org.genesys.catalog.model.vocab.VocabularyTerm;
import org.genesys.catalog.persistence.vocab.ControlledVocabularyRepository;
import org.genesys.catalog.persistence.vocab.VocabularyTermRepository;
import org.genesys.catalog.service.PartnerService;
import org.genesys.catalog.service.VocabularyService;
import org.genesys2.server.exception.InvalidApiUsageException;
import org.genesys2.server.exception.NotFoundElement;
......@@ -44,12 +44,14 @@ import org.springframework.data.domain.Sort;
import org.springframework.security.access.prepost.PreAuthorize;
import org.springframework.stereotype.Service;
import org.springframework.transaction.annotation.Transactional;
import org.springframework.validation.annotation.Validated;
/**
* The Class VocabularyServiceImpl.
*/
@Service
@Transactional(readOnly = true)
@Validated
// TODO Add permission checks
public class VocabularyServiceImpl implements VocabularyService {
private static final Logger LOG = LoggerFactory.getLogger(VocabularyServiceImpl.class);
......@@ -60,15 +62,12 @@ public class VocabularyServiceImpl implements VocabularyService {
@Autowired
private VocabularyTermRepository termRepository;
@Autowired
private PartnerService partnerService;
@Autowired
private EntityManager entityManager;
@Override
@Transactional
public ControlledVocabulary createVocabulary(final ControlledVocabulary input) {
public ControlledVocabulary createVocabulary(@Valid final ControlledVocabulary input) {
final ControlledVocabulary controlledVocabulary = new ControlledVocabulary();
controlledVocabulary.setUuid(input.getUuid());
controlledVocabulary.setTitle(input.getTitle());
......@@ -134,7 +133,7 @@ public class VocabularyServiceImpl implements VocabularyService {
@Override
@Transactional
@PreAuthorize("hasRole('ADMINISTRATOR') or hasPermission(#input, 'write')")
public ControlledVocabulary updateVocabulary(final ControlledVocabulary input) {
public ControlledVocabulary updateVocabulary(@Valid final ControlledVocabulary input) {
if (input.getUuid() == null || input.getVersion() == null) {
throw new InvalidDataAccessApiUsageException("No uuid or version provided");
}
......@@ -167,7 +166,7 @@ public class VocabularyServiceImpl implements VocabularyService {
@Override
@Transactional
@PreAuthorize("hasRole('ADMINISTRATOR')")
public ControlledVocabulary autoUpdateOrCreateVocabulary(final UUID uuid, final ControlledVocabulary input) {
public ControlledVocabulary autoUpdateOrCreateVocabulary(final UUID uuid, @Valid final ControlledVocabulary input) {
final ControlledVocabulary oldVocabulary = vocabRepository.getByUuid(uuid);
if (oldVocabulary != null) {
......@@ -180,7 +179,6 @@ public class VocabularyServiceImpl implements VocabularyService {
return vocabRepository.save(oldVocabulary);
} else {
input.setUuid(uuid);
input.setOwner(partnerService.getPrimaryPartner());
LOG.info("Creating {} vocabulary with {} terms", input.getTitle(), input.getTerms().size());
return createVocabulary(input);
}
......
......@@ -19,6 +19,7 @@ import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
import org.genesys.catalog.model.vocab.ControlledVocabulary;
import org.genesys.catalog.model.vocab.VocabularyTerm;
import org.genesys.catalog.service.PartnerService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
......@@ -52,6 +53,9 @@ public class ISO639VocabularyUpdater {
@Autowired
private GeonamesISOLanguageSource isoLanguageSource;
@Autowired
private PartnerService partnerService;
/**
* Generates a current ISO639-3 {@link ControlledVocabulary} but doesn't persist
* it to storage.
......@@ -75,6 +79,7 @@ public class ISO639VocabularyUpdater {
final ControlledVocabulary vocabulary = new ControlledVocabulary();
vocabulary.setTitle(title);
vocabulary.setUrl(GeonamesISOLanguageSource.GEONAMES_ISO639_URL);
vocabulary.setOwner(partnerService.getPrimaryPartner());
final DateTimeFormatter dtf = DateTimeFormatter.ofPattern("yyyy.MM.dd");
final LocalDate localDate = LocalDate.now();
......
......@@ -33,6 +33,8 @@ import javax.persistence.OneToOne;
import javax.persistence.PrePersist;
import javax.persistence.PreUpdate;
import javax.persistence.Transient;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.genesys.blocks.model.AuditedVersionedModel;
import org.genesys.blocks.model.IdUUID;
......@@ -71,12 +73,16 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
@Column(name = "doi")
private String doi;
@Size(max = 10)
@NotNull
@Column(name = "instCode", length = 10, nullable = false)
private String instituteCode;
@Size(max = 100)
@Column(nullable = false, length = 100)
private String genus;
@NotNull
@ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "instituteId")
@JsonView({ JsonViews.Minimal.class })
......@@ -85,12 +91,15 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
// @QueryInit({ "country.region.*" })
private FaoInstitute institute;
@Size(max = 128)
@NotNull
@Column(name = "acceNumb", nullable = false, length = 128)
private String accessionNumber;
@Column(name = "seqNo", nullable = false)
private double seqNo = 0;
@Size(max = 100)
@Column(name = "cropName", nullable = true, length = 100)
private String cropName;
......@@ -99,6 +108,7 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
@Field(type = FieldType.Object)
private Crop crop;
@NotNull
@ManyToOne(cascade = {}, optional = false)
@JoinColumn(name = "taxonomyId2")
@JsonView({ JsonViews.Minimal.class })
......@@ -106,12 +116,15 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
private Taxonomy2 taxonomy;
// FIXME: Remove?
@Size(max = 3)
@Column(name = "acqSrc", length = 3)
private String acquisitionSource;
@Size(max = 12)
@Column(name = "acqDate", length = 12)
private String acquisitionDate;
@Size(max = 3)
@Column(name = "origCty", length = 3)
private String origCty;
......@@ -135,16 +148,19 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
@Column(name = "available")
private Boolean available;
@NotNull
@Column(name = "historic", nullable = false)
private boolean historic = false;
@Column(name = "mlsStat")
private Boolean mlsStatus;
@Size(max = 100)
@Column(name = "storageStr", length = 100, nullable = true)
@JsonIgnore
private String storageStr;
@Size(max = 300)
@Column(name = "acceurl", length = 300, nullable = true)
private String acceUrl;
......@@ -158,12 +174,15 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
@Type(type = "org.hibernate.type.TextType")
private String otherIds;
@Size(max = 9)
@Column(name = "donorCode", length = 9)
private String donorCode;
@Size(max = 300)
@Column(name = "donorName", length = 300)
private String donorName;
@Size(max = 200)
@Column(name = "donorNumb", length = 200)
private String donorNumb;
......@@ -172,6 +191,7 @@ public abstract class AccessionData extends AuditedVersionedModel implements IdU
@Type(type = "org.hibernate.type.TextType")
private String ancest;
@Size(max = 100)
@Column(name = "duplSiteStr", length = 100)
@JsonIgnore
private String duplSiteStr;
......
......@@ -29,6 +29,8 @@ import javax.persistence.PrePersist;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.genesys.blocks.model.AuditedVersionedModel;
import org.genesys2.server.api.serialization.MaterialRequestSerializer;
......@@ -49,17 +51,22 @@ public class MaterialRequest extends AuditedVersionedModel {
@Column
private int state = NOTVALIDATED;
@Size(max = 36)
@Column(length = 36, unique = true)
private String uuid;
@Size(max = 200)
@NotNull
@Column(length = 200, nullable = false)
private String email;
@Size(max = 100000)
@Column(length = 100000)
@Lob
@Type(type = "org.hibernate.type.TextType")
private String body;
@Size(max = 32)
@Column(length = 32, nullable = true)
private String pid;
......
......@@ -24,6 +24,8 @@ import javax.persistence.Lob;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.genesys2.server.model.AuditedModel;
import org.hibernate.annotations.Type;
......@@ -34,6 +36,8 @@ public class ActivityPost extends AuditedModel {
private static final long serialVersionUID = 8690395020204070378L;
@Size(max = 500)
@NotNull
@Column(nullable = false, length = 500)
private String title;
......
......@@ -26,6 +26,8 @@ import javax.persistence.ManyToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;
import javax.validation.constraints.NotNull;
import javax.validation.constraints.Size;
import org.genesys.blocks.model.ClassPK;