Commit 8fa0fe93 authored by Matija Obreza's avatar Matija Obreza
Browse files

Trim FAO Institute acronym to column width, if necessary

parent 91fba4f5
...@@ -50,9 +50,10 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize; ...@@ -50,9 +50,10 @@ import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@JsonSerialize(using = FaoInstituteSerializer.class) @JsonSerialize(using = FaoInstituteSerializer.class)
public class FaoInstitute extends BusinessModel implements GeoReferencedEntity, AclAwareModel, EntityId { public class FaoInstitute extends BusinessModel implements GeoReferencedEntity, AclAwareModel, EntityId {
private static final long serialVersionUID = -8773002513838748431L; private static final long serialVersionUID = -8773002513838748431L;
private static final int LEN_ACRONYM = 50;
@Column(unique = true, nullable = false, length = 10) @Column(unique = true, nullable = false, length = 10)
private String code; private String code;
...@@ -68,7 +69,7 @@ public class FaoInstitute extends BusinessModel implements GeoReferencedEntity, ...@@ -68,7 +69,7 @@ public class FaoInstitute extends BusinessModel implements GeoReferencedEntity,
@Column(length = 300) @Column(length = 300)
private String email; private String email;
@Column(length = 50) @Column(length = LEN_ACRONYM)
private String acronym; private String acronym;
@Column(length = 10) @Column(length = 10)
...@@ -150,7 +151,7 @@ public class FaoInstitute extends BusinessModel implements GeoReferencedEntity, ...@@ -150,7 +151,7 @@ public class FaoInstitute extends BusinessModel implements GeoReferencedEntity,
} }
public void setAcronym(final String acronym) { public void setAcronym(final String acronym) {
this.acronym = acronym; this.acronym = StringUtils.abbreviate(acronym, LEN_ACRONYM);
} }
public String getAcronym() { public String getAcronym() {
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment