Skip to content

Commit

Permalink
Remove references to method that was removed from TC REST API
Browse files Browse the repository at this point in the history
Newer versions of the TC REST API now use a Java8 lambda supplier when
referencing a Value object.

Remove this pattern as it is no longer supported. We can't just change
to the supplier pattern because that might not be supported by older
versions of TeamCity.

Increment plugin version for release.
  • Loading branch information
netwolfuk committed Oct 7, 2023
1 parent 488b088 commit f6f091e
Show file tree
Hide file tree
Showing 3 changed files with 15 additions and 26 deletions.
2 changes: 1 addition & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<groupId>netwolfuk.teamcity.plugins.tcwebhooks</groupId>
<artifactId>tcwebhooks</artifactId>
<properties>
<majorVersion>1.2.4</majorVersion>
<majorVersion>1.2.5</majorVersion>
<buildNumber>snapshot</buildNumber>
<gitHash>${GIT_HASH}</gitHash>
<gitBranch>${GIT_BRANCH}</gitBranch>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,17 +55,12 @@ public ProjectWebhookParameters(@NotNull final List<WebHookParameter> webhookPar

this.projectId = ValueWithDefault.decideDefault(fields.isIncluded("projectId", false, true), projectExternalId);

if (fields.isIncluded("parameters", true, true)) {
parameters = ValueWithDefault.decideIncludeByDefault(fields.isIncluded("parameters"),
new ValueWithDefault.Value<List<ProjectWebhookParameter>>() {
public List<ProjectWebhookParameter> get() {
final ArrayList<ProjectWebhookParameter> result = new ArrayList<>(parameters.size());
for (WebHookParameter parameter : webhookParameters) {
result.add(new ProjectWebhookParameter(parameter, fields, beanContext.getApiUrlBuilder().getProjectParameterHref(projectExternalId, parameter)));
}
return result;
}
});
if (Boolean.TRUE.equals(fields.isIncluded("parameters", true, true))) {
final ArrayList<ProjectWebhookParameter> result = new ArrayList<>(parameters.size());
for (WebHookParameter parameter : webhookParameters) {
result.add(new ProjectWebhookParameter(parameter, fields, beanContext.getApiUrlBuilder().getProjectParameterHref(projectExternalId, parameter)));
}
parameters = result;
if (pagerData != null) {
href = ValueWithDefault.decideDefault(fields.isIncluded("href"),
beanContext.getApiUrlBuilder().transformRelativePath(pagerData.getHref()));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,21 +55,15 @@ public class ProjectWebHookParameters {
public ProjectWebHookParameters(@NotNull final WebHookConfig config, @NotNull final List<WebHookParameter> webhookParameters, @NotNull String projectExternalId,
@Nullable final PagerData pagerData, final @NotNull Fields fields, @NotNull final BeanContext beanContext) {

//this.webhookId = ValueWithDefault.decideDefault(fields.isIncluded("webhookId", false, true), config.getUniqueKey());

if (Boolean.TRUE.equals(fields.isIncluded("parameters", true, true))) {
parameters = ValueWithDefault.decideIncludeByDefault(fields.isIncluded("parameters"),
new ValueWithDefault.Value<List<ProjectWebhookParameter>>() {
public List<ProjectWebhookParameter> get() {
final ArrayList<ProjectWebhookParameter> result = new ArrayList<>(parameters.size());
int counter = 1;
for (WebHookParameter parameter : webhookParameters) {
parameter.setId(String.valueOf(counter++));
result.add(new ProjectWebhookParameter(parameter, fields, beanContext.getApiUrlBuilder().getWebHookParameterHref(projectExternalId, config, parameter)));
}
return result;
}
});
final ArrayList<ProjectWebhookParameter> result = new ArrayList<>(parameters.size());
int counter = 1;
for (WebHookParameter parameter : webhookParameters) {
parameter.setId(String.valueOf(counter++));
result.add(new ProjectWebhookParameter(parameter, fields, beanContext.getApiUrlBuilder().getWebHookParameterHref(projectExternalId, config, parameter)));
}
parameters = result;

count = ValueWithDefault.decideIncludeByDefault(fields.isIncluded("count"), parameters.size());
href = ValueWithDefault.decideDefault(fields.isIncluded("href"), beanContext.getApiUrlBuilder().getWebHookParametersHref(projectExternalId, config));

Expand Down

0 comments on commit f6f091e

Please sign in to comment.