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

software.amazon.awssdk.services.mturk.model.ReviewActionDetail Maven / Gradle / Ivy

Go to download

The AWS Java SDK for Amazon Mechanical Turk Requester module holds the client classes that are used for communicating with Amazon Mechanical Turk Requester Service.

There is a newer version: 2.30.1
Show newest version
/*
 * Copyright Amazon.com, Inc. or its affiliates. All Rights Reserved.
 * 
 * Licensed under the Apache License, Version 2.0 (the "License"). You may not use this file except in compliance with
 * the License. A copy of the License is located at
 * 
 * http://aws.amazon.com/apache2.0
 * 
 * or in the "license" file accompanying this file. This file 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 software.amazon.awssdk.services.mturk.model;

import java.io.Serializable;
import java.time.Instant;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Function;
import software.amazon.awssdk.annotations.Generated;
import software.amazon.awssdk.core.SdkField;
import software.amazon.awssdk.core.SdkPojo;
import software.amazon.awssdk.core.protocol.MarshallLocation;
import software.amazon.awssdk.core.protocol.MarshallingType;
import software.amazon.awssdk.core.traits.LocationTrait;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;

/**
 * 

* Both the AssignmentReviewReport and the HITReviewReport elements contains the ReviewActionDetail data structure. This * structure is returned multiple times for each action specified in the Review Policy. *

*/ @Generated("software.amazon.awssdk:codegen") public final class ReviewActionDetail implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ACTION_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ActionId").getter(getter(ReviewActionDetail::actionId)).setter(setter(Builder::actionId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionId").build()).build(); private static final SdkField ACTION_NAME_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ActionName").getter(getter(ReviewActionDetail::actionName)).setter(setter(Builder::actionName)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ActionName").build()).build(); private static final SdkField TARGET_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TargetId").getter(getter(ReviewActionDetail::targetId)).setter(setter(Builder::targetId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetId").build()).build(); private static final SdkField TARGET_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("TargetType").getter(getter(ReviewActionDetail::targetType)).setter(setter(Builder::targetType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("TargetType").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status") .getter(getter(ReviewActionDetail::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField COMPLETE_TIME_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CompleteTime").getter(getter(ReviewActionDetail::completeTime)).setter(setter(Builder::completeTime)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CompleteTime").build()).build(); private static final SdkField RESULT_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Result") .getter(getter(ReviewActionDetail::result)).setter(setter(Builder::result)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Result").build()).build(); private static final SdkField ERROR_CODE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ErrorCode").getter(getter(ReviewActionDetail::errorCode)).setter(setter(Builder::errorCode)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ErrorCode").build()).build(); private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTION_ID_FIELD, ACTION_NAME_FIELD, TARGET_ID_FIELD, TARGET_TYPE_FIELD, STATUS_FIELD, COMPLETE_TIME_FIELD, RESULT_FIELD, ERROR_CODE_FIELD)); private static final long serialVersionUID = 1L; private final String actionId; private final String actionName; private final String targetId; private final String targetType; private final String status; private final Instant completeTime; private final String result; private final String errorCode; private ReviewActionDetail(BuilderImpl builder) { this.actionId = builder.actionId; this.actionName = builder.actionName; this.targetId = builder.targetId; this.targetType = builder.targetType; this.status = builder.status; this.completeTime = builder.completeTime; this.result = builder.result; this.errorCode = builder.errorCode; } /** *

* The unique identifier for the action. *

* * @return The unique identifier for the action. */ public final String actionId() { return actionId; } /** *

* The nature of the action itself. The Review Policy is responsible for examining the HIT and Assignments, emitting * results, and deciding which other actions will be necessary. *

* * @return The nature of the action itself. The Review Policy is responsible for examining the HIT and Assignments, * emitting results, and deciding which other actions will be necessary. */ public final String actionName() { return actionName; } /** *

* The specific HITId or AssignmentID targeted by the action. *

* * @return The specific HITId or AssignmentID targeted by the action. */ public final String targetId() { return targetId; } /** *

* The type of object in TargetId. *

* * @return The type of object in TargetId. */ public final String targetType() { return targetType; } /** *

* The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link ReviewActionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. * @see ReviewActionStatus */ public final ReviewActionStatus status() { return ReviewActionStatus.fromValue(status); } /** *

* The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. *

*

* If the service returns an enum value that is not available in the current SDK version, {@link #status} will * return {@link ReviewActionStatus#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from * {@link #statusAsString}. *

* * @return The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. * @see ReviewActionStatus */ public final String statusAsString() { return status; } /** *

* The date when the action was completed. *

* * @return The date when the action was completed. */ public final Instant completeTime() { return completeTime; } /** *

* A description of the outcome of the review. *

* * @return A description of the outcome of the review. */ public final String result() { return result; } /** *

* Present only when the Results have a FAILED Status. *

* * @return Present only when the Results have a FAILED Status. */ public final String errorCode() { return errorCode; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public final int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(actionId()); hashCode = 31 * hashCode + Objects.hashCode(actionName()); hashCode = 31 * hashCode + Objects.hashCode(targetId()); hashCode = 31 * hashCode + Objects.hashCode(targetType()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(completeTime()); hashCode = 31 * hashCode + Objects.hashCode(result()); hashCode = 31 * hashCode + Objects.hashCode(errorCode()); return hashCode; } @Override public final boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public final boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof ReviewActionDetail)) { return false; } ReviewActionDetail other = (ReviewActionDetail) obj; return Objects.equals(actionId(), other.actionId()) && Objects.equals(actionName(), other.actionName()) && Objects.equals(targetId(), other.targetId()) && Objects.equals(targetType(), other.targetType()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(completeTime(), other.completeTime()) && Objects.equals(result(), other.result()) && Objects.equals(errorCode(), other.errorCode()); } /** * Returns a string representation of this object. This is useful for testing and debugging. Sensitive data will be * redacted from this string using a placeholder value. */ @Override public final String toString() { return ToString.builder("ReviewActionDetail").add("ActionId", actionId()).add("ActionName", actionName()) .add("TargetId", targetId()).add("TargetType", targetType()).add("Status", statusAsString()) .add("CompleteTime", completeTime()).add("Result", result()).add("ErrorCode", errorCode()).build(); } public final Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "ActionId": return Optional.ofNullable(clazz.cast(actionId())); case "ActionName": return Optional.ofNullable(clazz.cast(actionName())); case "TargetId": return Optional.ofNullable(clazz.cast(targetId())); case "TargetType": return Optional.ofNullable(clazz.cast(targetType())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "CompleteTime": return Optional.ofNullable(clazz.cast(completeTime())); case "Result": return Optional.ofNullable(clazz.cast(result())); case "ErrorCode": return Optional.ofNullable(clazz.cast(errorCode())); default: return Optional.empty(); } } @Override public final List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((ReviewActionDetail) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The unique identifier for the action. *

* * @param actionId * The unique identifier for the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actionId(String actionId); /** *

* The nature of the action itself. The Review Policy is responsible for examining the HIT and Assignments, * emitting results, and deciding which other actions will be necessary. *

* * @param actionName * The nature of the action itself. The Review Policy is responsible for examining the HIT and * Assignments, emitting results, and deciding which other actions will be necessary. * @return Returns a reference to this object so that method calls can be chained together. */ Builder actionName(String actionName); /** *

* The specific HITId or AssignmentID targeted by the action. *

* * @param targetId * The specific HITId or AssignmentID targeted by the action. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetId(String targetId); /** *

* The type of object in TargetId. *

* * @param targetType * The type of object in TargetId. * @return Returns a reference to this object so that method calls can be chained together. */ Builder targetType(String targetType); /** *

* The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. *

* * @param status * The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. * @see ReviewActionStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ReviewActionStatus */ Builder status(String status); /** *

* The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. *

* * @param status * The current disposition of the action: INTENDED, SUCCEEDED, FAILED, or CANCELLED. * @see ReviewActionStatus * @return Returns a reference to this object so that method calls can be chained together. * @see ReviewActionStatus */ Builder status(ReviewActionStatus status); /** *

* The date when the action was completed. *

* * @param completeTime * The date when the action was completed. * @return Returns a reference to this object so that method calls can be chained together. */ Builder completeTime(Instant completeTime); /** *

* A description of the outcome of the review. *

* * @param result * A description of the outcome of the review. * @return Returns a reference to this object so that method calls can be chained together. */ Builder result(String result); /** *

* Present only when the Results have a FAILED Status. *

* * @param errorCode * Present only when the Results have a FAILED Status. * @return Returns a reference to this object so that method calls can be chained together. */ Builder errorCode(String errorCode); } static final class BuilderImpl implements Builder { private String actionId; private String actionName; private String targetId; private String targetType; private String status; private Instant completeTime; private String result; private String errorCode; private BuilderImpl() { } private BuilderImpl(ReviewActionDetail model) { actionId(model.actionId); actionName(model.actionName); targetId(model.targetId); targetType(model.targetType); status(model.status); completeTime(model.completeTime); result(model.result); errorCode(model.errorCode); } public final String getActionId() { return actionId; } public final void setActionId(String actionId) { this.actionId = actionId; } @Override public final Builder actionId(String actionId) { this.actionId = actionId; return this; } public final String getActionName() { return actionName; } public final void setActionName(String actionName) { this.actionName = actionName; } @Override public final Builder actionName(String actionName) { this.actionName = actionName; return this; } public final String getTargetId() { return targetId; } public final void setTargetId(String targetId) { this.targetId = targetId; } @Override public final Builder targetId(String targetId) { this.targetId = targetId; return this; } public final String getTargetType() { return targetType; } public final void setTargetType(String targetType) { this.targetType = targetType; } @Override public final Builder targetType(String targetType) { this.targetType = targetType; return this; } public final String getStatus() { return status; } public final void setStatus(String status) { this.status = status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(ReviewActionStatus status) { this.status(status == null ? null : status.toString()); return this; } public final Instant getCompleteTime() { return completeTime; } public final void setCompleteTime(Instant completeTime) { this.completeTime = completeTime; } @Override public final Builder completeTime(Instant completeTime) { this.completeTime = completeTime; return this; } public final String getResult() { return result; } public final void setResult(String result) { this.result = result; } @Override public final Builder result(String result) { this.result = result; return this; } public final String getErrorCode() { return errorCode; } public final void setErrorCode(String errorCode) { this.errorCode = errorCode; } @Override public final Builder errorCode(String errorCode) { this.errorCode = errorCode; return this; } @Override public ReviewActionDetail build() { return new ReviewActionDetail(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy