diff --git a/pom.xml b/pom.xml index 54c2f65b..e90d259d 100644 --- a/pom.xml +++ b/pom.xml @@ -4,7 +4,7 @@ netwolfuk.teamcity.plugins.tcwebhooks tcwebhooks - 2.0.0-rc.2 + 2.0.0-rc.3 snapshot ${GIT_HASH} ${GIT_BRANCH} diff --git a/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/parameter/ProjectWebhookParameters.java b/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/parameter/ProjectWebhookParameters.java index dfbbb9b5..57153018 100644 --- a/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/parameter/ProjectWebhookParameters.java +++ b/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/parameter/ProjectWebhookParameters.java @@ -55,17 +55,12 @@ public ProjectWebhookParameters(@NotNull final List 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>() { - public List get() { - final ArrayList 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 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())); diff --git a/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/webhook/ProjectWebHookParameters.java b/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/webhook/ProjectWebHookParameters.java index efeaf60b..7c3071ce 100644 --- a/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/webhook/ProjectWebHookParameters.java +++ b/tcwebhooks-rest-api/src/main/java/webhook/teamcity/server/rest/model/webhook/ProjectWebHookParameters.java @@ -55,21 +55,15 @@ public class ProjectWebHookParameters { public ProjectWebHookParameters(@NotNull final WebHookConfig config, @NotNull final List 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>() { - public List get() { - final ArrayList 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 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));