From 2d858e6e112398e2d2c75a9aef95563e29b1bf3c Mon Sep 17 00:00:00 2001 From: jendib Date: Sun, 14 Feb 2016 23:11:24 +0100 Subject: [PATCH] #65: Limit vocabulary values to 500 characters --- .../java/com/sismics/docs/core/model/jpa/Vocabulary.java | 2 +- docs-core/src/main/resources/db/update/dbupdate-006-0.sql | 8 ++++---- .../sismics/docs/rest/resource/VocabularyResource.java | 4 ++-- .../main/webapp/src/partial/docs/settings.vocabulary.html | 4 ++-- 4 files changed, 9 insertions(+), 9 deletions(-) diff --git a/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Vocabulary.java b/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Vocabulary.java index 384e7e16..8e484a28 100644 --- a/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Vocabulary.java +++ b/docs-core/src/main/java/com/sismics/docs/core/model/jpa/Vocabulary.java @@ -31,7 +31,7 @@ public class Vocabulary { /** * Vocabulary value. */ - @Column(name = "VOC_VALUE_C", nullable = false, length = 100) + @Column(name = "VOC_VALUE_C", nullable = false, length = 500) private String value; /** diff --git a/docs-core/src/main/resources/db/update/dbupdate-006-0.sql b/docs-core/src/main/resources/db/update/dbupdate-006-0.sql index 3ec07e0e..175567c7 100644 --- a/docs-core/src/main/resources/db/update/dbupdate-006-0.sql +++ b/docs-core/src/main/resources/db/update/dbupdate-006-0.sql @@ -3,10 +3,10 @@ alter table T_DOCUMENT add column DOC_IDENTIFIER_C varchar(500); alter table T_DOCUMENT add column DOC_PUBLISHER_C varchar(500); alter table T_DOCUMENT add column DOC_FORMAT_C varchar(500); alter table T_DOCUMENT add column DOC_SOURCE_C varchar(500); -alter table T_DOCUMENT add column DOC_TYPE_C varchar(100); -alter table T_DOCUMENT add column DOC_COVERAGE_C varchar(100); -alter table T_DOCUMENT add column DOC_RIGHTS_C varchar(100); -create memory table T_VOCABULARY ( VOC_ID_C varchar(36) not null, VOC_NAME_C varchar(50) not null, VOC_VALUE_C varchar(100) not null, VOC_ORDER_N int not null, primary key (VOC_ID_C) ); +alter table T_DOCUMENT add column DOC_TYPE_C varchar(500); +alter table T_DOCUMENT add column DOC_COVERAGE_C varchar(500); +alter table T_DOCUMENT add column DOC_RIGHTS_C varchar(500); +create memory table T_VOCABULARY ( VOC_ID_C varchar(36) not null, VOC_NAME_C varchar(50) not null, VOC_VALUE_C varchar(500) not null, VOC_ORDER_N int not null, primary key (VOC_ID_C) ); insert into T_VOCABULARY(VOC_ID_C, VOC_NAME_C, VOC_VALUE_C, VOC_ORDER_N) values('type-collection', 'type', 'Collection', 0); insert into T_VOCABULARY(VOC_ID_C, VOC_NAME_C, VOC_VALUE_C, VOC_ORDER_N) values('type-dataset', 'type', 'Dataset', 1); diff --git a/docs-web/src/main/java/com/sismics/docs/rest/resource/VocabularyResource.java b/docs-web/src/main/java/com/sismics/docs/rest/resource/VocabularyResource.java index 5941e28e..479d86d2 100644 --- a/docs-web/src/main/java/com/sismics/docs/rest/resource/VocabularyResource.java +++ b/docs-web/src/main/java/com/sismics/docs/rest/resource/VocabularyResource.java @@ -73,7 +73,7 @@ public class VocabularyResource extends BaseResource { // Validate input data name = ValidationUtil.validateLength(name, "name", 1, 50, false); ValidationUtil.validateRegex(name, "name", "[a-z0-9\\-]+"); - value = ValidationUtil.validateLength(value, "value", 1, 100, false); + value = ValidationUtil.validateLength(value, "value", 1, 500, false); Integer order = ValidationUtil.validateInteger(orderStr, "order"); // Create the vocabulary @@ -117,7 +117,7 @@ public class VocabularyResource extends BaseResource { if (name != null) { ValidationUtil.validateRegex(name, "name", "[a-z0-9\\-]+"); } - value = ValidationUtil.validateLength(value, "value", 1, 100, true); + value = ValidationUtil.validateLength(value, "value", 1, 500, true); Integer order = null; if (orderStr != null) { order = ValidationUtil.validateInteger(orderStr, "order"); diff --git a/docs-web/src/main/webapp/src/partial/docs/settings.vocabulary.html b/docs-web/src/main/webapp/src/partial/docs/settings.vocabulary.html index 0ec5abd9..a7a1e82a 100644 --- a/docs-web/src/main/webapp/src/partial/docs/settings.vocabulary.html +++ b/docs-web/src/main/webapp/src/partial/docs/settings.vocabulary.html @@ -23,7 +23,7 @@ - + @@ -37,7 +37,7 @@ - +