Skip to content

Commit 6421dc8

Browse files
committed
Merge branch 'release/2025-01'
2 parents 3c16bdc + 801f555 commit 6421dc8

30 files changed

+1234
-207
lines changed

app/dao/impl/jpa/JpaDataDao.java

Lines changed: 10 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
/*
22
* SysML v2 REST/HTTP Pilot Implementation
3-
* Copyright (C) 2021-2023 Twingineer LLC
3+
* Copyright (C) 2021-2025 Twingineer LLC
44
*
55
* This program is free software: you can redistribute it and/or modify
66
* it under the terms of the GNU Lesser General Public License as published by
@@ -59,6 +59,7 @@
5959
import java.util.stream.Stream;
6060

6161
import static dao.impl.jpa.JpaDao.paginateQuery;
62+
import static org.omg.sysml.query.impl.PrimitiveConstraintImpl.extractId;
6263

6364
public class JpaDataDao implements DataDao {
6465

@@ -239,7 +240,7 @@ else if (constraint instanceof PrimitiveConstraint) {
239240
JsonNode constrainedValueJson;
240241
try {
241242
constrainedValueJson = primitiveConstraint.getValue() != null ?
242-
Json.mapper().readTree(primitiveConstraint.getValue()) :
243+
Json.mapper().readTree(primitiveConstraint.getValue().get(0)) :
243244
null;
244245
} catch (IOException e) {
245246
throw new IllegalArgumentException(e);
@@ -279,13 +280,7 @@ else if (constraint instanceof PrimitiveConstraint) {
279280
} else if (Data.class.isAssignableFrom(property.getPropertyType())) {
280281
Object _actualValue = JavaBeanHelper.getBeanPropertyValue(data, property);
281282
actualValue = _actualValue != null ? ((Data) _actualValue).getId() : null;
282-
constrainedValue = constrainedValueJson != null ?
283-
JavaBeanHelper.convert(
284-
// intentionally `textValue` instead of `asText` to get a null value for
285-
// improved error reporting
286-
constrainedValueJson.path("@id").textValue(),
287-
UUID.class
288-
) : null;
283+
constrainedValue = constrainedValueJson != null ? extractId(constrainedValueJson) : null;
289284
if (constrainedValue == null) {
290285
throw new IllegalArgumentException();
291286
}
@@ -303,12 +298,18 @@ else if (constraint instanceof PrimitiveConstraint) {
303298
case LESS_THAN:
304299
comparisonResult = comparison < 0;
305300
break;
301+
case LESS_THAN_OR_EQUALS:
302+
comparisonResult = comparison <= 0;
303+
break;
306304
case EQUALS:
307305
comparisonResult = comparison == 0;
308306
break;
309307
case GREATER_THAN:
310308
comparisonResult = comparison > 0;
311309
break;
310+
case GREATER_THAN_OR_EQUALS:
311+
comparisonResult = comparison >= 0;
312+
break;
312313
default:
313314
throw new UnsupportedOperationException("Unsupported primitive constraint operator: " + primitiveConstraint.getOperator().name());
314315
}

app/org/omg/sysml/internal/CommitDataVersionIndex.java

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,14 +23,15 @@
2323
package org.omg.sysml.internal;
2424

2525
import org.omg.sysml.lifecycle.Commit;
26-
import org.omg.sysml.lifecycle.DataVersion;
27-
import org.omg.sysml.record.Record;
28-
import org.omg.sysml.record.impl.RecordImpl;
2926

3027
import java.util.Set;
3128
import java.util.UUID;
3229

33-
public interface CommitDataVersionIndex extends Record {
30+
public interface CommitDataVersionIndex {
31+
32+
UUID getId();
33+
34+
void setId(UUID id);
3435

3536
Commit getCommit();
3637

app/org/omg/sysml/internal/CommitNamedElementIndex.java

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,12 +2,15 @@
22

33
import org.omg.sysml.lifecycle.Commit;
44
import org.omg.sysml.metamodel.Element;
5-
import org.omg.sysml.record.Record;
65

76
import java.util.Map;
87
import java.util.UUID;
98

10-
public interface CommitNamedElementIndex extends Record {
9+
public interface CommitNamedElementIndex {
10+
11+
UUID getId();
12+
13+
void setId(UUID id);
1114

1215
Commit getCommit();
1316

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,17 @@
2222

2323
import org.omg.sysml.record.Record;
2424

25+
import javax.validation.constraints.NotNull;
2526
import java.time.ZonedDateTime;
2627

2728
public interface CommitReference extends Record {
2829

30+
@Override
31+
@NotNull
2932
String getName();
3033

31-
void setName(String name);
34+
@Override
35+
void setName(@NotNull String name);
3236

3337
Project getOwningProject();
3438

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

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,7 @@
2424

2525
import org.omg.sysml.record.Record;
2626

27+
import javax.validation.constraints.NotNull;
2728
import java.time.ZonedDateTime;
2829

2930
public interface Project extends Record {
@@ -43,7 +44,10 @@ public interface Project extends Record {
4344

4445
void setDefaultBranch(Branch defaultBranch);
4546

47+
@Override
48+
@NotNull
4649
String getName();
4750

48-
void setName(String name);
51+
@Override
52+
void setName(@NotNull String name);
4953
}

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

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -22,9 +22,7 @@
2222

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

25-
import com.fasterxml.jackson.annotation.JsonGetter;
2625
import com.fasterxml.jackson.annotation.JsonProperty;
27-
import com.fasterxml.jackson.annotation.JsonSetter;
2826
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2927
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
3028
import jackson.RecordSerialization;
@@ -34,15 +32,27 @@
3432
import org.omg.sysml.record.impl.RecordImpl;
3533

3634
import javax.persistence.*;
35+
import javax.validation.constraints.NotNull;
3736
import java.time.ZonedDateTime;
3837

3938
@Entity(name = "Branch")
4039
public class BranchImpl extends RecordImpl implements Branch {
4140
private Project owningProject;
4241
private Commit head;
43-
private String name;
4442
private ZonedDateTime created;
4543

44+
@Override
45+
@JsonProperty(required = true)
46+
public @NotNull String getName() {
47+
return super.getName();
48+
}
49+
50+
@Override
51+
@JsonProperty(required = true)
52+
public void setName(@NotNull String name) {
53+
super.setName(name);
54+
}
55+
4656
@Override
4757
@ManyToOne(targetEntity = ProjectImpl.class, fetch = FetchType.LAZY)
4858
@JsonSerialize(as = ProjectImpl.class, using = RecordSerialization.RecordSerializer.class)
@@ -74,21 +84,6 @@ public Commit getReferencedCommit() {
7484
return Branch.super.getReferencedCommit();
7585
}
7686

77-
@JsonProperty(required = true)
78-
@JsonGetter
79-
@Lob
80-
@org.hibernate.annotations.Type(type = "org.hibernate.type.TextType")
81-
@javax.persistence.Column(name = "name", table = "Branch")
82-
public String getName() {
83-
return name;
84-
}
85-
86-
@JsonProperty(required = true)
87-
@JsonSetter
88-
public void setName(String name) {
89-
this.name = name;
90-
}
91-
9287
@Override
9388
@Column
9489
public ZonedDateTime getCreated() {

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

Lines changed: 7 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@
3333
import org.omg.sysml.record.impl.RecordImpl;
3434

3535
import javax.persistence.*;
36+
import javax.validation.constraints.NotNull;
3637
import java.time.ZonedDateTime;
3738

3839
@Entity(name = "Project")
@@ -50,21 +51,16 @@ public void setCreated(ZonedDateTime created) {
5051
this.created = created;
5152
}
5253

53-
private String name;
54-
54+
@Override
5555
@JsonProperty(required = true)
56-
@JsonGetter
57-
@Lob
58-
@org.hibernate.annotations.Type(type = "org.hibernate.type.TextType")
59-
@javax.persistence.Column(name = "name", table = "Project")
60-
public String getName() {
61-
return name;
56+
public @NotNull String getName() {
57+
return super.getName();
6258
}
6359

60+
@Override
6461
@JsonProperty(required = true)
65-
@JsonSetter
66-
public void setName(String name) {
67-
this.name = name;
62+
public void setName(@NotNull String name) {
63+
super.setName(name);
6864
}
6965

7066
private Branch defaultBranch;

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

Lines changed: 13 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,7 @@
2020

2121
package org.omg.sysml.lifecycle.impl;
2222

23-
import com.fasterxml.jackson.annotation.JsonGetter;
2423
import com.fasterxml.jackson.annotation.JsonProperty;
25-
import com.fasterxml.jackson.annotation.JsonSetter;
2624
import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
2725
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
2826
import jackson.RecordSerialization;
@@ -32,15 +30,27 @@
3230
import org.omg.sysml.record.impl.RecordImpl;
3331

3432
import javax.persistence.*;
33+
import javax.validation.constraints.NotNull;
3534
import java.time.ZonedDateTime;
3635

3736
@Entity(name = "Tag")
3837
public class TagImpl extends RecordImpl implements Tag {
3938
private Project owningProject;
4039
private Commit taggedCommit;
41-
private String name;
4240
private ZonedDateTime created;
4341

42+
@Override
43+
@JsonProperty(required = true)
44+
public @NotNull String getName() {
45+
return super.getName();
46+
}
47+
48+
@Override
49+
@JsonProperty(required = true)
50+
public void setName(@NotNull String name) {
51+
super.setName(name);
52+
}
53+
4454
@Override
4555
@ManyToOne(targetEntity = ProjectImpl.class, fetch = FetchType.LAZY)
4656
@JsonSerialize(as = ProjectImpl.class, using = RecordSerialization.RecordSerializer.class)
@@ -71,21 +81,6 @@ public Commit getReferencedCommit() {
7181
return Tag.super.getReferencedCommit();
7282
}
7383

74-
@JsonProperty(required = true)
75-
@JsonGetter
76-
@Lob
77-
@org.hibernate.annotations.Type(type = "org.hibernate.type.TextType")
78-
@Column(name = "name", table = "Tag")
79-
public String getName() {
80-
return name;
81-
}
82-
83-
@JsonProperty(required = true)
84-
@JsonSetter
85-
public void setName(String name) {
86-
this.name = name;
87-
}
88-
8984
@Override
9085
@Column
9186
public ZonedDateTime getCreated() {

app/org/omg/sysml/query/PrimitiveConstraint.java

Lines changed: 5 additions & 2 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) 2023 Twingineer LLC
5+
* Copyright (C) 2023-2025 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,6 +22,9 @@
2222

2323
package org.omg.sysml.query;
2424

25+
import javax.annotation.Nullable;
26+
import java.util.List;
27+
2528
public interface PrimitiveConstraint extends Constraint {
2629
Boolean getInverse();
2730

@@ -31,7 +34,7 @@ public interface PrimitiveConstraint extends Constraint {
3134

3235
void setProperty(String property);
3336

34-
String getValue();
37+
@Nullable List<String> getValue();
3538

3639
// void setValue(String value);
3740

app/org/omg/sysml/query/PrimitiveOperator.java

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +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) 2025 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
@@ -24,10 +25,18 @@
2425
import com.fasterxml.jackson.annotation.JsonProperty;
2526

2627
public enum PrimitiveOperator {
28+
@JsonProperty("<")
29+
LESS_THAN,
30+
@JsonProperty("<=")
31+
LESS_THAN_OR_EQUALS,
2732
@JsonProperty("=")
2833
EQUALS,
2934
@JsonProperty(">")
3035
GREATER_THAN,
31-
@JsonProperty("<")
32-
LESS_THAN;
36+
@JsonProperty(">=")
37+
GREATER_THAN_OR_EQUALS,
38+
@JsonProperty("in")
39+
IN,
40+
@JsonProperty("instanceOf")
41+
INSTANCE_OF,
3342
}

app/org/omg/sysml/query/Query.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,9 +25,18 @@
2525
import org.omg.sysml.lifecycle.Project;
2626
import org.omg.sysml.record.Record;
2727

28+
import javax.validation.constraints.NotNull;
2829
import java.util.Set;
2930

3031
public interface Query extends Record {
32+
33+
@Override
34+
@NotNull
35+
String getName();
36+
37+
@Override
38+
void setName(@NotNull String name);
39+
3140
Project getOwningProject();
3241

3342
void setOwningProject(Project owningProject);

0 commit comments

Comments
 (0)