Skip to content

Commit 29419c9

Browse files
author
Dennis Labordus
committed
Rename POJO.
Signed-off-by: Dennis Labordus <[email protected]>
1 parent 0ec7b34 commit 29419c9

File tree

15 files changed

+52
-52
lines changed

15 files changed

+52
-52
lines changed

app/src/main/java/org/lfenergy/compas/scl/data/rest/v1/model/VersionsResponse.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
package org.lfenergy.compas.scl.data.rest.v1.model;
55

66
import org.eclipse.microprofile.openapi.annotations.media.Schema;
7-
import org.lfenergy.compas.scl.data.model.ItemHistory;
7+
import org.lfenergy.compas.scl.data.model.HistoryItem;
88

99
import javax.xml.bind.annotation.XmlAccessType;
1010
import javax.xml.bind.annotation.XmlAccessorType;
@@ -19,14 +19,14 @@
1919
@XmlAccessorType(XmlAccessType.FIELD)
2020
public class VersionsResponse {
2121
@Schema(description = "List of found Versions of a specific SCL in the database.")
22-
@XmlElement(name = "ItemHistory", namespace = SCL_DATA_SERVICE_V1_NS_URI)
23-
private List<ItemHistory> items;
22+
@XmlElement(name = "HistoryItem", namespace = SCL_DATA_SERVICE_V1_NS_URI)
23+
private List<HistoryItem> items;
2424

25-
public List<ItemHistory> getItems() {
25+
public List<HistoryItem> getItems() {
2626
return items;
2727
}
2828

29-
public void setItems(List<ItemHistory> items) {
29+
public void setItems(List<HistoryItem> items) {
3030
this.items = items;
3131
}
3232
}

app/src/test/java/org/lfenergy/compas/scl/data/rest/mock/CompasSclDataRepositoryMock.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
package org.lfenergy.compas.scl.data.rest.mock;
55

66
import io.quarkus.test.Mock;
7+
import org.lfenergy.compas.scl.data.model.HistoryItem;
78
import org.lfenergy.compas.scl.data.model.Item;
8-
import org.lfenergy.compas.scl.data.model.ItemHistory;
99
import org.lfenergy.compas.scl.data.model.SclMetaInfo;
1010
import org.lfenergy.compas.scl.data.model.Version;
1111
import org.lfenergy.compas.scl.data.repository.CompasSclDataRepository;
@@ -24,7 +24,7 @@ public List<Item> list(SclFileType type) {
2424
}
2525

2626
@Override
27-
public List<ItemHistory> listVersionsByUUID(SclFileType type, UUID id) {
27+
public List<HistoryItem> listVersionsByUUID(SclFileType type, UUID id) {
2828
throw new IllegalStateException("Mock method using Mockito. Only needed to startup.");
2929
}
3030

app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsEditorTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@
1212
import io.restassured.http.ContentType;
1313
import org.junit.jupiter.api.Test;
1414
import org.lfenergy.compas.scl.data.model.ChangeSetType;
15+
import org.lfenergy.compas.scl.data.model.HistoryItem;
1516
import org.lfenergy.compas.scl.data.model.Item;
16-
import org.lfenergy.compas.scl.data.model.ItemHistory;
1717
import org.lfenergy.compas.scl.data.model.Version;
1818
import org.lfenergy.compas.scl.data.rest.v1.model.CreateRequest;
1919
import org.lfenergy.compas.scl.data.rest.v1.model.UpdateRequest;
@@ -77,7 +77,7 @@ void listVersionsByUUID_WhenCalled_ThenItemResponseRetrieved() {
7777
var version = "1.0.0";
7878

7979
when(compasSclDataService.listVersionsByUUID(type, uuid))
80-
.thenReturn(Collections.singletonList(new ItemHistory(uuid.toString(), name, version, null, null, null)));
80+
.thenReturn(Collections.singletonList(new HistoryItem(uuid.toString(), name, version, null, null, null)));
8181

8282
var response = given()
8383
.pathParam(TYPE_PATH_PARAM, type)
@@ -89,9 +89,9 @@ void listVersionsByUUID_WhenCalled_ThenItemResponseRetrieved() {
8989
.response();
9090

9191
var xmlPath = response.xmlPath();
92-
assertEquals(uuid.toString(), xmlPath.get("VersionsResponse.ItemHistory[0].Id"));
93-
assertEquals(name, xmlPath.get("VersionsResponse.ItemHistory[0].Name"));
94-
assertEquals(version, xmlPath.get("VersionsResponse.ItemHistory[0].Version"));
92+
assertEquals(uuid.toString(), xmlPath.get("VersionsResponse.HistoryItem[0].Id"));
93+
assertEquals(name, xmlPath.get("VersionsResponse.HistoryItem[0].Name"));
94+
assertEquals(version, xmlPath.get("VersionsResponse.HistoryItem[0].Version"));
9595
verify(compasSclDataService, times(1)).listVersionsByUUID(type, uuid);
9696
}
9797

app/src/test/java/org/lfenergy/compas/scl/data/rest/v1/CompasSclDataResourceAsReaderTest.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,8 @@
1010
import io.restassured.http.ContentType;
1111
import org.junit.jupiter.api.Test;
1212
import org.lfenergy.compas.scl.data.model.ChangeSetType;
13+
import org.lfenergy.compas.scl.data.model.HistoryItem;
1314
import org.lfenergy.compas.scl.data.model.Item;
14-
import org.lfenergy.compas.scl.data.model.ItemHistory;
1515
import org.lfenergy.compas.scl.data.model.Version;
1616
import org.lfenergy.compas.scl.data.rest.v1.model.CreateRequest;
1717
import org.lfenergy.compas.scl.data.rest.v1.model.UpdateRequest;
@@ -69,7 +69,7 @@ void listVersionsByUUID_WhenCalled_ThenItemResponseRetrieved() {
6969
var version = "1.0.0";
7070

7171
when(compasSclDataService.listVersionsByUUID(type, uuid))
72-
.thenReturn(Collections.singletonList(new ItemHistory(uuid.toString(), name, version, null, null, null)));
72+
.thenReturn(Collections.singletonList(new HistoryItem(uuid.toString(), name, version, null, null, null)));
7373

7474
var response = given()
7575
.pathParam(TYPE_PATH_PARAM, type)
@@ -81,9 +81,9 @@ void listVersionsByUUID_WhenCalled_ThenItemResponseRetrieved() {
8181
.response();
8282

8383
var xmlPath = response.xmlPath();
84-
assertEquals(uuid.toString(), xmlPath.get("VersionsResponse.ItemHistory[0].Id"));
85-
assertEquals(name, xmlPath.get("VersionsResponse.ItemHistory[0].Name"));
86-
assertEquals(version, xmlPath.get("VersionsResponse.ItemHistory[0].Version"));
84+
assertEquals(uuid.toString(), xmlPath.get("VersionsResponse.HistoryItem[0].Id"));
85+
assertEquals(name, xmlPath.get("VersionsResponse.HistoryItem[0].Name"));
86+
assertEquals(version, xmlPath.get("VersionsResponse.HistoryItem[0].Version"));
8787
verify(compasSclDataService, times(1)).listVersionsByUUID(type, uuid);
8888
}
8989

repository-basex/src/main/java/org/lfenergy/compas/scl/data/basex/repository/CompasSclDataBaseXRepository.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -8,8 +8,8 @@
88
import org.lfenergy.compas.scl.data.basex.client.BaseXClientFactory;
99
import org.lfenergy.compas.scl.data.exception.CompasNoDataFoundException;
1010
import org.lfenergy.compas.scl.data.exception.CompasSclDataServiceException;
11+
import org.lfenergy.compas.scl.data.model.HistoryItem;
1112
import org.lfenergy.compas.scl.data.model.Item;
12-
import org.lfenergy.compas.scl.data.model.ItemHistory;
1313
import org.lfenergy.compas.scl.data.model.SclMetaInfo;
1414
import org.lfenergy.compas.scl.data.model.Version;
1515
import org.lfenergy.compas.scl.data.repository.CompasSclDataRepository;
@@ -106,7 +106,7 @@ public List<Item> list(SclFileType type) {
106106
}
107107

108108
@Override
109-
public List<ItemHistory> listVersionsByUUID(SclFileType type, UUID id) {
109+
public List<HistoryItem> listVersionsByUUID(SclFileType type, UUID id) {
110110
return executeQuery(type, DECLARE_SCL_NS_URI +
111111
DECLARE_COMPAS_NAMESPACE +
112112
format(DECLARE_DB_VARIABLE, type) +
@@ -121,15 +121,15 @@ public List<ItemHistory> listVersionsByUUID(SclFileType type, UUID id) {
121121
" let $minorVersion := xs:int($parts[2])\n" +
122122
" let $patchVersion := xs:int($parts[3])\n" +
123123
" order by $majorVersion, $minorVersion, $patchVersion\n" +
124-
" return '<ItemHistory xmlns=\"" + SCL_DATA_SERVICE_V1_NS_URI + "\">'" +
124+
" return '<HistoryItem xmlns=\"" + SCL_DATA_SERVICE_V1_NS_URI + "\">'" +
125125
" || ' <Id>' || $id || '</Id>'" +
126126
" || ' <Name>' || $name || '</Name>'" +
127127
" || ' <Version>' || $version || '</Version>' " +
128128
" || ' <Who>' || $header/@who || '</Who>' " +
129129
" || ' <When>' || $header/@when || '</When>' " +
130130
" || ' <What>' || $header/@what || '</What>' " +
131-
" || '</ItemHistory>' ",
132-
sclDataMarshaller::unmarshalItemHistory);
131+
" || '</HistoryItem>' ",
132+
sclDataMarshaller::unmarshalHistoryItem);
133133
}
134134

135135
@Override

repository-postgresql/src/main/java/org/lfenergy/compas/scl/data/repository/postgresql/CompasSclDataPostgreSQLRepository.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -6,8 +6,8 @@
66

77
import org.lfenergy.compas.scl.data.exception.CompasNoDataFoundException;
88
import org.lfenergy.compas.scl.data.exception.CompasSclDataServiceException;
9+
import org.lfenergy.compas.scl.data.model.HistoryItem;
910
import org.lfenergy.compas.scl.data.model.Item;
10-
import org.lfenergy.compas.scl.data.model.ItemHistory;
1111
import org.lfenergy.compas.scl.data.model.SclMetaInfo;
1212
import org.lfenergy.compas.scl.data.model.Version;
1313
import org.lfenergy.compas.scl.data.repository.CompasSclDataRepository;
@@ -112,7 +112,7 @@ public List<Item> list(SclFileType type) {
112112
}
113113

114114
@Override
115-
public List<ItemHistory> listVersionsByUUID(SclFileType type, UUID id) {
115+
public List<HistoryItem> listVersionsByUUID(SclFileType type, UUID id) {
116116
var sql = SELECT_METADATA_CLAUSE
117117
+ SELECT_HEADER_INFO_CLAUSE
118118
+ FROM_CLAUSE
@@ -121,15 +121,15 @@ public List<ItemHistory> listVersionsByUUID(SclFileType type, UUID id) {
121121
+ AND_CLAUSE + FILTER_ON_TYPE
122122
+ " order by scl_file.major_version, scl_file.minor_version, scl_file.patch_version";
123123

124-
var items = new ArrayList<ItemHistory>();
124+
var items = new ArrayList<HistoryItem>();
125125
try (var connection = dataSource.getConnection();
126126
var stmt = connection.prepareStatement(sql)) {
127127
stmt.setObject(1, id);
128128
stmt.setString(2, type.name());
129129

130130
try (var resultSet = stmt.executeQuery()) {
131131
while (resultSet.next()) {
132-
items.add(new ItemHistory(id.toString(),
132+
items.add(new HistoryItem(id.toString(),
133133
resultSet.getString(NAME_FIELD),
134134
createVersion(resultSet),
135135
resultSet.getString(HITEM_WHO_FIELD),

repository/src/main/java/org/lfenergy/compas/scl/data/model/ItemHistory.java renamed to repository/src/main/java/org/lfenergy/compas/scl/data/model/HistoryItem.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,7 @@
1313

1414
@Schema(description = "Item found in the database with all basic information including version info about a SCL.")
1515
@XmlAccessorType(XmlAccessType.FIELD)
16-
public class ItemHistory extends Item {
16+
public class HistoryItem extends Item {
1717
@Schema(description = "Who created this version of the SCL.",
1818
example = "John Doe")
1919
@XmlElement(name = "Who",
@@ -35,10 +35,10 @@ public class ItemHistory extends Item {
3535
required = true)
3636
private String what;
3737

38-
public ItemHistory() {
38+
public HistoryItem() {
3939
}
4040

41-
public ItemHistory(String id, String name, String version, String who, String when, String what) {
41+
public HistoryItem(String id, String name, String version, String who, String when, String what) {
4242
super(id, name, version);
4343
this.who = who;
4444
this.when = when;

repository/src/main/java/org/lfenergy/compas/scl/data/model/ObjectFactory.java

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -14,18 +14,18 @@ public Item createItem() {
1414
return new Item();
1515
}
1616

17-
public ItemHistory createItemHistory() {
18-
return new ItemHistory();
17+
public HistoryItem createHistoryItem() {
18+
return new HistoryItem();
1919
}
2020

2121
@XmlElementDecl(namespace = "", name = "Item")
2222
public JAXBElement<Item> createItem(Item value) {
2323
return new JAXBElement<>(new QName("", ""), Item.class, value);
2424
}
2525

26-
@XmlElementDecl(namespace = "", name = "ItemHistory")
27-
public JAXBElement<ItemHistory> createItemHistory(ItemHistory value) {
28-
return new JAXBElement<>(new QName("", ""), ItemHistory.class, value);
26+
@XmlElementDecl(namespace = "", name = "HistoryItem")
27+
public JAXBElement<HistoryItem> createHistoryItem(HistoryItem value) {
28+
return new JAXBElement<>(new QName("", ""), HistoryItem.class, value);
2929
}
3030

3131
public SclMetaInfo createSclMetaInfo() {

repository/src/main/java/org/lfenergy/compas/scl/data/repository/CompasSclDataRepository.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,8 +3,8 @@
33
// SPDX-License-Identifier: Apache-2.0
44
package org.lfenergy.compas.scl.data.repository;
55

6+
import org.lfenergy.compas.scl.data.model.HistoryItem;
67
import org.lfenergy.compas.scl.data.model.Item;
7-
import org.lfenergy.compas.scl.data.model.ItemHistory;
88
import org.lfenergy.compas.scl.data.model.SclMetaInfo;
99
import org.lfenergy.compas.scl.data.model.Version;
1010
import org.lfenergy.compas.scl.extensions.model.SclFileType;
@@ -38,7 +38,7 @@ public interface CompasSclDataRepository {
3838
* @return The list of versions found for that specific sCl Entry.
3939
*/
4040
@Transactional(SUPPORTS)
41-
List<ItemHistory> listVersionsByUUID(SclFileType type, UUID id);
41+
List<HistoryItem> listVersionsByUUID(SclFileType type, UUID id);
4242

4343
/**
4444
* Return the latest version of a specific SCL Entry.

repository/src/main/java/org/lfenergy/compas/scl/data/util/SclDataModelMarshaller.java

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@
44
package org.lfenergy.compas.scl.data.util;
55

66
import org.lfenergy.compas.scl.data.exception.CompasSclDataServiceException;
7+
import org.lfenergy.compas.scl.data.model.HistoryItem;
78
import org.lfenergy.compas.scl.data.model.Item;
8-
import org.lfenergy.compas.scl.data.model.ItemHistory;
99
import org.lfenergy.compas.scl.data.model.SclMetaInfo;
1010
import org.slf4j.Logger;
1111
import org.slf4j.LoggerFactory;
@@ -38,8 +38,8 @@ public Item unmarshalItem(String xml) {
3838
return unmarshal(xml, Item.class);
3939
}
4040

41-
public ItemHistory unmarshalItemHistory(String xml) {
42-
return unmarshal(xml, ItemHistory.class);
41+
public HistoryItem unmarshalHistoryItem(String xml) {
42+
return unmarshal(xml, HistoryItem.class);
4343
}
4444

4545
public SclMetaInfo unmarshalSclMetaInfo(String xml) {

0 commit comments

Comments
 (0)