Skip to content

Commit 111e8c9

Browse files
authored
Merge pull request #84 from Systems-Modeling/feature/ST5AS-202
feat: add Commit::description and Project::created ST5AS-202
2 parents 454f14b + 2285205 commit 111e8c9

12 files changed

Lines changed: 63980 additions & 66277 deletions

File tree

app/controllers/ProjectController.java

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SysML v2 REST/HTTP Pilot Implementation
33
* Copyright (C) 2020 InterCAX LLC
44
* Copyright (C) 2020 California Institute of Technology ("Caltech")
5-
* Copyright (C) 2021 Twingineer LLC
5+
* Copyright (C) 2021-2022 Twingineer LLC
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by
@@ -35,6 +35,7 @@
3535
import services.ProjectService;
3636

3737
import javax.inject.Inject;
38+
import java.time.ZonedDateTime;
3839
import java.util.List;
3940
import java.util.Optional;
4041
import java.util.UUID;
@@ -95,6 +96,10 @@ public Result getProjects(Request request) {
9596
public Result postProject(Request request) {
9697
JsonNode requestBodyJson = request.body().asJson();
9798
Project requestedObject = Json.fromJson(requestBodyJson, metamodelProvider.getImplementationClass(Project.class));
99+
if (requestedObject.getId() != null || requestedObject.getCreated() != null) {
100+
return Results.badRequest();
101+
}
102+
requestedObject.setCreated(ZonedDateTime.now());
98103
Optional<Project> project = projectService.create(requestedObject);
99104
if (project.isEmpty()) {
100105
return Results.internalServerError();

app/org/omg/sysml/lifecycle/Commit.java

Lines changed: 9 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SysML v2 REST/HTTP Pilot Implementation
33
* Copyright (C) 2020 InterCAX LLC
44
* Copyright (C) 2020 California Institute of Technology ("Caltech")
5-
* Copyright (C) 2021 Twingineer LLC
5+
* Copyright (C) 2021-2022 Twingineer LLC
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by
@@ -39,11 +39,15 @@ public interface Commit extends Record {
3939

4040
void setChange(Set<DataVersion> changes);
4141

42-
Commit getPreviousCommit();
43-
44-
void setPreviousCommit(Commit previousCommit);
45-
4642
ZonedDateTime getCreated();
4743

4844
void setCreated(ZonedDateTime created);
45+
46+
String getDescription();
47+
48+
void setDescription(String description);
49+
50+
Commit getPreviousCommit();
51+
52+
void setPreviousCommit(Commit previousCommit);
4953
}

app/org/omg/sysml/lifecycle/Project.java

Lines changed: 11 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
/*
22
* SysML v2 REST/HTTP Pilot Implementation
3-
* Copyright (C) 2020 InterCAX LLC
4-
* Copyright (C) 2020 California Institute of Technology ("Caltech")
3+
* Copyright (C) 2020 InterCAX LLC
4+
* Copyright (C) 2020 California Institute of Technology ("Caltech")
5+
* Copyright (C) 2022 Twingineer LLC
56
*
67
* This program is free software: you can redistribute it and/or modify
78
* it under the terms of the GNU Lesser General Public License as published by
@@ -23,15 +24,16 @@
2324

2425
import org.omg.sysml.record.Record;
2526

27+
import java.time.ZonedDateTime;
28+
2629
public interface Project extends Record {
2730

2831
String NAME = "Project";
2932
String DEFAULT_BRANCH_NAME = "main";
3033

31-
// Collection<Element> getContainedElement();
32-
String getName();
34+
ZonedDateTime getCreated();
3335

34-
void setName(String name);
36+
void setCreated(ZonedDateTime created);
3537

3638
String getDescription();
3739

@@ -40,4 +42,8 @@ public interface Project extends Record {
4042
Branch getDefaultBranch();
4143

4244
void setDefaultBranch(Branch defaultBranch);
45+
46+
String getName();
47+
48+
void setName(String name);
4349
}

app/org/omg/sysml/lifecycle/impl/CommitImpl.java

Lines changed: 19 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SysML v2 REST/HTTP Pilot Implementation
33
* Copyright (C) 2020 InterCAX LLC
44
* Copyright (C) 2020 California Institute of Technology ("Caltech")
5-
* Copyright (C) 2021 Twingineer LLC
5+
* Copyright (C) 2021-2022 Twingineer LLC
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by
@@ -22,7 +22,9 @@
2222

2323
package org.omg.sysml.lifecycle.impl;
2424

25+
import com.fasterxml.jackson.annotation.JsonGetter;
2526
import com.fasterxml.jackson.annotation.JsonProperty;
27+
import com.fasterxml.jackson.annotation.JsonSetter;
2628
import com.fasterxml.jackson.annotation.JsonView;
2729
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2830
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
@@ -42,6 +44,7 @@ public class CommitImpl extends RecordImpl implements Commit {
4244
private Project owningProject;
4345
private Set<DataVersion> change;
4446
private ZonedDateTime created;
47+
private String description;
4548
private Commit previousCommit;
4649

4750
@Override
@@ -82,6 +85,21 @@ public void setCreated(ZonedDateTime created) {
8285
this.created = created;
8386
}
8487

88+
@JsonProperty(required = true)
89+
@JsonGetter
90+
@Lob
91+
@org.hibernate.annotations.Type(type = "org.hibernate.type.TextType")
92+
@javax.persistence.Column(name = "description", table = "Commit")
93+
public String getDescription() {
94+
return description;
95+
}
96+
97+
@JsonProperty(required = true)
98+
@JsonSetter
99+
public void setDescription(String description) {
100+
this.description = description;
101+
}
102+
85103
@ManyToOne(targetEntity = CommitImpl.class, fetch = FetchType.LAZY)
86104
@JsonSerialize(as = CommitImpl.class, using = RecordSerialization.RecordSerializer.class)
87105
@JsonView(Views.Compact.class)

app/org/omg/sysml/lifecycle/impl/ProjectImpl.java

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@
22
* SysML v2 REST/HTTP Pilot Implementation
33
* Copyright (C) 2020 InterCAX LLC
44
* Copyright (C) 2020 California Institute of Technology ("Caltech")
5-
* Copyright (C) 2021 Twingineer LLC
5+
* Copyright (C) 2021-2022 Twingineer LLC
66
*
77
* This program is free software: you can redistribute it and/or modify
88
* it under the terms of the GNU Lesser General Public License as published by
@@ -33,9 +33,23 @@
3333
import org.omg.sysml.record.impl.RecordImpl;
3434

3535
import javax.persistence.*;
36+
import java.time.ZonedDateTime;
3637

3738
@Entity(name = "Project")
3839
public class ProjectImpl extends RecordImpl implements Project {
40+
41+
private ZonedDateTime created;
42+
43+
@Override
44+
@Column
45+
public ZonedDateTime getCreated() {
46+
return created;
47+
}
48+
49+
public void setCreated(ZonedDateTime created) {
50+
this.created = created;
51+
}
52+
3953
private String name;
4054

4155
@JsonProperty(required = true)

conf/json/schema/api/OmgSysMLApi.json

Lines changed: 26 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,10 @@
1414
"type": "string",
1515
"const": "Project"
1616
},
17+
"created": {
18+
"type": "string",
19+
"format": "date-time"
20+
},
1721
"defaultBranch": {
1822
"$ref": "http://www.omg.org/spec/SysML/2.0/Identified",
1923
"$comment": "http://www.omg.org/spec/SysML/2.0/API/Branch"
@@ -35,6 +39,7 @@
3539
"required": [
3640
"@id",
3741
"@type",
42+
"created",
3843
"defaultBranch",
3944
"description",
4045
"name"
@@ -151,6 +156,16 @@
151156
"type": "string",
152157
"format": "date-time"
153158
},
159+
"description": {
160+
"oneOf": [
161+
{
162+
"type": "string"
163+
},
164+
{
165+
"type": "null"
166+
}
167+
]
168+
},
154169
"owningProject": {
155170
"$ref": "http://www.omg.org/spec/SysML/2.0/Identified",
156171
"$comment": "http://www.omg.org/spec/SysML/2.0/API/Branch"
@@ -167,6 +182,7 @@
167182
"@id",
168183
"@type",
169184
"created",
185+
"description",
170186
"owningProject",
171187
"previousCommit"
172188
],
@@ -465,13 +481,20 @@
465481
"type": "string",
466482
"const": "Error"
467483
},
468-
"message": {
469-
"type": "string"
484+
"description": {
485+
"oneOf": [
486+
{
487+
"type": "string"
488+
},
489+
{
490+
"type": "null"
491+
}
492+
]
470493
}
471494
},
472495
"required": [
473496
"@type",
474-
"message"
497+
"description"
475498
],
476499
"additionalProperties": true
477500
}

generated/org/omg/sysml/lifecycle/impl/CommitImpl_.java

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,13 @@ public abstract class CommitImpl_ extends org.omg.sysml.record.impl.RecordImpl_
1212

1313
public static volatile SingularAttribute<CommitImpl, ZonedDateTime> created;
1414
public static volatile SetAttribute<CommitImpl, DataVersionImpl> change;
15+
public static volatile SingularAttribute<CommitImpl, String> description;
1516
public static volatile SingularAttribute<CommitImpl, CommitImpl> previousCommit;
1617
public static volatile SingularAttribute<CommitImpl, ProjectImpl> owningProject;
1718

1819
public static final String CREATED = "created";
1920
public static final String CHANGE = "change";
21+
public static final String DESCRIPTION = "description";
2022
public static final String PREVIOUS_COMMIT = "previousCommit";
2123
public static final String OWNING_PROJECT = "owningProject";
2224

generated/org/omg/sysml/lifecycle/impl/ProjectImpl_.java

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.omg.sysml.lifecycle.impl;
22

3+
import java.time.ZonedDateTime;
34
import javax.annotation.processing.Generated;
45
import javax.persistence.metamodel.SingularAttribute;
56
import javax.persistence.metamodel.StaticMetamodel;
@@ -8,10 +9,12 @@
89
@StaticMetamodel(ProjectImpl.class)
910
public abstract class ProjectImpl_ extends org.omg.sysml.record.impl.RecordImpl_ {
1011

12+
public static volatile SingularAttribute<ProjectImpl, ZonedDateTime> created;
1113
public static volatile SingularAttribute<ProjectImpl, BranchImpl> defaultBranch;
1214
public static volatile SingularAttribute<ProjectImpl, String> name;
1315
public static volatile SingularAttribute<ProjectImpl, String> description;
1416

17+
public static final String CREATED = "created";
1518
public static final String DEFAULT_BRANCH = "defaultBranch";
1619
public static final String NAME = "name";
1720
public static final String DESCRIPTION = "description";

public/docs/openapi-sans-schemas.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2597,8 +2597,8 @@
25972597
"tags": [
25982598
"Meta"
25992599
],
2600-
"summary": "Get types by ID",
2601-
"operationId": "getDataTypeById",
2600+
"summary": "Get datatype by ID",
2601+
"operationId": "getDatatypeById",
26022602
"parameters": [
26032603
{
26042604
"name": "datatypeId",

0 commit comments

Comments
 (0)