Skip to content

Commit

Permalink
incorporate database updates
Browse files Browse the repository at this point in the history
* extended syntax
* added countries
* german quote validation
* relax name validation
* update version
  • Loading branch information
nittka committed Oct 28, 2023
1 parent fd0669b commit 2f67989
Show file tree
Hide file tree
Showing 22 changed files with 72 additions and 23 deletions.
2 changes: 1 addition & 1 deletion org.tvtower.db.feature/feature.xml
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
<?xml version="1.0" encoding="UTF-8"?>
<feature id="org.tvtower.db.feature"
label="Database Feature "
version="1.0.0.qualifier">
version="1.1.0.qualifier">
<plugin
id="org.tvtower.db"
download-size="0"
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.feature/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db.feature</artifactId>
<packaging>eclipse-feature</packaging>
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.ide/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.tvtower.db.ide
Bundle-ManifestVersion: 2
Bundle-Name: org.tvtower.db.ide
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-SymbolicName: org.tvtower.db.ide; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.tvtower.db,
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.ide/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db.ide</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.product/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,6 @@ Manifest-Version: 1.0
Bundle-ManifestVersion: 2
Bundle-Name: TVTower DB Editor
Bundle-SymbolicName: org.tvtower.db.product;singleton:=true
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Automatic-Module-Name: org.tvtower.db.product
Bundle-RequiredExecutionEnvironment: JavaSE-1.8
2 changes: 1 addition & 1 deletion org.tvtower.db.repository/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db.repository</artifactId>
<packaging>eclipse-repository</packaging>
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.target/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db.target</artifactId>
<packaging>eclipse-target-definition</packaging>
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.tvtower.db.tests
Bundle-ManifestVersion: 2
Bundle-Name: org.tvtower.db.tests
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-SymbolicName: org.tvtower.db.tests; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.tvtower.db,
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.ui.tests/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.tvtower.db.ui.tests
Bundle-ManifestVersion: 2
Bundle-Name: org.tvtower.db.ui.tests
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-SymbolicName: org.tvtower.db.ui.tests; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.tvtower.db.ui,
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.ui.tests/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db.ui.tests</artifactId>
<packaging>eclipse-test-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.ui/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.tvtower.db.ui
Bundle-ManifestVersion: 2
Bundle-Name: org.tvtower.db.ui
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-SymbolicName: org.tvtower.db.ui; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.tvtower.db,
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db.ui/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db.ui</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db/META-INF/MANIFEST.MF
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ Manifest-Version: 1.0
Automatic-Module-Name: org.tvtower.db
Bundle-ManifestVersion: 2
Bundle-Name: org.tvtower.db
Bundle-Version: 1.0.0.qualifier
Bundle-Version: 1.1.0.qualifier
Bundle-SymbolicName: org.tvtower.db; singleton:=true
Bundle-ActivationPolicy: lazy
Require-Bundle: org.eclipse.xtext,
Expand Down
2 changes: 1 addition & 1 deletion org.tvtower.db/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.tvtower.db</groupId>
<artifactId>org.tvtower.db.parent</artifactId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
</parent>
<artifactId>org.tvtower.db</artifactId>
<packaging>eclipse-plugin</packaging>
Expand Down
9 changes: 8 additions & 1 deletion org.tvtower.db/src/org/tvtower/db/Database.xtext
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,7 @@ ScriptTemplate:
'>'
(
title=Title &
title_original=TitleOriginal? &
description=Description?&
variables=Variables? &
genres=ScriptGenres?&
Expand Down Expand Up @@ -247,8 +248,14 @@ ProgrammeRole:
('guid''='name=STRING )&
('first_name''='firstName=STRING)&
('last_name''='lastName=STRING)&
('first_name_original''='firstNameOriginal=STRING)?&
('last_name_original''='lastNameOriginal=STRING)?&
//TODO not supported by database code
// ('nick_name''='nickName=STRING)?&
// ('nick_name_original''='nickNameOriginal=STRING)?&
('title''='title=STRING)?&
('country''='country=STRING)?&
('comment''='comment=STRING)?&
('gender''='gender=STRING)?
)
'/>'
Expand Down Expand Up @@ -843,7 +850,7 @@ TitleOriginal:
Version: '<' 'version' {Version}props+=UnnamedProperty* '/>';
UnnamedProperty:key=IDorKeyword'='value=STRING;

