Skip to content

Commit 43ad00d

Browse files
committed
Add projectKey/environment to repository builder
1 parent 631eafc commit 43ad00d

15 files changed

Lines changed: 223 additions & 18 deletions

api/src/main/java/org/jfrog/artifactory/client/model/Repository.java

Lines changed: 5 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
44
import com.fasterxml.jackson.annotation.JsonSubTypes;
55
import com.fasterxml.jackson.annotation.JsonTypeInfo;
6+
import java.util.List;
67
import java.util.Map;
78
import org.jfrog.artifactory.client.model.repository.settings.RepositorySettings;
89
import org.jfrog.artifactory.client.model.repository.settings.XraySettings;
@@ -34,4 +35,8 @@ public interface Repository {
3435
XraySettings getXraySettings();
3536

3637
Map<String, Object> getCustomProperties();
38+
39+
String getProjectKey();
40+
41+
List<String> getEnvironments();
3742
}

api/src/main/java/org/jfrog/artifactory/client/model/builder/RepositoryBuilder.java

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
package org.jfrog.artifactory.client.model.builder;
22

3+
import java.util.List;
34
import java.util.Map;
45
import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
56
import org.jfrog.artifactory.client.model.Repository;
@@ -50,4 +51,12 @@ public interface RepositoryBuilder<B extends RepositoryBuilder, R extends Reposi
5051
XraySettings getXraySettings();
5152

5253
B customProperties(Map<String, Object> customProperties);
54+
55+
B projectKey(String projectKey);
56+
57+
String getProjectKey();
58+
59+
B environments(List<String> environments);
60+
61+
List<String> getEnvironments();
5362
}

services/src/main/java/org/jfrog/artifactory/client/model/impl/FederatedRepositoryBuilderImpl.java

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -29,9 +29,9 @@ public FederatedRepository build() {
2929
validate();
3030
setRepoLayoutFromSettings();
3131

32-
return new FederatedRepositoryImpl(key, members,settings, xraySettings, description, excludesPattern,
32+
return new FederatedRepositoryImpl(key, members, settings, xraySettings, description, excludesPattern,
3333
includesPattern, notes, blackedOut, propertySets, repoLayoutRef,
34-
archiveBrowsingEnabled, customProperties);
34+
archiveBrowsingEnabled, customProperties, projectKey, environments);
3535
}
3636

3737
public RepositoryType getRepositoryType() {

services/src/main/java/org/jfrog/artifactory/client/model/impl/FederatedRepositoryImpl.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -27,14 +27,28 @@ protected FederatedRepositoryImpl(String key, List<FederatedMember> members, Re
2727
List<String> propertySets,
2828
String repoLayoutRef,
2929
boolean archiveBrowsingEnabled,
30-
Map<String, Object> customProperties) {
30+
Map<String, Object> customProperties,
31+
String projectKey,
32+
List<String> environments) {
3133

3234
super(key, settings, xraySettings, description, excludesPattern, includesPattern, notes, blackedOut,
33-
propertySets, repoLayoutRef, archiveBrowsingEnabled, customProperties);
35+
propertySets, repoLayoutRef, archiveBrowsingEnabled, customProperties, projectKey, environments);
3436

3537
this.members = members;
3638
}
3739

40+
protected FederatedRepositoryImpl(String key, List<FederatedMember> members, RepositorySettings settings, XraySettings xraySettings,
41+
String description, String excludesPattern, String includesPattern, String notes,
42+
boolean blackedOut,
43+
List<String> propertySets,
44+
String repoLayoutRef,
45+
boolean archiveBrowsingEnabled,
46+
Map<String, Object> customProperties) {
47+
48+
this(key, members, settings, xraySettings, description, excludesPattern, includesPattern, notes, blackedOut,
49+
propertySets, repoLayoutRef, archiveBrowsingEnabled, customProperties, null, null);
50+
}
51+
3852
public RepositoryTypeImpl getRclass() {
3953
return RepositoryTypeImpl.FEDERATED;
4054
}

services/src/main/java/org/jfrog/artifactory/client/model/impl/LocalRepositoryBuilderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public LocalRepository build() {
3030

3131
return new LocalRepositoryImpl(key, settings, xraySettings, description, excludesPattern,
3232
includesPattern, notes, blackedOut, propertySets, repoLayoutRef,
33-
archiveBrowsingEnabled, customProperties);
33+
archiveBrowsingEnabled, customProperties, projectKey, environments);
3434
}
3535

3636
public RepositoryType getRepositoryType() {

services/src/main/java/org/jfrog/artifactory/client/model/impl/LocalRepositoryImpl.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,24 @@ protected LocalRepositoryImpl(String key, RepositorySettings settings, XraySetti
2323
List<String> propertySets,
2424
String repoLayoutRef,
2525
boolean archiveBrowsingEnabled,
26-
Map<String, Object> customProperties) {
26+
Map<String, Object> customProperties,
27+
String projectKey,
28+
List<String> environments) {
2729

2830
super(key, settings, xraySettings, description, excludesPattern, includesPattern, notes, blackedOut,
29-
propertySets, repoLayoutRef, archiveBrowsingEnabled, customProperties);
31+
propertySets, repoLayoutRef, archiveBrowsingEnabled, customProperties, projectKey, environments);
32+
}
33+
34+
protected LocalRepositoryImpl(String key, RepositorySettings settings, XraySettings xraySettings,
35+
String description, String excludesPattern, String includesPattern, String notes,
36+
boolean blackedOut,
37+
List<String> propertySets,
38+
String repoLayoutRef,
39+
boolean archiveBrowsingEnabled,
40+
Map<String, Object> customProperties) {
41+
42+
this(key, settings, xraySettings, description, excludesPattern, includesPattern, notes, blackedOut,
43+
propertySets, repoLayoutRef, archiveBrowsingEnabled, customProperties, null, null);
3044
}
3145

3246
public RepositoryTypeImpl getRclass() {

services/src/main/java/org/jfrog/artifactory/client/model/impl/NonVirtualRepositoryBase.java

Lines changed: 16 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -26,16 +26,30 @@ protected NonVirtualRepositoryBase(String key, RepositorySettings settings, Xray
2626
List<String> propertySets,
2727
String repoLayoutRef,
2828
boolean archiveBrowsingEnabled,
29-
Map customProperties) {
29+
Map customProperties,
30+
String projectKey,
31+
List<String> environments) {
3032

3133
super(key, settings, xraySettings, description, excludesPattern, includesPattern, notes,
32-
repoLayoutRef, customProperties);
34+
repoLayoutRef, customProperties, projectKey, environments);
3335

3436
this.blackedOut = blackedOut;
3537
this.propertySets = propertySets;
3638
this.archiveBrowsingEnabled = archiveBrowsingEnabled;
3739
}
3840

41+
protected NonVirtualRepositoryBase(String key, RepositorySettings settings, XraySettings xraySettings,
42+
String description, String excludesPattern, String includesPattern,
43+
String notes, boolean blackedOut,
44+
List<String> propertySets,
45+
String repoLayoutRef,
46+
boolean archiveBrowsingEnabled,
47+
Map customProperties) {
48+
49+
this(key, settings, xraySettings, description, excludesPattern, includesPattern, notes, blackedOut,
50+
propertySets, repoLayoutRef, archiveBrowsingEnabled, customProperties, null, null);
51+
}
52+
3953
public boolean isBlackedOut() {
4054
return blackedOut;
4155
}

services/src/main/java/org/jfrog/artifactory/client/model/impl/RemoteRepositoryBuilderImpl.java

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -265,7 +265,7 @@ public RemoteRepository build() {
265265
password, proxy, retrievalCachePeriodSecs, shareConfiguration, socketTimeoutMillis,
266266
enableCookieManagement, allowAnyHostAuth, storeArtifactsLocally, synchronizeProperties,
267267
unusedArtifactsCleanupEnabled, unusedArtifactsCleanupPeriodHours, url, username, repoLayoutRef,
268-
assumedOfflinePeriodSecs, archiveBrowsingEnabled, listRemoteFolderItems, clientTlsCertificate, customProperties, bypassHeadRequests);
268+
assumedOfflinePeriodSecs, archiveBrowsingEnabled, listRemoteFolderItems, clientTlsCertificate, customProperties, bypassHeadRequests, projectKey, environments);
269269
}
270270

271271
@Override

services/src/main/java/org/jfrog/artifactory/client/model/impl/RemoteRepositoryImpl.java

Lines changed: 22 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -57,12 +57,13 @@ protected RemoteRepositoryImpl(String key, RepositorySettings settings, XraySett
5757
int retrievalCachePeriodSecs, boolean shareConfiguration, int socketTimeoutMillis, boolean cookieManagementEnabled, boolean allowAnyHostAuth, boolean storeArtifactsLocally, boolean synchronizeProperties,
5858
boolean unusedArtifactsCleanupEnabled, int unusedArtifactsCleanupPeriodHours, String url, String username, String repoLayoutRef,
5959
long assumedOfflinePeriodSecs, boolean archiveBrowsingEnabled, boolean listRemoteFolderItems,
60-
String clientTlsCertificate, Map<String, Object> customProperties, boolean bypassHeadRequests) {
60+
String clientTlsCertificate, Map<String, Object> customProperties, boolean bypassHeadRequests,
61+
String projectKey, List<String> environments) {
6162

6263
super(key, settings, xraySettings, description, excludesPattern, includesPattern,
6364
notes, blackedOut,
6465
propertySets,
65-
repoLayoutRef, archiveBrowsingEnabled, customProperties);
66+
repoLayoutRef, archiveBrowsingEnabled, customProperties, projectKey, environments);
6667

6768
this.contentSync = contentSync;
6869
this.failedRetrievalCachePeriodSecs = failedRetrievalCachePeriodSecs;
@@ -89,6 +90,25 @@ protected RemoteRepositoryImpl(String key, RepositorySettings settings, XraySett
8990
this.bypassHeadRequests = bypassHeadRequests;
9091
}
9192

93+
protected RemoteRepositoryImpl(String key, RepositorySettings settings, XraySettings xraySettings,
94+
ContentSync contentSync, String description,
95+
String excludesPattern, String includesPattern, String notes, boolean blackedOut,
96+
List<String> propertySets,
97+
int failedRetrievalCachePeriodSecs, boolean hardFail, String localAddress,
98+
int missedRetrievalCachePeriodSecs, boolean offline, String password, String proxy,
99+
int retrievalCachePeriodSecs, boolean shareConfiguration, int socketTimeoutMillis, boolean cookieManagementEnabled, boolean allowAnyHostAuth, boolean storeArtifactsLocally, boolean synchronizeProperties,
100+
boolean unusedArtifactsCleanupEnabled, int unusedArtifactsCleanupPeriodHours, String url, String username, String repoLayoutRef,
101+
long assumedOfflinePeriodSecs, boolean archiveBrowsingEnabled, boolean listRemoteFolderItems,
102+
String clientTlsCertificate, Map<String, Object> customProperties, boolean bypassHeadRequests) {
103+
104+
this(key, settings, xraySettings, contentSync, description, excludesPattern, includesPattern, notes, blackedOut,
105+
propertySets, failedRetrievalCachePeriodSecs, hardFail, localAddress, missedRetrievalCachePeriodSecs, offline,
106+
password, proxy, retrievalCachePeriodSecs, shareConfiguration, socketTimeoutMillis, cookieManagementEnabled,
107+
allowAnyHostAuth, storeArtifactsLocally, synchronizeProperties, unusedArtifactsCleanupEnabled,
108+
unusedArtifactsCleanupPeriodHours, url, username, repoLayoutRef, assumedOfflinePeriodSecs,
109+
archiveBrowsingEnabled, listRemoteFolderItems, clientTlsCertificate, customProperties, bypassHeadRequests, null, null);
110+
}
111+
92112
public String getUrl() {
93113
return url;
94114
}

services/src/main/java/org/jfrog/artifactory/client/model/impl/RepositoryBase.java

