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

com.azure.resourcemanager.datafactory.models.SalesforceServiceCloudSink Maven / Gradle / Ivy

// Copyright (c) Microsoft Corporation. All rights reserved.
// Licensed under the MIT License.
// Code generated by Microsoft (R) AutoRest Code Generator.

package com.azure.resourcemanager.datafactory.models;

import com.azure.core.annotation.Fluent;
import com.azure.json.JsonReader;
import com.azure.json.JsonToken;
import com.azure.json.JsonWriter;
import java.io.IOException;
import java.util.LinkedHashMap;
import java.util.Map;

/**
 * A copy activity Salesforce Service Cloud sink.
 */
@Fluent
public final class SalesforceServiceCloudSink extends CopySink {
    /*
     * Copy sink type.
     */
    private String type = "SalesforceServiceCloudSink";

    /*
     * The write behavior for the operation. Default is Insert.
     */
    private SalesforceSinkWriteBehavior writeBehavior;

    /*
     * The name of the external ID field for upsert operation. Default value is 'Id' column. Type: string (or Expression
     * with resultType string).
     */
    private Object externalIdFieldName;

    /*
     * The flag indicating whether or not to ignore null values from input dataset (except key fields) during write
     * operation. Default value is false. If set it to true, it means ADF will leave the data in the destination object
     * unchanged when doing upsert/update operation and insert defined default value when doing insert operation, versus
     * ADF will update the data in the destination object to NULL when doing upsert/update operation and insert NULL
     * value when doing insert operation. Type: boolean (or Expression with resultType boolean).
     */
    private Object ignoreNullValues;

    /**
     * Creates an instance of SalesforceServiceCloudSink class.
     */
    public SalesforceServiceCloudSink() {
    }

    /**
     * Get the type property: Copy sink type.
     * 
     * @return the type value.
     */
    @Override
    public String type() {
        return this.type;
    }

    /**
     * Get the writeBehavior property: The write behavior for the operation. Default is Insert.
     * 
     * @return the writeBehavior value.
     */
    public SalesforceSinkWriteBehavior writeBehavior() {
        return this.writeBehavior;
    }

    /**
     * Set the writeBehavior property: The write behavior for the operation. Default is Insert.
     * 
     * @param writeBehavior the writeBehavior value to set.
     * @return the SalesforceServiceCloudSink object itself.
     */
    public SalesforceServiceCloudSink withWriteBehavior(SalesforceSinkWriteBehavior writeBehavior) {
        this.writeBehavior = writeBehavior;
        return this;
    }

    /**
     * Get the externalIdFieldName property: The name of the external ID field for upsert operation. Default value is
     * 'Id' column. Type: string (or Expression with resultType string).
     * 
     * @return the externalIdFieldName value.
     */
    public Object externalIdFieldName() {
        return this.externalIdFieldName;
    }

    /**
     * Set the externalIdFieldName property: The name of the external ID field for upsert operation. Default value is
     * 'Id' column. Type: string (or Expression with resultType string).
     * 
     * @param externalIdFieldName the externalIdFieldName value to set.
     * @return the SalesforceServiceCloudSink object itself.
     */
    public SalesforceServiceCloudSink withExternalIdFieldName(Object externalIdFieldName) {
        this.externalIdFieldName = externalIdFieldName;
        return this;
    }

    /**
     * Get the ignoreNullValues property: The flag indicating whether or not to ignore null values from input dataset
     * (except key fields) during write operation. Default value is false. If set it to true, it means ADF will leave
     * the data in the destination object unchanged when doing upsert/update operation and insert defined default value
     * when doing insert operation, versus ADF will update the data in the destination object to NULL when doing
     * upsert/update operation and insert NULL value when doing insert operation. Type: boolean (or Expression with
     * resultType boolean).
     * 
     * @return the ignoreNullValues value.
     */
    public Object ignoreNullValues() {
        return this.ignoreNullValues;
    }

    /**
     * Set the ignoreNullValues property: The flag indicating whether or not to ignore null values from input dataset
     * (except key fields) during write operation. Default value is false. If set it to true, it means ADF will leave
     * the data in the destination object unchanged when doing upsert/update operation and insert defined default value
     * when doing insert operation, versus ADF will update the data in the destination object to NULL when doing
     * upsert/update operation and insert NULL value when doing insert operation. Type: boolean (or Expression with
     * resultType boolean).
     * 
     * @param ignoreNullValues the ignoreNullValues value to set.
     * @return the SalesforceServiceCloudSink object itself.
     */
    public SalesforceServiceCloudSink withIgnoreNullValues(Object ignoreNullValues) {
        this.ignoreNullValues = ignoreNullValues;
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SalesforceServiceCloudSink withWriteBatchSize(Object writeBatchSize) {
        super.withWriteBatchSize(writeBatchSize);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SalesforceServiceCloudSink withWriteBatchTimeout(Object writeBatchTimeout) {
        super.withWriteBatchTimeout(writeBatchTimeout);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SalesforceServiceCloudSink withSinkRetryCount(Object sinkRetryCount) {
        super.withSinkRetryCount(sinkRetryCount);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SalesforceServiceCloudSink withSinkRetryWait(Object sinkRetryWait) {
        super.withSinkRetryWait(sinkRetryWait);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SalesforceServiceCloudSink withMaxConcurrentConnections(Object maxConcurrentConnections) {
        super.withMaxConcurrentConnections(maxConcurrentConnections);
        return this;
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public SalesforceServiceCloudSink withDisableMetricsCollection(Object disableMetricsCollection) {
        super.withDisableMetricsCollection(disableMetricsCollection);
        return this;
    }

    /**
     * Validates the instance.
     * 
     * @throws IllegalArgumentException thrown if the instance is not valid.
     */
    @Override
    public void validate() {
    }

    /**
     * {@inheritDoc}
     */
    @Override
    public JsonWriter toJson(JsonWriter jsonWriter) throws IOException {
        jsonWriter.writeStartObject();
        jsonWriter.writeUntypedField("writeBatchSize", writeBatchSize());
        jsonWriter.writeUntypedField("writeBatchTimeout", writeBatchTimeout());
        jsonWriter.writeUntypedField("sinkRetryCount", sinkRetryCount());
        jsonWriter.writeUntypedField("sinkRetryWait", sinkRetryWait());
        jsonWriter.writeUntypedField("maxConcurrentConnections", maxConcurrentConnections());
        jsonWriter.writeUntypedField("disableMetricsCollection", disableMetricsCollection());
        jsonWriter.writeStringField("type", this.type);
        jsonWriter.writeStringField("writeBehavior", this.writeBehavior == null ? null : this.writeBehavior.toString());
        jsonWriter.writeUntypedField("externalIdFieldName", this.externalIdFieldName);
        jsonWriter.writeUntypedField("ignoreNullValues", this.ignoreNullValues);
        if (additionalProperties() != null) {
            for (Map.Entry additionalProperty : additionalProperties().entrySet()) {
                jsonWriter.writeUntypedField(additionalProperty.getKey(), additionalProperty.getValue());
            }
        }
        return jsonWriter.writeEndObject();
    }

    /**
     * Reads an instance of SalesforceServiceCloudSink from the JsonReader.
     * 
     * @param jsonReader The JsonReader being read.
     * @return An instance of SalesforceServiceCloudSink if the JsonReader was pointing to an instance of it, or null if
     * it was pointing to JSON null.
     * @throws IOException If an error occurs while reading the SalesforceServiceCloudSink.
     */
    public static SalesforceServiceCloudSink fromJson(JsonReader jsonReader) throws IOException {
        return jsonReader.readObject(reader -> {
            SalesforceServiceCloudSink deserializedSalesforceServiceCloudSink = new SalesforceServiceCloudSink();
            Map additionalProperties = null;
            while (reader.nextToken() != JsonToken.END_OBJECT) {
                String fieldName = reader.getFieldName();
                reader.nextToken();

                if ("writeBatchSize".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.withWriteBatchSize(reader.readUntyped());
                } else if ("writeBatchTimeout".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.withWriteBatchTimeout(reader.readUntyped());
                } else if ("sinkRetryCount".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.withSinkRetryCount(reader.readUntyped());
                } else if ("sinkRetryWait".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.withSinkRetryWait(reader.readUntyped());
                } else if ("maxConcurrentConnections".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.withMaxConcurrentConnections(reader.readUntyped());
                } else if ("disableMetricsCollection".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.withDisableMetricsCollection(reader.readUntyped());
                } else if ("type".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.type = reader.getString();
                } else if ("writeBehavior".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.writeBehavior
                        = SalesforceSinkWriteBehavior.fromString(reader.getString());
                } else if ("externalIdFieldName".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.externalIdFieldName = reader.readUntyped();
                } else if ("ignoreNullValues".equals(fieldName)) {
                    deserializedSalesforceServiceCloudSink.ignoreNullValues = reader.readUntyped();
                } else {
                    if (additionalProperties == null) {
                        additionalProperties = new LinkedHashMap<>();
                    }

                    additionalProperties.put(fieldName, reader.readUntyped());
                }
            }
            deserializedSalesforceServiceCloudSink.withAdditionalProperties(additionalProperties);

            return deserializedSalesforceServiceCloudSink;
        });
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy