Commit 741d461c authored by Adrien's avatar Adrien Committed by Romain Bioteau
Browse files

fix(BDM) attribute name warning (#969)

* Add a warning when an attribute name starts with an upper case

closes [BS-17926](https://bonitasoft.atlassian.net/browse/BS-17926)
parent 26c1efd9
......@@ -164,4 +164,5 @@ lengthIsNotANumber=Length must be an integer
dateDetails=DATE stores a date and a time in the database using a LONG (number of milliseconds ellapsed sine 01/01/1970 00:00:00: (UTC)) and uses java.util.Date as Java type.\nComplex operations in UI Designer, Groovy scripts, and REST API created some unconsistencies with the type DATE. \nTherefore, DATE stays in the list to support previous developments, but for new developments, use the types DATE ONLY, DATE-TIME (NO TIME ZONE), or DATE-TIME (TIME ZONE) to handle date or date/time depending on your use-case.
dateOnlyDetails=%s is used to hold a date with no time of the day. Use it for birth dates for example.\nIt is stored in the database as a String, using ISO-8601 "yyyy-mm-dd". It uses a java.time.LocalDate as Java type.
dateTimeDetails=%s is used to hold a date-time that displays the same whatever the user's time zone (NO Time Zone). Use it for stores opening hours for example.\nIt is stored in the database as a String using ISO 8601 "yyyyy-mm-ddThh:mm:ss:sss". It uses java.time.LocalDateTime as Java type.
dateTimeInTimezoneDetails=%s is used to hold a date-time that will take the user's computer time zone (TZ) into account when displayed. Use it for meetings date and time for example.\nIt is stored in the database as a String using ISO 8601 "yyyy-mm-ddThh:mm:ss.sssZ". It uses java.time.OffsetDateTime as Java type.
\ No newline at end of file
dateTimeInTimezoneDetails=%s is used to hold a date-time that will take the user's computer time zone (TZ) into account when displayed. Use it for meetings date and time for example.\nIt is stored in the database as a String using ISO 8601 "yyyy-mm-ddThh:mm:ss.sssZ". It uses java.time.OffsetDateTime as Java type.
fieldNameShouldStartsWithLowercase=Attribute name should starts with a lower case, else it might leads to some errors.
\ No newline at end of file
......@@ -339,6 +339,8 @@ public class Messages extends NLS {
public static String dateTimeInTimezoneDetails;
public static String fieldNameShouldStartsWithLowercase;
private Messages() {
}
......
......@@ -14,6 +14,8 @@
*/
package org.bonitasoft.studio.businessobject.ui.wizard.validator;
import java.util.Objects;
import org.bonitasoft.engine.bdm.model.BusinessObject;
import org.bonitasoft.engine.bdm.model.field.Field;
import org.bonitasoft.engine.bdm.validator.SQLNameValidator;
......@@ -59,7 +61,7 @@ public class FieldNameCellEditorValidator implements ICellEditorValidator, IVali
}
protected IStatus doValidate(Object value) {
IStatus status = JavaConventions.validateFieldName((String) value, JavaCore.VERSION_1_6, JavaCore.VERSION_1_6);
IStatus status = JavaConventions.validateFieldName((String) value, JavaCore.VERSION_1_8, JavaCore.VERSION_1_8);
if (!status.isOK()) {
return status;
}
......@@ -83,6 +85,9 @@ public class FieldNameCellEditorValidator implements ICellEditorValidator, IVali
return ValidationStatus.error(Messages.fieldNameAlreadyExists);
}
}
if (!Objects.equals(value.toString().substring(0, 1), value.toString().substring(0, 1).toLowerCase())) {
return ValidationStatus.warning(Messages.fieldNameShouldStartsWithLowercase);
}
return ValidationStatus.ok();
}
......
Supports Markdown
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