001/*
002 * Licensed to the Apache Software Foundation (ASF) under one or more
003 * contributor license agreements.  See the NOTICE file distributed with
004 * this work for additional information regarding copyright ownership.
005 * The ASF licenses this file to You under the Apache License, Version 2.0
006 * (the "License"); you may not use this file except in compliance with
007 * the License.  You may obtain a copy of the License at
008 *
009 *      http://www.apache.org/licenses/LICENSE-2.0
010 *
011 * Unless required by applicable law or agreed to in writing, software
012 * distributed under the License is distributed on an "AS IS" BASIS,
013 * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
014 * See the License for the specific language governing permissions and
015 * limitations under the License.
016 */
017package org.apache.juneau.console.views;
018
019import java.util.*;
020
021import org.apache.juneau.commons.bean.*;
022
023/**
024 * The request body of an {@code aggregate}-mode bulk action ({@link RowAction.BulkMode#AGGREGATE}) —
025 * every selected row's stable id, plus a client-generated idempotency key so a retried submit (e.g. after a
026 * dropped connection) never double-applies.
027 *
028 * <h5 class='section'>Example:</h5>
029 * <p class='bjava'>
030 *    <ja>@RestPost</ja>(path=<js>"/changes/abort"</js>)
031 *    <jk>public</jk> BulkResult abortChanges(<ja>@Content</ja> BulkRequest <jv>request</jv>) {
032 *       <jk>if</jk> (<jv>idempotencyStore</jv>.seen(<jv>request</jv>.idempotencyKey))
033 *          <jk>return</jk> <jv>idempotencyStore</jv>.resultFor(<jv>request</jv>.idempotencyKey);
034 *       <jc>// ... apply, then record the result under request.idempotencyKey ...</jc>
035 *    }
036 * </p>
037 *
038 * @since 10.0.0
039 */
040@BeanType(properties="ids,idempotencyKey")
041public final class BulkRequest {
042
043   /** The stable ids of every row the client submitted this action for. */
044   public List<String> ids;
045
046   /** A client-generated token unique to this submit, so a retried request is never double-applied. */
047   public String idempotencyKey;
048}