Skip to content

Commit bd22fe9

Browse files
committed
Fixes for Mar 2018 OMG Meeting demo.
1 parent b923589 commit bd22fe9

3 files changed

Lines changed: 9 additions & 4 deletions

File tree

app/controllers/ModelController.java

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -43,12 +43,11 @@ public Result all() {
4343

4444
public Result create() {
4545
JsonNode requestBodyJson = request().body().asJson();
46-
System.out.println(requestBodyJson);
4746
Model newModel = Json.fromJson(requestBodyJson, Model.class);
4847
Model createdModel = modelService.create(newModel);
4948
if(createdModel!=null)
5049
return created(Json.toJson(createdModel));
5150
else
52-
return badRequest("Mode with the following specification could not be created. \n " + requestBodyJson);
51+
return badRequest("Model with the following specification could not be created. \n " + requestBodyJson);
5352
}
5453
}

app/services/ElementService.java

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -63,9 +63,14 @@ public Element create(Element elem) {
6363
UUID elementIdentifier = elem.identifier;
6464
if(elementIdentifier == null) elementIdentifier = UUIDs.timeBased();
6565

66+
if(elem.name.startsWith("'"))
67+
elem.name = "'" + elem.name;
68+
69+
if(elem.name.endsWith("'"))
70+
elem.name = elem.name + "'";
71+
6672
String cqlCommand = String.format("INSERT INTO sysml2.elements(identifier,name,description, parent_model, type) " +
67-
"VALUES (%s,'%s','%s',%s,'%s')",
68-
elementIdentifier, elem.name, elem.description, elem.parent_model, elem.type);
73+
"VALUES (%s,'%s','%s',%s,'%s')", elementIdentifier, elem.name, elem.description, elem.parent_model, elem.type);
6974

7075
sessionBuilder.getSession().execute(cqlCommand);
7176
return getById(elementIdentifier);

conf/application.conf

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,5 +12,6 @@ db {
1212
play.http.secret.key="whatever"
1313
play.modules.enabled += "play.modules.swagger.SwaggerModule"
1414
play.filters.headers.contentSecurityPolicy = null
15+
play.filters.disabled+=play.filters.csrf.CSRFFilter
1516

1617

0 commit comments

Comments
 (0)