Skip to content

Commit

Permalink
#158 Cleanup of backend (#164)
Browse files Browse the repository at this point in the history
* #158 Refactored code style

* #158 Generated backend client

* #158 Fixed prod build
  • Loading branch information
aletutto authored Apr 8, 2020
1 parent 4bc19c6 commit ca22025
Show file tree
Hide file tree
Showing 11 changed files with 119 additions and 96 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,8 +56,8 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "if/then rule", "Simple condition example", new Date(),
"openVALIDATION IDE Team", new Date(), " IF the name IS NOT Validaria\n" +
"THEN the Name should be Validaria", schema);
"openVALIDATION IDE Team", new Date(), " IF the name IS NOT Validaria\n"
+ "THEN the Name should be Validaria", schema);
rulesetRepository.save(ruleset);

attributes = new HashSet<>();
Expand All @@ -67,9 +67,10 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "variables", "Introduction of variables", new Date(),
"openVALIDATION IDE Team", new Date(), "Berlin AS capital city\n" +
"\n" +
"the location HAS to be capital city", schema);
"openVALIDATION IDE Team", new Date(),
"Berlin AS capital city\n"
+ "\n"
+ "the location HAS to be capital city", schema);
rulesetRepository.save(ruleset);

attributes = new HashSet<>();
Expand All @@ -79,16 +80,17 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "precondition", "Advanced example including variables and conditions", new Date(),
"openVALIDATION IDE Team", new Date(), " the age is SMALLER than 18 \n" +
" AS underage\n" +
"\n" +
" the user MUST NOT be underage\n" +
" AND his name SHOULD be Validaria\n" +
"\n" +
"\n" +
" IF user IS NOT underage\n" +
" AND his location IS NOT Dortmund\n" +
"THEN sorry, your location should be Dortmund\n", schema);
"openVALIDATION IDE Team", new Date(),
" the age is SMALLER than 18 \n"
+ " AS underage\n"
+ "\n"
+ " the user MUST NOT be underage\n"
+ " AND his name SHOULD be Validaria\n"
+ "\n"
+ "\n"
+ " IF user IS NOT underage\n"
+ " AND his location IS NOT Dortmund\n"
+ "THEN sorry, your location should be Dortmund\n", schema);
rulesetRepository.save(ruleset);

attributes = new HashSet<>();
Expand All @@ -97,11 +99,12 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "arithmetic", "Usage of arithmetic operands", new Date(),
"openVALIDATION IDE Team", new Date(), " user's age - 18 years\n" +
"AS actual work experience\n" +
"\n" +
"the indicated professional experience MUST NOT be LARGER \n" +
"then the actual work experience", schema);
"openVALIDATION IDE Team", new Date(),
" user's age - 18 years\n"
+ "AS actual work experience\n"
+ "\n"
+ "the indicated professional experience MUST NOT be LARGER \n"
+ "then the actual work experience", schema);
rulesetRepository.save(ruleset);

attributes = new HashSet<>();
Expand All @@ -110,11 +113,12 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "nested conditions", "A condition in a condition", new Date(),
"openVALIDATION IDE Team", new Date(), " IF user's name IS Validaria\n" +
" AND his location IS Dortmund\n" +
" OR his location IS Berlin\n" +
"THEN if the user is named Validaria, \n" +
" he or she must not be from Dortmund or Berlin", schema);
"openVALIDATION IDE Team", new Date(),
" IF user's name IS Validaria\n"
+ " AND his location IS Dortmund\n"
+ " OR his location IS Berlin\n"
+ "THEN if the user is named Validaria, \n"
+ " he or she must not be from Dortmund or Berlin", schema);
rulesetRepository.save(ruleset);

/* attributes = new HashSet<>();
Expand All @@ -135,14 +139,15 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "legacy schema", "Build more advanced rules with objects", new Date(),
"openVALIDATION IDE Team", new Date(), " MFG.z_bfm32 IS MPA \n" +
" AS Student\n" +
"\n" +
" oZ2\n" +
" AS residence\n" +
"\n" +
" user SHOULD be a Student\n" +
" AND his residence SHOULD be Dortmund", schema);
"openVALIDATION IDE Team", new Date(),
" MFG.z_bfm32 IS MPA \n"
+ " AS Student\n"
+ "\n"
+ " oZ2\n"
+ " AS residence\n"
+ "\n"
+ " user SHOULD be a Student\n"
+ " AND his residence SHOULD be Dortmund", schema);
rulesetRepository.save(ruleset); */

/* attributes = new HashSet<>();
Expand All @@ -155,9 +160,10 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "first from list", "Reading from lists", new Date(),
"openVALIDATION IDE Team", new Date(), "first item from names as Boss\n" +
"\n" +
"I have to be the Boss", schema);
"openVALIDATION IDE Team", new Date(),
"first item from names as Boss\n"
+ "\n"
+ "I have to be the Boss", schema);
rulesetRepository.save(ruleset); */

/* attributes = new HashSet<>();
Expand All @@ -172,20 +178,22 @@ public void createInitialData() {
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "first from list with condition", "Advanced reading from lists", new Date(),
"openVALIDATION IDE Team", new Date(), "first number from numbers with a value bigger than 3 as magic number\n" +
"\n" +
"magic number has to be 4", schema);
"openVALIDATION IDE Team", new Date(),
"first number from numbers with a value bigger than 3 as magic number\n"
+ "\n"
+ "magic number has to be 4", schema);
rulesetRepository.save(ruleset); */

/* attributes = new HashSet<>();
attributes.add(new Attribute(UUID.randomUUID(), "age", AttributeType.NUMBER, "17", null));
schema = new Schema(UUID.randomUUID(), attributes);
schemaRepository.save(schema);
ruleset = new Ruleset(UUID.randomUUID(), "semantic operators", "Usage of semantic operators", new Date(),
"openVALIDATION IDE Team", new Date(), "age and smaller\n" +
"as operator younger\n" +
"\n" +
"user must not be younger than 18 years", schema);
"openVALIDATION IDE Team", new Date(),
"age and smaller\n"
+ "as operator younger\n"
+ "\n"
+ "user must not be younger than 18 years", schema);
rulesetRepository.save(ruleset); */
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,6 @@
import org.springframework.web.bind.annotation.ResponseStatus;
import org.springframework.web.bind.annotation.RestController;

import java.sql.SQLException;

@RestController
@Hidden
public class DatabaseResetController {
Expand All @@ -21,7 +19,7 @@ public DatabaseResetController(DatabaseResetService databaseResetService) {

@DeleteMapping(value = "/reset")
@ResponseStatus(HttpStatus.NO_CONTENT)
public void resetDatabaseToInitialState() throws SQLException {
public void resetDatabaseToInitialState() {
databaseResetService.resetDatabaseToInitialState();
}
}
Loading

0 comments on commit ca22025

Please sign in to comment.