Lines changed: 38 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33
import com.fasterxml.jackson.annotation.JsonAnyGetter;
44
import com.fasterxml.jackson.annotation.JsonIgnore;
55
import com.fasterxml.jackson.annotation.JsonInclude;
6+
import java.util.List;
67
import java.util.Map;
78
import org.jfrog.artifactory.client.model.Repository;
89
import org.jfrog.artifactory.client.model.repository.settings.RepositorySettings;
@@ -27,13 +28,16 @@ public abstract class RepositoryBase implements Repository {
2728
protected XraySettings xraySettings;
2829
@JsonInclude(JsonInclude.Include.NON_EMPTY)
2930
protected Map<String, Object> customProperties;
31+
private String projectKey;
32+
private List<String> environments;
3033

3134
protected RepositoryBase() {
3235
}
3336

3437
protected RepositoryBase(String key, RepositorySettings settings, XraySettings xraySettings,
3538
String description, String excludesPattern, String includesPattern,
36-
String notes, String repoLayoutRef, Map<String, Object> customProperties) {
39+
String notes, String repoLayoutRef, Map<String, Object> customProperties,
40+
String projectKey, List<String> environments) {
3741

3842
this.key = key;
3943
this.settings = settings;
@@ -44,13 +48,23 @@ protected RepositoryBase(String key, RepositorySettings settings, XraySettings x
4448
this.notes = notes;
4549
this.repoLayoutRef = repoLayoutRef;
4650
this.customProperties = customProperties;
51+
this.projectKey = projectKey;
52+
this.environments = environments;
53+
}
54+
55+
protected RepositoryBase(String key, RepositorySettings settings, XraySettings xraySettings,
56+
String description, String excludesPattern, String includesPattern,
57+
String notes, String repoLayoutRef, Map<String, Object> customProperties) {
58+
59+
this(key, settings, xraySettings, description, excludesPattern, includesPattern, notes, repoLayoutRef,
60+
customProperties, null, null);
4761
}
4862

4963
protected RepositoryBase(String key, RepositorySettings settings,
5064
String description, String excludesPattern, String includesPattern,
5165
String notes, String repoLayoutRef, Map<String, Object> customProperties) {
5266

53-
this(key,settings, null, description, excludesPattern, includesPattern, notes, repoLayoutRef,
67+
this(key, settings, null, description, excludesPattern, includesPattern, notes, repoLayoutRef,
5468
customProperties);
5569
}
5670

@@ -94,6 +108,22 @@ private void setExcludesPattern(String excludesPattern) {
94108
this.excludesPattern = excludesPattern;
95109
}
96110

111+
public String getProjectKey() {
112+
return projectKey;
113+
}
114+
115+
private void setProjectKey(String projectKey) {
116+
this.projectKey = projectKey;
117+
}
118+
119+
public List<String> getEnvironments() {
120+
return environments;
121+
}
122+
123+
private void setEnvironments(List<String> environments) {
124+
this.environments = environments;
125+
}
126+
97127
@Override
98128
public boolean equals(Object o) {
99129
if (this == o) return true;
@@ -111,6 +141,8 @@ public boolean equals(Object o) {
111141
if (getRclass() != that.getRclass()) return false;
112142
if (settings != null ? !settings.equals(that.settings) : that.settings != null) return false;
113143
if (xraySettings != null ? !xraySettings.equals(that.xraySettings) : that.xraySettings != null) return false;
144+
if (projectKey != null ? !projectKey.equals(that.projectKey) : that.projectKey != null) return false;
145+
if (environments != null ? !environments.equals(that.environments) : that.environments != null) return false;
114146

115147
return true;
116148
}
@@ -125,6 +157,8 @@ public int hashCode() {
125157
result = 31 * result + (excludesPattern != null ? excludesPattern.hashCode() : 0);
126158
result = 31 * result + (settings != null ? settings.hashCode() : 0);
127159
result = 31 * result + (xraySettings != null ? xraySettings.hashCode() : 0);
160+
result = 31 * result + (projectKey != null ? projectKey.hashCode() : 0);
161+
result = 31 * result + (environments != null ? environments.hashCode() : 0);
128162
return result;
129163
}
130164

@@ -137,6 +171,8 @@ public String toString() {
137171
", notes='" + notes + '\'' +
138172
", includesPattern='" + includesPattern + '\'' +
139173
", excludesPattern='" + excludesPattern + '\'' +
174+
", projectKey='" + projectKey + '\'' +
175+
", environments=" + environments +
140176
'}';
141177
}
142178

0 commit comments

Comments
 (0)