Skip to content

Commit dd9ac7a

Browse files
committed
changes based on pr comments
1 parent d62a461 commit dd9ac7a

35 files changed

+932
-1398
lines changed

src/main/java/com/redhat/labs/lodestar/config/JsonConfig.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@
1313
@Singleton
1414
public class JsonConfig implements JsonbConfigCustomizer {
1515

16-
@Override
17-
public void customize(JsonbConfig jsonbConfig) {
18-
jsonbConfig.withFormatting(true).withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES);
19-
}
16+
@Override
17+
public void customize(JsonbConfig jsonbConfig) {
18+
jsonbConfig.withFormatting(true).withPropertyNamingStrategy(PropertyNamingStrategy.LOWER_CASE_WITH_UNDERSCORES);
19+
}
2020

2121
}

src/main/java/com/redhat/labs/lodestar/model/Artifact.java

Lines changed: 111 additions & 111 deletions
Original file line numberDiff line numberDiff line change
@@ -28,116 +28,116 @@
2828
@EqualsAndHashCode(callSuper = true)
2929
public class Artifact extends PanacheMongoEntityBase {
3030

31-
private static final String ENGAGEMENT_UUID = "engagementUuid";
32-
private static final String MODIFIED = "modified";
33-
private static final String UUID = "uuid";
34-
35-
@BsonId
36-
@DiffIgnore
37-
@JsonbTransient
38-
private ObjectId id;
39-
40-
@Id
41-
private String uuid;
42-
@DiffIgnore
43-
private String created;
44-
@DiffIgnore
45-
private String modified;
46-
47-
@NotBlank
48-
private String engagementUuid;
49-
@NotBlank
50-
private String title;
51-
@NotBlank
52-
private String description;
53-
@NotBlank
54-
private String type;
55-
@NotBlank
56-
private String linkAddress;
57-
58-
/**
59-
* Returns an {@link ArtifactCount} containing the count for the total number of
60-
* {@link Artifact}s in the database.
61-
*
62-
* @return
63-
*/
64-
public static ArtifactCount countAllArtifacts() {
65-
return ArtifactCount.builder().count(count()).build();
66-
}
67-
68-
/**
69-
* Returns an {@link ArtifactCount} containing the count for the number of
70-
* {@link Artifact} matching the engagement uuid.
71-
*
72-
* @param engagementUuid
73-
* @return
74-
*/
75-
public static ArtifactCount countArtifactsByEngagementUuid(String engagementUuid) {
76-
return ArtifactCount.builder().count(count(ENGAGEMENT_UUID, engagementUuid)).build();
77-
}
78-
79-
/**
80-
* Returns {@link List} of {@link Artifact}s sorted descending on modified
81-
* timestamp using the page specified.
82-
*
83-
* @param page
84-
* @param pageSize
85-
* @return
86-
*/
87-
public static List<Artifact> pagedArtifacts(int page, int pageSize) {
88-
return findAll(Sort.descending(MODIFIED)).page(page, pageSize).list();
89-
}
90-
91-
/**
92-
* Returns a {@link List} of {@link Artifact}s for the given engagement uuid,
93-
* sorted descending by modified timestamp using the page specified.
94-
*
95-
* @param engagementUuid
96-
* @param page
97-
* @param pageSize
98-
* @return
99-
*/
100-
public static List<Artifact> pagedArtifactsByEngagementUuid(String engagementUuid, int page, int pageSize) {
101-
return find(ENGAGEMENT_UUID, Sort.descending(MODIFIED), engagementUuid).page(page, pageSize).list();
102-
}
103-
104-
/**
105-
* Returns a {@link List} containing all {@link Artifact}s that match the given
106-
* engagement uuid.
107-
*
108-
* @param engagementUuid
109-
* @return
110-
*/
111-
public static List<Artifact> findAllByEngagementUuid(String engagementUuid) {
112-
return list(ENGAGEMENT_UUID, engagementUuid);
113-
}
114-
115-
/**
116-
* Returns and {@link Optional} containing the {@link Artifact} that matches the
117-
* given uuid. Otherwise, and empty {@link Optional} is returned.
118-
*
119-
* @param uuid
120-
* @return
121-
*/
122-
public static Optional<Artifact> findByUuid(String uuid) {
123-
return find(UUID, uuid).singleResultOptional();
124-
}
125-
126-
/**
127-
* Returns the number of {@link Artifact}s delete with the given uuid.
128-
*
129-
* @param uuid
130-
* @return
131-
*/
132-
public static long deleteByUuid(String uuid) {
133-
return Artifact.delete(UUID, uuid);
134-
}
135-
136-
/**
137-
* Removes all {@link Artifact}s from the database.
138-
*/
139-
public static long removeAllArtifacts() {
140-
return deleteAll();
141-
}
31+
private static final String ENGAGEMENT_UUID = "engagementUuid";
32+
private static final String MODIFIED = "modified";
33+
private static final String UUID = "uuid";
34+
35+
@BsonId
36+
@DiffIgnore
37+
@JsonbTransient
38+
private ObjectId id;
39+
40+
@Id
41+
private String uuid;
42+
@DiffIgnore
43+
private String created;
44+
@DiffIgnore
45+
private String modified;
46+
47+
@NotBlank
48+
private String engagementUuid;
49+
@NotBlank
50+
private String title;
51+
@NotBlank
52+
private String description;
53+
@NotBlank
54+
private String type;
55+
@NotBlank
56+
private String linkAddress;
57+
58+
/**
59+
* Returns an {@link ArtifactCount} containing the count for the total number of
60+
* {@link Artifact}s in the database.
61+
*
62+
* @return
63+
*/
64+
public static ArtifactCount countAllArtifacts() {
65+
return ArtifactCount.builder().count(count()).build();
66+
}
67+
68+
/**
69+
* Returns an {@link ArtifactCount} containing the count for the number of
70+
* {@link Artifact} matching the engagement uuid.
71+
*
72+
* @param engagementUuid
73+
* @return
74+
*/
75+
public static ArtifactCount countArtifactsByEngagementUuid(String engagementUuid) {
76+
return ArtifactCount.builder().count(count(ENGAGEMENT_UUID, engagementUuid)).build();
77+
}
78+
79+
/**
80+
* Returns {@link List} of {@link Artifact}s sorted descending on modified
81+
* timestamp using the page specified.
82+
*
83+
* @param page
84+
* @param pageSize
85+
* @return
86+
*/
87+
public static List<Artifact> pagedArtifacts(int page, int pageSize) {
88+
return findAll(Sort.descending(MODIFIED)).page(page, pageSize).list();
89+
}
90+
91+
/**
92+
* Returns a {@link List} of {@link Artifact}s for the given engagement uuid,
93+
* sorted descending by modified timestamp using the page specified.
94+
*
95+
* @param engagementUuid
96+
* @param page
97+
* @param pageSize
98+
* @return
99+
*/
100+
public static List<Artifact> pagedArtifactsByEngagementUuid(String engagementUuid, int page, int pageSize) {
101+
return find(ENGAGEMENT_UUID, Sort.descending(MODIFIED), engagementUuid).page(page, pageSize).list();
102+
}
103+
104+
/**
105+
* Returns a {@link List} containing all {@link Artifact}s that match the given
106+
* engagement uuid.
107+
*
108+
* @param engagementUuid
109+
* @return
110+
*/
111+
public static List<Artifact> findAllByEngagementUuid(String engagementUuid) {
112+
return list(ENGAGEMENT_UUID, engagementUuid);
113+
}
114+
115+
/**
116+
* Returns and {@link Optional} containing the {@link Artifact} that matches the
117+
* given uuid. Otherwise, and empty {@link Optional} is returned.
118+
*
119+
* @param uuid
120+
* @return
121+
*/
122+
public static Optional<Artifact> findByUuid(String uuid) {
123+
return find(UUID, uuid).singleResultOptional();
124+
}
125+
126+
/**
127+
* Returns the number of {@link Artifact}s delete with the given uuid.
128+
*
129+
* @param uuid
130+
* @return
131+
*/
132+
public static long deleteByUuid(String uuid) {
133+
return Artifact.delete(UUID, uuid);
134+
}
135+
136+
/**
137+
* Removes all {@link Artifact}s from the database.
138+
*/
139+
public static long removeAllArtifacts() {
140+
return deleteAll();
141+
}
142142

143143
}

