All Downloads are FREE. Search and download functionalities are using the official Maven repository.

cd.go.contrib.plugins.configrepo.groovy.dsl.FetchExternalArtifactTask Maven / Gradle / Ivy

// Generated by delombok at Sat Aug 03 22:05:14 PDT 2024
/*
 * Copyright 2022 Thoughtworks, Inc.
 *
 * Licensed under the Apache License, Version 2.0 (the "License");
 * you may not use this file except in compliance with the License.
 * You may obtain a copy of the License at
 *
 *     http://www.apache.org/licenses/LICENSE-2.0
 *
 * Unless required by applicable law or agreed to in writing, software
 * distributed under the License is distributed on an "AS IS" BASIS,
 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
 * See the License for the specific language governing permissions and
 * limitations under the License.
 */
package cd.go.contrib.plugins.configrepo.groovy.dsl;

import com.fasterxml.jackson.annotation.*;
import groovy.lang.Closure;
import groovy.lang.DelegatesTo;
import groovy.transform.stc.ClosureParams;
import groovy.transform.stc.SimpleType;
import jakarta.validation.constraints.NotEmpty;
import java.util.ArrayList;
import java.util.LinkedHashMap;
import java.util.List;
import java.util.Map;
import static groovy.lang.Closure.DELEGATE_ONLY;

public class FetchExternalArtifactTask extends AbstractFetchArtifactTask {
    @JsonProperty("artifact_id")
    @NotEmpty
    private String artifactId;
    @JsonIgnore
    private Map configuration = new LinkedHashMap<>();

    public FetchExternalArtifactTask() {
        this(null);
    }

    public FetchExternalArtifactTask(@DelegatesTo(value = FetchExternalArtifactTask.class, strategy = DELEGATE_ONLY) @ClosureParams(value = SimpleType.class, options = "cd.go.contrib.plugins.configrepo.groovy.dsl.FetchExternalArtifactTask") Closure cl) {
        super();
        this.artifactOrigin = "external";
        configure(cl);
    }

    // by default we ignore "empty" values. However, it skips rendering of empty configuration. So we override
    /*method here for deserialization only*/@JsonGetter("configuration")
    @JsonInclude(value = JsonInclude.Include.NON_EMPTY, content = JsonInclude.Include.ALWAYS)
    @SuppressWarnings("unused")
    List> getAllConfigurations() {
        ArrayList> allConfigs = new ArrayList<>();
        if (configuration != null) {
            configuration.forEach((k, v) -> {
                LinkedHashMap var = new LinkedHashMap<>();
                var.put("key", k);
                var.put("value", v);
                allConfigs.add(var);
            });
        }
        return allConfigs;
    }

    /*method here for serialization only*/@JsonSetter("configuration")
    @SuppressWarnings("unused")
    void setAllConfigurations(List> allConfigs) {
        if (allConfigs == null) {
            return;
        }
        allConfigs.forEach(var -> configuration.put(var.get("key"), var.get("value")));
    }

    public void configurationValues(List> allConfigs) {
        setAllConfigurations(allConfigs);
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public String getArtifactId() {
        return this.artifactId;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public Map getConfiguration() {
        return this.configuration;
    }

    @JsonProperty("artifact_id")
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setArtifactId(final String artifactId) {
        this.artifactId = artifactId;
    }

    @JsonIgnore
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public void setConfiguration(final Map configuration) {
        this.configuration = configuration;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public boolean equals(final java.lang.Object o) {
        if (o == this) return true;
        if (!(o instanceof FetchExternalArtifactTask)) return false;
        final FetchExternalArtifactTask other = (FetchExternalArtifactTask) o;
        if (!other.canEqual((java.lang.Object) this)) return false;
        if (!super.equals(o)) return false;
        final java.lang.Object this$artifactId = this.getArtifactId();
        final java.lang.Object other$artifactId = other.getArtifactId();
        if (this$artifactId == null ? other$artifactId != null : !this$artifactId.equals(other$artifactId)) return false;
        final java.lang.Object this$configuration = this.getConfiguration();
        final java.lang.Object other$configuration = other.getConfiguration();
        if (this$configuration == null ? other$configuration != null : !this$configuration.equals(other$configuration)) return false;
        return true;
    }

    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    protected boolean canEqual(final java.lang.Object other) {
        return other instanceof FetchExternalArtifactTask;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public int hashCode() {
        final int PRIME = 59;
        int result = super.hashCode();
        final java.lang.Object $artifactId = this.getArtifactId();
        result = result * PRIME + ($artifactId == null ? 43 : $artifactId.hashCode());
        final java.lang.Object $configuration = this.getConfiguration();
        result = result * PRIME + ($configuration == null ? 43 : $configuration.hashCode());
        return result;
    }

    @java.lang.Override
    @java.lang.SuppressWarnings("all")
    @lombok.Generated
    public java.lang.String toString() {
        return "FetchExternalArtifactTask(super=" + super.toString() + ", artifactId=" + this.getArtifactId() + ", configuration=" + this.getConfiguration() + ")";
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy