Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance. Project price only 1 $
You can buy this project and download/modify it how often you want.
/*
* Copyright (c) 2018 Red Hat, Inc. and/or its affiliates.
*
* This program and the accompanying materials are made
* available under the terms of the Eclipse Public License 2.0
* which is available at https://www.eclipse.org/legal/epl-2.0/
*
* SPDX-License-Identifier: EPL-2.0
*/
package org.jberet.support.io;
import java.beans.Introspector;
import java.beans.PropertyDescriptor;
import java.io.Serializable;
import java.math.BigDecimal;
import java.math.BigInteger;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;
import org.jberet.support._private.SupportLogger;
import com.datastax.driver.core.BatchStatement;
import com.datastax.driver.core.BoundStatement;
import com.datastax.driver.core.ColumnDefinitions;
import com.datastax.driver.core.DataType;
import com.datastax.driver.core.Duration;
import com.datastax.driver.core.LocalDate;
import com.datastax.driver.core.PreparedStatement;
import com.datastax.driver.core.ResultSet;
import com.datastax.driver.core.TupleValue;
import com.datastax.driver.core.UDTValue;
import jakarta.batch.api.BatchProperty;
import jakarta.batch.api.chunk.ItemWriter;
import jakarta.enterprise.context.Dependent;
import jakarta.inject.Inject;
import jakarta.inject.Named;
/**
* An implementation of {@code jakarta.batch.api.chunk.ItemWriter} that inserts data items into Cassandra cluster.
*
* @see CassandraItemReader
* @see CassandraReaderWriterBase
* @see CassandraBatchlet
*
* @since 1.3.0
*/
@Named
@Dependent
public class CassandraItemWriter extends CassandraReaderWriterBase implements ItemWriter {
/**
* When the cql parameter (variable) name only differs from the corresponding table column name
* in case (i.e., they are same when compared case insensitive), the current driver uses the column
* name as the column definition name. When using this value as key to look up
* in the date item map, it will return null if the Map is keyed with the cql parameter (variable)
* name. Therefore, this property can be used to specify the parameter names in the correct case
* matching the keys in data item map.
*/
@Inject
@BatchProperty
protected String[] parameterNames;
/**
* The Cassandra batch statement that contains all insert statements within the
* current chunk processing cycle. After the batch inserts for the current chunk
* ends, it is cleared to be used by the next chunk.
*/
protected BatchStatement batchStatement = new BatchStatement();
/**
* The {@code com.datastax.driver.core.PreparedStatement} based on {@link #cql}
*/
protected PreparedStatement preparedStatement;
/**
* {@inheritDoc}
*/
@Override
public void writeItems(final List