src/main/java/com/redhat/labs/lodestar/model/ArtifactCount.java

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -9,9 +9,9 @@
99
@Builder
1010
public class ArtifactCount {
1111

12-
@Builder.Default
13-
private Long count = 0l;
14-
@Builder.Default
15-
private Optional<String> engagementId = Optional.empty();
12+
@Builder.Default
13+
private Long count = 0l;
14+
@Builder.Default
15+
private Optional<String> engagementId = Optional.empty();
1616

1717
}
Lines changed: 2 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,15 +1,11 @@
11
package com.redhat.labs.lodestar.model;
22

3-
import java.util.List;
4-
53
import lombok.Data;
6-
import lombok.NoArgsConstructor;
74

85
@Data
9-
@NoArgsConstructor
106
public class Engagement {
117

12-
private String uuid;
13-
private List<Artifact> artifacts;
8+
private String uuid;
9+
private long projectId;
1410

1511
}

src/main/java/com/redhat/labs/lodestar/model/GetListOptions.java

Lines changed: 12 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,20 +15,20 @@
1515
@EqualsAndHashCode(callSuper = true)
1616
public class GetListOptions extends GetOptions {
1717

18-
@Parameter(name = "page", required = false, description = "0 based index of page of results to return")
19-
@QueryParam("page")
20-
private int page;
18+
@Parameter(name = "page", required = false, description = "0 based index of page of results to return")
19+
@QueryParam("page")
20+
private int page;
2121

22-
@Parameter(name = "pageSize", required = false, description = "number of results to return per page")
23-
@QueryParam("pageSize")
24-
private int pageSize;
22+
@Parameter(name = "pageSize", required = false, description = "number of results to return per page")
23+
@QueryParam("pageSize")
24+
private int pageSize;
2525

26-
public int getPage() {
27-
return page < 0 ? 0 : page;
28-
}
26+
public int getPage() {
27+
return page < 0 ? 0 : page;
28+
}
2929

30-
public int getPageSize() {
31-
return pageSize < 1 ? 20 : pageSize;
32-
}
30+
public int getPageSize() {
31+
return pageSize < 1 ? 20 : pageSize;
32+
}
3333

3434
}

src/main/java/com/redhat/labs/lodestar/model/GetOptions.java

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -15,12 +15,12 @@
1515
@AllArgsConstructor
1616
public class GetOptions {
1717

18-
@Parameter(name = "engagementUuid", required = false, description = "return only artifacts for the given engagement uuid")
19-
@QueryParam("engagementUuid")
20-
private String engagementUuid;
18+
@Parameter(name = "engagementUuid", required = false, description = "return only artifacts for the given engagement uuid")
19+
@QueryParam("engagementUuid")
20+
private String engagementUuid;
2121

22-
public Optional<String> getEngagementUuid() {
23-
return Optional.ofNullable(engagementUuid);
24-
}
22+
public Optional<String> getEngagementUuid() {
23+
return Optional.ofNullable(engagementUuid);
24+
}
2525

2626
}

src/main/java/com/redhat/labs/lodestar/model/gitlab/Branch.java

Lines changed: 0 additions & 14 deletions
This file was deleted.

0 commit comments

Comments
 (0)