IDorKeyword:ID|'version'|'jobs'|'job'|'title'|'description'|'value'|'price'|'quality'|'money'|'children'|'infomercial'|'available'|'type'|'group'|'comment'|'genre'|'genres'|'effect'|'time'|'probability'|'news'|'country'|'fictional'|'appearance'|'birthday'|'person'|'power'|'humor'|'charisma'|'fame'|'popularity'|'groups'|'staff'|'member'|'programme'|'index'|'function'|'year'|'distribution'|'critics'|'speed'|'outcome'|'ad'|'celebritypeople'|'script'|'choose'|'tags'|'product'|'images'|'name'|'modifier'|'modifiers'|'generator'|'ratings'|'min'|'day'|'hour'|'trigger'|'blocks'|'enable'|'episodes'|'flags'|'max'|'penalty'|'data'|'potential'|'effects'|'guid'|'profit'|'gender'|'task'|'tasks'|'conditions'|'details'|'reward'|'rewards'|'persons'|'role'|'roles';
IDorKeyword:ID|'version'|'jobs'|'job'|'title'|'description'|'value'|'price'|'quality'|'money'|'children'|'infomercial'|'available'|'type'|'group'|'comment'|'genre'|'genres'|'effect'|'time'|'probability'|'news'|'country'|'fictional'|'appearance'|'birthday'|'person'|'power'|'humor'|'charisma'|'fame'|'popularity'|'groups'|'staff'|'member'|'programme'|'index'|'function'|'year'|'distribution'|'critics'|'speed'|'outcome'|'ad'|'celebritypeople'|'script'|'choose'|'tags'|'product'|'images'|'name'|'modifier'|'modifiers'|'generator'|'ratings'|'min'|'day'|'hour'|'trigger'|'blocks'|'enable'|'episodes'|'flags'|'max'|'penalty'|'data'|'potential'|'effects'|'guid'|'profit'|'gender'|'task'|'tasks'|'conditions'|'details'|'reward'|'rewards'|'persons'|'role'|'roles'|'='|'subgenre'|'category'|'text'|'required';
TextContent:(IDorKeyword |STRING|INT|ANY_OTHER)* /* ignore variables and variable resolution for now*/ ;

//no variable recognition, yet
Expand Down
15 changes: 14 additions & 1 deletion org.tvtower.db/src/org/tvtower/db/constants/Country.java
Original file line number Diff line number Diff line change
Expand Up @@ -6,21 +6,25 @@ public class Country extends TVTEnum {
add("A","Austria");
add("AFG","Afghanistan");
add("AUS","Australia");
add("BE","Belgium");
add("B","Belgium");
add("BM","Bermudas");
add("BOL","Bolivia");
add("BR","Brazil");
add("BW","Republic of Botswana");
add("C","Cuba");
add("CDN","Canada");
add("CH","Switzerland");
add("CHN","China");
add("CO","Colombia");
add("CS","Tchechoslovakia");
add("CZ","Czech Republic");
add("D","Germany");
add("DDR","GDR");
add("DK","Denmark");
add("E","Spain");
add("F","France");
add("GB","United Kingdom");
add("GH","Ghana");
add("GR", "Greece");
add("H","Hungary");
add("HK","Hongkong");
Expand All @@ -29,18 +33,27 @@ public class Country extends TVTEnum {
add("IND","India");
add("IRL","Ireland");
add("J","Japan");
add("KN","Greenland");
add("MEX","Mexico");
add("NL","Netherlands");
add("NZ","New Zealand");
add("P","Portugal");
add("PA","Panama");
add("PE","Peru");
add("PL","Poland");
add("RA","Argentina");
add("RC","Taiwan");
add("RM","Republic of Moldavia");
add("ROK","South Korea");
add("RP","Rep. of the Philippines");
add("S","Sweden");
add("SCO","Scotland");
add("SU","Soviet Union");
add("TN","Tunesia");
add("TR","Turkey");
add("USA","USA");
add("YU","Yugoslavia");
add("ZA","South Africa");
add("ZW","Zimbabwe");
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ private boolean checkYear(String year, EAttribute f) {
private boolean checkScript(Availability a) {
boolean result = false;
Pattern logicalOperatorPattern = Pattern.compile("\\|\\| | &amp;&amp;");
String compareOperatorPattern = "=|<=|>=|<|>";
String compareOperatorPattern = "=|<=|>=|<|>";//|&gt;|&lt;|&gt;=|&lt;=";
String script = a.getScript();
if (!Strings.isNullOrEmpty(a.getScript())) {
List<String> compontens = Splitter.on(logicalOperatorPattern).trimResults().omitEmptyStrings()
Expand Down Expand Up @@ -189,6 +189,12 @@ public void checkLanguageStringsContainer(ContainsLanguageStrings c) {
// lcontent.add(content);
// }
validateOptionsCount(l, optionsCount);
if("de".equals(language)) {
String content=l.getText();
if(content.indexOf('"')>=0) {
error("contains non-German quotes", l, $.getLanguageString_Langage());
}
}
}
}

Expand Down Expand Up @@ -234,6 +240,9 @@ public void checkLanguageString(LanguageString s) {
} else if (variable.startsWith("PERSONGENERATOR")) {
// TODO check person generator variable
continue;
} else if (variable.startsWith("ROLE")) {
// TODO check ROLE/ROLENAME
continue;
}
if (definedVariables == null) {
definedVariables = getVariablesFromContainers(s);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ public static Optional<String> getIntRangeError(String value, String fieldName,
if (mandatory && Strings.isNullOrEmpty(value)) {
return Optional.of(fieldName + " is missing");
}
if (!Strings.isNullOrEmpty(value)) {
if (value!=null) {
try {
int asNumber = Integer.parseInt(value);
if (asNumber < min) {
Expand Down
24 changes: 22 additions & 2 deletions org.tvtower.db/src/org/tvtower/db/validation/PersonsValidator.java
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.tvtower.db.validation;

import java.math.BigDecimal;
import java.util.Optional;

import org.eclipse.emf.ecore.EStructuralFeature;
import org.eclipse.xtext.validation.Check;
Expand Down Expand Up @@ -40,6 +41,7 @@ public void checkGeneral(Person person) {
error("fictional defined multiple times", $.getPerson_Fictional());
}
checkNameChanges(person);
checkDates(person);
}

@Check
Expand Down Expand Up @@ -122,7 +124,6 @@ public void checkPersonDetails(PersonDetails d) {
.ifPresent(e -> error(e, $.getPersonDetails_Gender()));
Constants._boolean.isValidValue(d.getFictional(), "fictional", false)
.ifPresent(e -> error(e, $.getPersonDetails_Fictional()));
// TODO birthday, deathday
}

private boolean isGenderDefined(Person p) {
Expand All @@ -143,7 +144,7 @@ private boolean isInsignificant(Person p) {
@Check
public void checkRole(ProgrammeRole r) {
CommonValidation.getValueMissingError("first_name", r.getFirstName())
.ifPresent(e -> error(e, $.getProgrammeRole_FirstName()));
.ifPresent(e -> warning(e, $.getProgrammeRole_FirstName()));
CommonValidation.getValueMissingError("last_name", r.getLastName())
.ifPresent(e -> warning(e, $.getProgrammeRole_LastName()));
CommonValidation.getCountryError(r.getCountry(), false).ifPresent(e -> error(e, $.getProgrammeRole_Country()));
Expand Down Expand Up @@ -184,4 +185,23 @@ private void checkNameChanges(Person person) {
// }
// }
}

private void checkDates(Person person) {
dateError(person.getBirthday()).ifPresent(e -> error(e, $.getPerson_Birthday()));
dateError(person.getDeathday()).ifPresent(e -> error(e, $.getPerson_Deathday()));
if(person.getDetails()!=null) {
dateError(person.getDetails().getBirthday()).ifPresent(e -> error(e, person.getDetails(), $.getPersonDetails_Birthday()));
dateError(person.getDetails().getDeathday()).ifPresent(e -> error(e, person.getDetails(), $.getPersonDetails_Deathday()));
}
}

private Optional<String> dateError(String dateString) {
if(dateString!=null) {
if("-1".equals(dateString) ||dateString.startsWith("-1-")) {
return Optional.of("relative year -1 is not supported");
}
//TODO further checks on dates
}
return Optional.empty();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,7 @@ public void checkProgrammeData(ProgrammeData d) {
.ifPresent(e -> error(e, $.getProgrammeData_Flags()));
Constants.licenceFlag.isValidFlag(d.getLicenceFlags(), "licence_flags", false)
.ifPresent(e -> error(e, $.getProgrammeData_LicenceFlags()));
CommonValidation.getIntRangeError(d.getBlocks(), "blocks", 0, 12, false)
CommonValidation.getIntRangeError(d.getBlocks(), "blocks", 1, 12, false)
.ifPresent(e -> error(e, $.getProgrammeData_Blocks()));
CommonValidation.getIntRangeError(d.getSlotStart(), "broadcast_time_slot_start", 0, 22, false)
.ifPresent(e -> error(e, $.getProgrammeData_SlotStart()));
Expand Down
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<modelVersion>4.0.0</modelVersion>
<groupId>org.tvtower.db</groupId>
<version>1.0.0-SNAPSHOT</version>
<version>1.1.0-SNAPSHOT</version>
<artifactId>org.tvtower.db.parent</artifactId>
<packaging>pom</packaging>

Expand Down

0 comments on commit 2f67989

Please sign in to comment.