Skip to content

Commit 5f83675

Browse files
committed
Rename userDefined to systemDefined for branches
1 parent 37e5af9 commit 5f83675

File tree

18 files changed

+57
-53
lines changed

18 files changed

+57
-53
lines changed

app/src/main/java/io/apicurio/registry/rest/v3/V3ApiUtil.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -167,7 +167,7 @@ public static BranchSearchResults dtoToSearchResults(BranchSearchResultsDto dto)
167167
searchedBranch.setOwner(branch.getOwner());
168168
searchedBranch.setCreatedOn(new Date(branch.getCreatedOn()));
169169
searchedBranch.setDescription(branch.getDescription());
170-
searchedBranch.setUserDefined(branch.isUserDefined());
170+
searchedBranch.setSystemDefined(branch.isSystemDefined());
171171
searchedBranch.setBranchId(branch.getBranchId());
172172
searchedBranch.setModifiedBy(branch.getModifiedBy());
173173
searchedBranch.setModifiedOn(new Date(branch.getModifiedOn()));
@@ -271,7 +271,7 @@ public static BranchMetaData dtoToBranchMetaData(BranchMetaDataDto branch) {
271271
.branchId(branch.getBranchId())
272272
.description(branch.getDescription())
273273
.owner(branch.getOwner())
274-
.userDefined(branch.isUserDefined())
274+
.systemDefined(branch.isSystemDefined())
275275
.createdOn(new Date(branch.getCreatedOn()))
276276
.modifiedBy(branch.getModifiedBy())
277277
.modifiedOn(new Date(branch.getModifiedOn()))

app/src/main/java/io/apicurio/registry/storage/dto/BranchMetaDataDto.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public class BranchMetaDataDto implements Serializable {
2323
private String artifactId;
2424
private String branchId;
2525
private String description;
26-
private boolean userDefined;
26+
private boolean systemDefined;
2727
private String owner;
2828
private long createdOn;
2929
private String modifiedBy;

app/src/main/java/io/apicurio/registry/storage/dto/SearchedBranchDto.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@ public class SearchedBranchDto {
2222
private String artifactId;
2323
private String branchId;
2424
private String description;
25-
private boolean userDefined;
25+
private boolean systemDefined;
2626
private String owner;
2727
private long createdOn;
2828
private String modifiedBy;

app/src/main/java/io/apicurio/registry/storage/impl/sql/AbstractSqlRegistryStorage.java

+7-7
Original file line numberDiff line numberDiff line change
@@ -595,7 +595,7 @@ private ArtifactVersionMetaDataDto createArtifactVersionRaw(Handle handle, boole
595595
.execute();
596596

597597
gav = new GAV(groupId, artifactId, finalVersion1);
598-
createOrUpdateBranchRaw(handle, gav, BranchId.LATEST, false);
598+
createOrUpdateBranchRaw(handle, gav, BranchId.LATEST, true);
599599
} else {
600600
handle.createUpdate(sqlStatements.insertVersion(false))
601601
.bind(0, globalId)
@@ -623,7 +623,7 @@ private ArtifactVersionMetaDataDto createArtifactVersionRaw(Handle handle, boole
623623
}
624624

625625
gav = getGAVByGlobalId(globalId);
626-
createOrUpdateBranchRaw(handle, gav, BranchId.LATEST, false);
626+
createOrUpdateBranchRaw(handle, gav, BranchId.LATEST, true);
627627
}
628628

629629
// Insert labels into the "version_labels" table
@@ -641,7 +641,7 @@ private ArtifactVersionMetaDataDto createArtifactVersionRaw(Handle handle, boole
641641
if (branches != null && !branches.isEmpty()) {
642642
branches.forEach(branch -> {
643643
BranchId branchId = new BranchId(branch);
644-
createOrUpdateBranchRaw(handle, gav, branchId, true);
644+
createOrUpdateBranchRaw(handle, gav, branchId, false);
645645
});
646646
}
647647

@@ -3331,7 +3331,7 @@ public BranchMetaDataDto createBranch(GA ga, BranchId branchId, String descripti
33313331
.bind(1, ga.getRawArtifactId())
33323332
.bind(2, branchId.getRawBranchId())
33333333
.bind(3, description)
3334-
.bind(4, true)
3334+
.bind(4, false)
33353335
.bind(5, user)
33363336
.bind(6, now)
33373337
.bind(7, user)
@@ -3726,7 +3726,7 @@ public void replaceBranchVersions(GA ga, BranchId branchId, List<VersionId> vers
37263726
*
37273727
* IMPORTANT: Private methods can't be @Transactional. Callers MUST have started a transaction.
37283728
*/
3729-
private void createOrUpdateBranchRaw(Handle handle, GAV gav, BranchId branchId, boolean userDefined) {
3729+
private void createOrUpdateBranchRaw(Handle handle, GAV gav, BranchId branchId, boolean systemDefined) {
37303730
// First make sure the branch exists.
37313731
try {
37323732
String user = securityIdentity.getPrincipal().getName();
@@ -3737,7 +3737,7 @@ private void createOrUpdateBranchRaw(Handle handle, GAV gav, BranchId branchId,
37373737
.bind(1, gav.getRawArtifactId())
37383738
.bind(2, branchId.getRawBranchId())
37393739
.bind(3, (String) null)
3740-
.bind(4, userDefined)
3740+
.bind(4, systemDefined)
37413741
.bind(5, user)
37423742
.bind(6, now)
37433743
.bind(7, user)
@@ -3832,7 +3832,7 @@ public void importBranch(BranchEntity entity) {
38323832
.bind(1, ga.getRawArtifactId())
38333833
.bind(2, branchId.getRawBranchId())
38343834
.bind(3, entity.description)
3835-
.bind(4, entity.userDefined)
3835+
.bind(4, entity.systemDefined)
38363836
.bind(5, entity.owner)
38373837
.bind(6, new Date(entity.createdOn))
38383838
.bind(7, entity.modifiedBy)

app/src/main/java/io/apicurio/registry/storage/impl/sql/CommonSqlStatements.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -1039,7 +1039,7 @@ public String selectGAVByGlobalId() {
10391039

10401040
@Override
10411041
public String insertBranch() {
1042-
return "INSERT INTO branches (groupId, artifactId, branchId, description, userDefined, owner, createdOn, modifiedBy, modifiedOn) " +
1042+
return "INSERT INTO branches (groupId, artifactId, branchId, description, systemDefined, owner, createdOn, modifiedBy, modifiedOn) " +
10431043
"VALUES (?, ?, ?, ?, ?, ?, ?, ?, ?)";
10441044
}
10451045

app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/BranchEntityMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ public BranchEntity map(ResultSet rs) throws SQLException {
2323
.artifactId(rs.getString("artifactId"))
2424
.branchId(rs.getString("branchId"))
2525
.description(rs.getString("description"))
26-
.userDefined(rs.getBoolean("userDefined"))
26+
.systemDefined(rs.getBoolean("systemDefined"))
2727
.owner(rs.getString("owner"))
2828
.createdOn(rs.getTimestamp("createdOn").getTime())
2929
.modifiedBy(rs.getString("modifiedBy"))

app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/BranchMetaDataDtoMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public BranchMetaDataDto map(ResultSet rs) throws SQLException {
2727
.artifactId(rs.getString("artifactId"))
2828
.branchId(rs.getString("branchId"))
2929
.description(rs.getString("description"))
30-
.userDefined(rs.getBoolean("userDefined"))
30+
.systemDefined(rs.getBoolean("systemDefined"))
3131
.owner(rs.getString("owner"))
3232
.createdOn(rs.getTimestamp("createdOn").getTime())
3333
.modifiedBy(rs.getString("modifiedBy"))

app/src/main/java/io/apicurio/registry/storage/impl/sql/mappers/SearchedBranchMapper.java

+1-1
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public SearchedBranchDto map(ResultSet rs) throws SQLException {
2727
.artifactId(rs.getString("artifactId"))
2828
.branchId(rs.getString("branchId"))
2929
.description(rs.getString("description"))
30-
.userDefined(rs.getBoolean("userDefined"))
30+
.systemDefined(rs.getBoolean("systemDefined"))
3131
.owner(rs.getString("owner"))
3232
.createdOn(rs.getTimestamp("createdOn").getTime())
3333
.modifiedBy(rs.getString("modifiedBy"))

app/src/main/resources/io/apicurio/registry/storage/impl/sql/h2.ddl

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ALTER TABLE version_comments ADD CONSTRAINT FK_version_comments_1 FOREIGN KEY (g
9191
CREATE INDEX IDX_version_comments_1 ON version_comments(owner);
9292

9393
-- This table is defined way down here because it has a FK to the artifacts table *and* the versions table
94-
CREATE TABLE branches (groupId VARCHAR(512) NOT NULL, artifactId VARCHAR(512) NOT NULL, branchId VARCHAR(256) NOT NULL, description VARCHAR(1024), userDefined BOOLEAN NOT NULL, owner VARCHAR(256), createdOn TIMESTAMP WITHOUT TIME ZONE NOT NULL, modifiedBy VARCHAR(256), modifiedOn TIMESTAMP WITHOUT TIME ZONE NOT NULL);
94+
CREATE TABLE branches (groupId VARCHAR(512) NOT NULL, artifactId VARCHAR(512) NOT NULL, branchId VARCHAR(256) NOT NULL, description VARCHAR(1024), systemDefined BOOLEAN NOT NULL, owner VARCHAR(256), createdOn TIMESTAMP WITHOUT TIME ZONE NOT NULL, modifiedBy VARCHAR(256), modifiedOn TIMESTAMP WITHOUT TIME ZONE NOT NULL);
9595
ALTER TABLE branches ADD PRIMARY KEY (groupId, artifactId, branchId);
9696
ALTER TABLE branches ADD CONSTRAINT FK_branches_1 FOREIGN KEY (groupId, artifactId) REFERENCES artifacts(groupId, artifactId) ON DELETE CASCADE;
9797

app/src/main/resources/io/apicurio/registry/storage/impl/sql/mssql.ddl

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ALTER TABLE version_comments ADD CONSTRAINT FK_version_comments_1 FOREIGN KEY (g
9191
CREATE INDEX IDX_version_comments_1 ON version_comments(owner);
9292

9393
-- This table is defined way down here because it has a FK to the artifacts table *and* the versions table
94-
CREATE TABLE branches (groupId NVARCHAR(512) NOT NULL, artifactId NVARCHAR(512) NOT NULL, branchId NVARCHAR(256) NOT NULL, description NVARCHAR(1024), userDefined BIT NOT NULL, owner NVARCHAR(256), createdOn DATETIME2(6) NOT NULL, modifiedBy NVARCHAR(256), modifiedOn DATETIME2(6) NOT NULL);
94+
CREATE TABLE branches (groupId NVARCHAR(512) NOT NULL, artifactId NVARCHAR(512) NOT NULL, branchId NVARCHAR(256) NOT NULL, description NVARCHAR(1024), systemDefined BIT NOT NULL, owner NVARCHAR(256), createdOn DATETIME2(6) NOT NULL, modifiedBy NVARCHAR(256), modifiedOn DATETIME2(6) NOT NULL);
9595
ALTER TABLE branches ADD PRIMARY KEY (groupId, artifactId, branchId);
9696
ALTER TABLE branches ADD CONSTRAINT FK_branches_1 FOREIGN KEY (groupId, artifactId) REFERENCES artifacts(groupId, artifactId) ON DELETE CASCADE;
9797

app/src/main/resources/io/apicurio/registry/storage/impl/sql/postgresql.ddl

+1-1
Original file line numberDiff line numberDiff line change
@@ -91,7 +91,7 @@ ALTER TABLE version_comments ADD CONSTRAINT FK_version_comments_1 FOREIGN KEY (g
9191
CREATE INDEX IDX_version_comments_1 ON version_comments(owner);
9292

9393
-- This table is defined way down here because it has a FK to the artifacts table *and* the versions table
94-
CREATE TABLE branches (groupId VARCHAR(512) NOT NULL, artifactId VARCHAR(512) NOT NULL, branchId VARCHAR(256) NOT NULL, description VARCHAR(1024), userDefined BOOLEAN NOT NULL, owner VARCHAR(256), createdOn TIMESTAMP WITHOUT TIME ZONE NOT NULL, modifiedBy VARCHAR(256), modifiedOn TIMESTAMP WITHOUT TIME ZONE NOT NULL);
94+
CREATE TABLE branches (groupId VARCHAR(512) NOT NULL, artifactId VARCHAR(512) NOT NULL, branchId VARCHAR(256) NOT NULL, description VARCHAR(1024), systemDefined BOOLEAN NOT NULL, owner VARCHAR(256), createdOn TIMESTAMP WITHOUT TIME ZONE NOT NULL, modifiedBy VARCHAR(256), modifiedOn TIMESTAMP WITHOUT TIME ZONE NOT NULL);
9595
ALTER TABLE branches ADD PRIMARY KEY (groupId, artifactId, branchId);
9696
ALTER TABLE branches ADD CONSTRAINT FK_branches_1 FOREIGN KEY (groupId, artifactId) REFERENCES artifacts(groupId, artifactId) ON DELETE CASCADE;
9797

app/src/test/java/io/apicurio/registry/noprofile/rest/v3/BranchesTest.java

+2
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ public void testLatestBranch() throws Exception {
3333
BranchMetaData latest = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).branches().byBranchId("latest").get();
3434
Assertions.assertNotNull(latest);
3535
Assertions.assertEquals("latest", latest.getBranchId());
36+
Assertions.assertEquals(true, latest.getSystemDefined());
3637

3738
VersionSearchResults versions = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactId).branches().byBranchId("latest").versions().get();
3839
Assertions.assertEquals(2, versions.getCount());
@@ -55,6 +56,7 @@ public void testCreateBranch() throws Exception {
5556
Assertions.assertEquals(artifactId, branch.getArtifactId());
5657
Assertions.assertEquals("1.x", branch.getBranchId());
5758
Assertions.assertEquals("Version 1.x", branch.getDescription());
59+
Assertions.assertEquals(false, branch.getSystemDefined());
5860
}
5961

6062
@Test

app/src/test/java/io/apicurio/registry/noprofile/rest/v3/ImportExportTest.java

+3-1
Original file line numberDiff line numberDiff line change
@@ -262,7 +262,9 @@ public void testExportImport() throws Exception {
262262
BranchMetaData branch = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactIdWithBranches).branches().byBranchId("evens").get();
263263
Assertions.assertEquals("evens", branch.getBranchId());
264264
Assertions.assertEquals("Even numbered versions", branch.getDescription());
265-
Assertions.assertEquals(true, branch.getUserDefined());
265+
Assertions.assertEquals(false, branch.getSystemDefined());
266+
branch = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactIdWithBranches).branches().byBranchId("latest").get();
267+
Assertions.assertEquals(true, branch.getSystemDefined());
266268

267269
VersionSearchResults versions = clientV3.groups().byGroupId(groupId).artifacts().byArtifactId(artifactIdWithBranches).branches().byBranchId("evens").versions().get();
268270
Assertions.assertEquals(2, versions.getCount());

common/src/main/resources/META-INF/openapi.json

+6-6
Original file line numberDiff line numberDiff line change
@@ -4189,7 +4189,7 @@
41894189
"modifiedOn",
41904190
"modifiedBy",
41914191
"owner",
4192-
"userDefined"
4192+
"systemDefined"
41934193
],
41944194
"type": "object",
41954195
"properties": {
@@ -4224,7 +4224,7 @@
42244224
"description": "",
42254225
"type": "string"
42264226
},
4227-
"userDefined": {
4227+
"systemDefined": {
42284228
"description": "",
42294229
"type": "boolean"
42304230
}
@@ -4234,7 +4234,7 @@
42344234
"artifactId": "ExampleArtifact",
42354235
"branchId": "1.0.x",
42364236
"description": "Just an example branch.",
4237-
"userDefined": true,
4237+
"systemDefined": false,
42384238
"createdOn": "2018-02-10T09:30Z",
42394239
"modifiedBy": "user1",
42404240
"modifiedOn": "2020-02-10T09:30Z",
@@ -4744,7 +4744,7 @@
47444744
"owner",
47454745
"modifiedBy",
47464746
"modifiedOn",
4747-
"userDefined"
4747+
"systemDefined"
47484748
],
47494749
"type": "object",
47504750
"properties": {
@@ -4782,7 +4782,7 @@
47824782
"description": "",
47834783
"type": "string"
47844784
},
4785-
"userDefined": {
4785+
"systemDefined": {
47864786
"description": "",
47874787
"type": "boolean"
47884788
}
@@ -4792,7 +4792,7 @@
47924792
"artifactId": "ExampleArtifact",
47934793
"branchId": "1.0.x",
47944794
"description": "A really nice branch.",
4795-
"userDefined": true,
4795+
"systemDefined": false,
47964796
"createdOn": "2018-02-10T09:30Z",
47974797
"owner": "user1",
47984798
"modifiedOn": "2019-03-11T09:30Z",

go-sdk/pkg/registryclient-v3/kiota-lock.json

+1-1
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
{
2-
"descriptionHash": "165CB28362B12D7C5F9A8CA280FCC90F78811CB61857DB9467AF62D3973806A641B4EA8F5E66ABE71FBDA60E9BEE143C833AF373D82FA39AD461505AC5C40608",
2+
"descriptionHash": "E09CC67C76497F1018A2E92618ADFA6F667C280644027CBCB55587F3942D873739E6A438C095E6F7FC41B5B573E1D9E462053338964821E478326575CCAAB743",
33
"descriptionLocation": "../../v3.json",
44
"lockFileVersion": "1.0.0",
55
"kiotaVersion": "1.10.1",

go-sdk/pkg/registryclient-v3/models/branch_meta_data.go

+13-13
Original file line numberDiff line numberDiff line change
@@ -25,8 +25,8 @@ type BranchMetaData struct {
2525
modifiedOn *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time
2626
// The owner property
2727
owner *string
28-
// The userDefined property
29-
userDefined *bool
28+
// The systemDefined property
29+
systemDefined *bool
3030
}
3131

3232
// NewBranchMetaData instantiates a new BranchMetaData and sets the default values.
@@ -149,13 +149,13 @@ func (m *BranchMetaData) GetFieldDeserializers() map[string]func(i878a80d2330e89
149149
}
150150
return nil
151151
}
152-
res["userDefined"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
152+
res["systemDefined"] = func(n i878a80d2330e89d26896388a3f487eef27b0a0e6c010c493bf80be1452208f91.ParseNode) error {
153153
val, err := n.GetBoolValue()
154154
if err != nil {
155155
return err
156156
}
157157
if val != nil {
158-
m.SetUserDefined(val)
158+
m.SetSystemDefined(val)
159159
}
160160
return nil
161161
}
@@ -182,9 +182,9 @@ func (m *BranchMetaData) GetOwner() *string {
182182
return m.owner
183183
}
184184

185-
// GetUserDefined gets the userDefined property value. The userDefined property
186-
func (m *BranchMetaData) GetUserDefined() *bool {
187-
return m.userDefined
185+
// GetSystemDefined gets the systemDefined property value. The systemDefined property
186+
func (m *BranchMetaData) GetSystemDefined() *bool {
187+
return m.systemDefined
188188
}
189189

190190
// Serialize serializes information the current object
@@ -238,7 +238,7 @@ func (m *BranchMetaData) Serialize(writer i878a80d2330e89d26896388a3f487eef27b0a
238238
}
239239
}
240240
{
241-
err := writer.WriteBoolValue("userDefined", m.GetUserDefined())
241+
err := writer.WriteBoolValue("systemDefined", m.GetSystemDefined())
242242
if err != nil {
243243
return err
244244
}
@@ -297,9 +297,9 @@ func (m *BranchMetaData) SetOwner(value *string) {
297297
m.owner = value
298298
}
299299

300-
// SetUserDefined sets the userDefined property value. The userDefined property
301-
func (m *BranchMetaData) SetUserDefined(value *bool) {
302-
m.userDefined = value
300+
// SetSystemDefined sets the systemDefined property value. The systemDefined property
301+
func (m *BranchMetaData) SetSystemDefined(value *bool) {
302+
m.systemDefined = value
303303
}
304304

305305
// BranchMetaDataable
@@ -314,7 +314,7 @@ type BranchMetaDataable interface {
314314
GetModifiedBy() *string
315315
GetModifiedOn() *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time
316316
GetOwner() *string
317-
GetUserDefined() *bool
317+
GetSystemDefined() *bool
318318
SetArtifactId(value *string)
319319
SetBranchId(value *string)
320320
SetCreatedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
@@ -323,5 +323,5 @@ type BranchMetaDataable interface {
323323
SetModifiedBy(value *string)
324324
SetModifiedOn(value *i336074805fc853987abe6f7fe3ad97a6a6f3077a16391fec744f671a015fbd7e.Time)
325325
SetOwner(value *string)
326-
SetUserDefined(value *bool)
326+
SetSystemDefined(value *bool)
327327
}

0 commit comments

Comments
 (0)