Please wait. This can take some minutes ...
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.
software.amazon.awssdk.services.pinpoint.model.JourneyResponse Maven / Gradle / Ivy
Go to download
The AWS Java SDK for Amazon Pinpoint module holds the client classes that are used for communicating
with Amazon Pinpoint Service
/*
* 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.pinpoint.model;
import java.io.Serializable;
import java.util.Arrays;
import java.util.Collections;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Optional;
import java.util.function.BiConsumer;
import java.util.function.Consumer;
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.core.traits.MapTrait;
import software.amazon.awssdk.core.util.DefaultSdkAutoConstructMap;
import software.amazon.awssdk.core.util.SdkAutoConstructMap;
import software.amazon.awssdk.utils.ToString;
import software.amazon.awssdk.utils.builder.CopyableBuilder;
import software.amazon.awssdk.utils.builder.ToCopyableBuilder;
/**
*
* Provides information about the status, configuration, and other settings for a journey.
*
*/
@Generated("software.amazon.awssdk:codegen")
public final class JourneyResponse implements SdkPojo, Serializable, ToCopyableBuilder {
private static final SdkField> ACTIVITIES_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("Activities")
.getter(getter(JourneyResponse::activities))
.setter(setter(Builder::activities))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Activities").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.SDK_POJO)
.constructor(Activity::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField APPLICATION_ID_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("ApplicationId").getter(getter(JourneyResponse::applicationId)).setter(setter(Builder::applicationId))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ApplicationId").build()).build();
private static final SdkField CREATION_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("CreationDate").getter(getter(JourneyResponse::creationDate)).setter(setter(Builder::creationDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreationDate").build()).build();
private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id")
.getter(getter(JourneyResponse::id)).setter(setter(Builder::id))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build();
private static final SdkField LAST_MODIFIED_DATE_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("LastModifiedDate").getter(getter(JourneyResponse::lastModifiedDate))
.setter(setter(Builder::lastModifiedDate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LastModifiedDate").build()).build();
private static final SdkField LIMITS_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Limits").getter(getter(JourneyResponse::limits)).setter(setter(Builder::limits))
.constructor(JourneyLimits::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Limits").build()).build();
private static final SdkField LOCAL_TIME_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("LocalTime").getter(getter(JourneyResponse::localTime)).setter(setter(Builder::localTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("LocalTime").build()).build();
private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name")
.getter(getter(JourneyResponse::name)).setter(setter(Builder::name))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build();
private static final SdkField QUIET_TIME_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("QuietTime").getter(getter(JourneyResponse::quietTime)).setter(setter(Builder::quietTime))
.constructor(QuietTime::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("QuietTime").build()).build();
private static final SdkField REFRESH_FREQUENCY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("RefreshFrequency").getter(getter(JourneyResponse::refreshFrequency))
.setter(setter(Builder::refreshFrequency))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RefreshFrequency").build()).build();
private static final SdkField SCHEDULE_FIELD = SdkField. builder(MarshallingType.SDK_POJO)
.memberName("Schedule").getter(getter(JourneyResponse::schedule)).setter(setter(Builder::schedule))
.constructor(JourneySchedule::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Schedule").build()).build();
private static final SdkField START_ACTIVITY_FIELD = SdkField. builder(MarshallingType.STRING)
.memberName("StartActivity").getter(getter(JourneyResponse::startActivity)).setter(setter(Builder::startActivity))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartActivity").build()).build();
private static final SdkField START_CONDITION_FIELD = SdkField
. builder(MarshallingType.SDK_POJO).memberName("StartCondition")
.getter(getter(JourneyResponse::startCondition)).setter(setter(Builder::startCondition))
.constructor(StartCondition::builder)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("StartCondition").build()).build();
private static final SdkField STATE_FIELD = SdkField. builder(MarshallingType.STRING).memberName("State")
.getter(getter(JourneyResponse::stateAsString)).setter(setter(Builder::state))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("State").build()).build();
private static final SdkField> TAGS_FIELD = SdkField
.> builder(MarshallingType.MAP)
.memberName("tags")
.getter(getter(JourneyResponse::tags))
.setter(setter(Builder::tags))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("tags").build(),
MapTrait.builder()
.keyLocationName("key")
.valueLocationName("value")
.valueFieldInfo(
SdkField. builder(MarshallingType.STRING)
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD)
.locationName("value").build()).build()).build()).build();
private static final SdkField WAIT_FOR_QUIET_TIME_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("WaitForQuietTime").getter(getter(JourneyResponse::waitForQuietTime))
.setter(setter(Builder::waitForQuietTime))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("WaitForQuietTime").build()).build();
private static final SdkField REFRESH_ON_SEGMENT_UPDATE_FIELD = SdkField. builder(MarshallingType.BOOLEAN)
.memberName("RefreshOnSegmentUpdate").getter(getter(JourneyResponse::refreshOnSegmentUpdate))
.setter(setter(Builder::refreshOnSegmentUpdate))
.traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("RefreshOnSegmentUpdate").build())
.build();
private static final List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ACTIVITIES_FIELD,
APPLICATION_ID_FIELD, CREATION_DATE_FIELD, ID_FIELD, LAST_MODIFIED_DATE_FIELD, LIMITS_FIELD, LOCAL_TIME_FIELD,
NAME_FIELD, QUIET_TIME_FIELD, REFRESH_FREQUENCY_FIELD, SCHEDULE_FIELD, START_ACTIVITY_FIELD, START_CONDITION_FIELD,
STATE_FIELD, TAGS_FIELD, WAIT_FOR_QUIET_TIME_FIELD, REFRESH_ON_SEGMENT_UPDATE_FIELD));
private static final long serialVersionUID = 1L;
private final Map activities;
private final String applicationId;
private final String creationDate;
private final String id;
private final String lastModifiedDate;
private final JourneyLimits limits;
private final Boolean localTime;
private final String name;
private final QuietTime quietTime;
private final String refreshFrequency;
private final JourneySchedule schedule;
private final String startActivity;
private final StartCondition startCondition;
private final String state;
private final Map tags;
private final Boolean waitForQuietTime;
private final Boolean refreshOnSegmentUpdate;
private JourneyResponse(BuilderImpl builder) {
this.activities = builder.activities;
this.applicationId = builder.applicationId;
this.creationDate = builder.creationDate;
this.id = builder.id;
this.lastModifiedDate = builder.lastModifiedDate;
this.limits = builder.limits;
this.localTime = builder.localTime;
this.name = builder.name;
this.quietTime = builder.quietTime;
this.refreshFrequency = builder.refreshFrequency;
this.schedule = builder.schedule;
this.startActivity = builder.startActivity;
this.startCondition = builder.startCondition;
this.state = builder.state;
this.tags = builder.tags;
this.waitForQuietTime = builder.waitForQuietTime;
this.refreshOnSegmentUpdate = builder.refreshOnSegmentUpdate;
}
/**
* Returns true if the Activities property was specified by the sender (it may be empty), or false if the sender did
* not specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasActivities() {
return activities != null && !(activities instanceof SdkAutoConstructMap);
}
/**
*
* A map that contains a set of Activity objects, one object for each activity in the journey. For each Activity
* object, the key is the unique identifier (string) for an activity and the value is the settings for the activity.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasActivities()} to see if a value was sent in this field.
*
*
* @return A map that contains a set of Activity objects, one object for each activity in the journey. For each
* Activity object, the key is the unique identifier (string) for an activity and the value is the settings
* for the activity.
*/
public final Map activities() {
return activities;
}
/**
*
* The unique identifier for the application that the journey applies to.
*
*
* @return The unique identifier for the application that the journey applies to.
*/
public final String applicationId() {
return applicationId;
}
/**
*
* The date, in ISO 8601 format, when the journey was created.
*
*
* @return The date, in ISO 8601 format, when the journey was created.
*/
public final String creationDate() {
return creationDate;
}
/**
*
* The unique identifier for the journey.
*
*
* @return The unique identifier for the journey.
*/
public final String id() {
return id;
}
/**
*
* The date, in ISO 8601 format, when the journey was last modified.
*
*
* @return The date, in ISO 8601 format, when the journey was last modified.
*/
public final String lastModifiedDate() {
return lastModifiedDate;
}
/**
*
* The messaging and entry limits for the journey.
*
*
* @return The messaging and entry limits for the journey.
*/
public final JourneyLimits limits() {
return limits;
}
/**
*
* Specifies whether the journey's scheduled start and end times use each participant's local time. If this value is
* true, the schedule uses each participant's local time.
*
*
* @return Specifies whether the journey's scheduled start and end times use each participant's local time. If this
* value is true, the schedule uses each participant's local time.
*/
public final Boolean localTime() {
return localTime;
}
/**
*
* The name of the journey.
*
*
* @return The name of the journey.
*/
public final String name() {
return name;
}
/**
*
* The quiet time settings for the journey. Quiet time is a specific time range when a journey doesn't send messages
* to participants, if all the following conditions are met:
*
*
*
*
* The EndpointDemographic.Timezone property of the endpoint for the participant is set to a valid value.
*
*
*
*
* The current time in the participant's time zone is later than or equal to the time specified by the
* QuietTime.Start property for the journey.
*
*
*
*
* The current time in the participant's time zone is earlier than or equal to the time specified by the
* QuietTime.End property for the journey.
*
*
*
*
* If any of the preceding conditions isn't met, the participant will receive messages from the journey, even if
* quiet time is enabled.
*
*
* @return The quiet time settings for the journey. Quiet time is a specific time range when a journey doesn't send
* messages to participants, if all the following conditions are met:
*
*
*
* The EndpointDemographic.Timezone property of the endpoint for the participant is set to a valid value.
*
*
*
*
* The current time in the participant's time zone is later than or equal to the time specified by the
* QuietTime.Start property for the journey.
*
*
*
*
* The current time in the participant's time zone is earlier than or equal to the time specified by the
* QuietTime.End property for the journey.
*
*
*
*
* If any of the preceding conditions isn't met, the participant will receive messages from the journey,
* even if quiet time is enabled.
*/
public final QuietTime quietTime() {
return quietTime;
}
/**
*
* The frequency with which Amazon Pinpoint evaluates segment and event data for the journey, as a duration in ISO
* 8601 format.
*
*
* @return The frequency with which Amazon Pinpoint evaluates segment and event data for the journey, as a duration
* in ISO 8601 format.
*/
public final String refreshFrequency() {
return refreshFrequency;
}
/**
*
* The schedule settings for the journey.
*
*
* @return The schedule settings for the journey.
*/
public final JourneySchedule schedule() {
return schedule;
}
/**
*
* The unique identifier for the first activity in the journey.
*
*
* @return The unique identifier for the first activity in the journey.
*/
public final String startActivity() {
return startActivity;
}
/**
*
* The segment that defines which users are participants in the journey.
*
*
* @return The segment that defines which users are participants in the journey.
*/
public final StartCondition startCondition() {
return startCondition;
}
/**
*
* The current status of the journey. Possible values are:
*
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the journey may
* currently be running or scheduled to start running at a later time. If a journey's status is ACTIVE, you can't
* add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the journey
* and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change, or remove
* activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled end time,
* or passed its scheduled start time and a refresh frequency hasn't been specified for it. If a journey's status is
* CLOSED, you can't add participants to it, and no existing participants can enter the journey for the first time.
* However, any existing participants who are currently waiting to start an activity may continue the journey.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link State#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current status of the journey. Possible values are:
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the journey
* may currently be running or scheduled to start running at a later time. If a journey's status is ACTIVE,
* you can't add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the
* journey and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change, or
* remove activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled
* end time, or passed its scheduled start time and a refresh frequency hasn't been specified for it. If a
* journey's status is CLOSED, you can't add participants to it, and no existing participants can enter the
* journey for the first time. However, any existing participants who are currently waiting to start an
* activity may continue the journey.
*
*
* @see State
*/
public final State state() {
return State.fromValue(state);
}
/**
*
* The current status of the journey. Possible values are:
*
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the journey may
* currently be running or scheduled to start running at a later time. If a journey's status is ACTIVE, you can't
* add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the journey
* and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change, or remove
* activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled end time,
* or passed its scheduled start time and a refresh frequency hasn't been specified for it. If a journey's status is
* CLOSED, you can't add participants to it, and no existing participants can enter the journey for the first time.
* However, any existing participants who are currently waiting to start an activity may continue the journey.
*
*
*
*
* If the service returns an enum value that is not available in the current SDK version, {@link #state} will return
* {@link State#UNKNOWN_TO_SDK_VERSION}. The raw value returned by the service is available from
* {@link #stateAsString}.
*
*
* @return The current status of the journey. Possible values are:
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the journey
* may currently be running or scheduled to start running at a later time. If a journey's status is ACTIVE,
* you can't add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the
* journey and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change, or
* remove activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled
* end time, or passed its scheduled start time and a refresh frequency hasn't been specified for it. If a
* journey's status is CLOSED, you can't add participants to it, and no existing participants can enter the
* journey for the first time. However, any existing participants who are currently waiting to start an
* activity may continue the journey.
*
*
* @see State
*/
public final String stateAsString() {
return state;
}
/**
* Returns true if the Tags property was specified by the sender (it may be empty), or false if the sender did not
* specify the value (it will be empty). For responses returned by the SDK, the sender is the AWS service.
*/
public final boolean hasTags() {
return tags != null && !(tags instanceof SdkAutoConstructMap);
}
/**
*
* This object is not used or supported.
*
*
* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException.
*
*
* You can use {@link #hasTags()} to see if a value was sent in this field.
*
*
* @return This object is not used or supported.
*/
public final Map tags() {
return tags;
}
/**
*
* Specifies whether endpoints in quiet hours should enter a wait till the end of their quiet hours.
*
*
* @return Specifies whether endpoints in quiet hours should enter a wait till the end of their quiet hours.
*/
public final Boolean waitForQuietTime() {
return waitForQuietTime;
}
/**
*
* Specifies whether a journey should be refreshed on segment update.
*
*
* @return Specifies whether a journey should be refreshed on segment update.
*/
public final Boolean refreshOnSegmentUpdate() {
return refreshOnSegmentUpdate;
}
@Override
public Builder toBuilder() {
return new BuilderImpl(this);
}
public static Builder builder() {
return new BuilderImpl();
}
public static Class extends Builder> serializableBuilderClass() {
return BuilderImpl.class;
}
@Override
public final int hashCode() {
int hashCode = 1;
hashCode = 31 * hashCode + Objects.hashCode(hasActivities() ? activities() : null);
hashCode = 31 * hashCode + Objects.hashCode(applicationId());
hashCode = 31 * hashCode + Objects.hashCode(creationDate());
hashCode = 31 * hashCode + Objects.hashCode(id());
hashCode = 31 * hashCode + Objects.hashCode(lastModifiedDate());
hashCode = 31 * hashCode + Objects.hashCode(limits());
hashCode = 31 * hashCode + Objects.hashCode(localTime());
hashCode = 31 * hashCode + Objects.hashCode(name());
hashCode = 31 * hashCode + Objects.hashCode(quietTime());
hashCode = 31 * hashCode + Objects.hashCode(refreshFrequency());
hashCode = 31 * hashCode + Objects.hashCode(schedule());
hashCode = 31 * hashCode + Objects.hashCode(startActivity());
hashCode = 31 * hashCode + Objects.hashCode(startCondition());
hashCode = 31 * hashCode + Objects.hashCode(stateAsString());
hashCode = 31 * hashCode + Objects.hashCode(hasTags() ? tags() : null);
hashCode = 31 * hashCode + Objects.hashCode(waitForQuietTime());
hashCode = 31 * hashCode + Objects.hashCode(refreshOnSegmentUpdate());
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 JourneyResponse)) {
return false;
}
JourneyResponse other = (JourneyResponse) obj;
return hasActivities() == other.hasActivities() && Objects.equals(activities(), other.activities())
&& Objects.equals(applicationId(), other.applicationId()) && Objects.equals(creationDate(), other.creationDate())
&& Objects.equals(id(), other.id()) && Objects.equals(lastModifiedDate(), other.lastModifiedDate())
&& Objects.equals(limits(), other.limits()) && Objects.equals(localTime(), other.localTime())
&& Objects.equals(name(), other.name()) && Objects.equals(quietTime(), other.quietTime())
&& Objects.equals(refreshFrequency(), other.refreshFrequency()) && Objects.equals(schedule(), other.schedule())
&& Objects.equals(startActivity(), other.startActivity())
&& Objects.equals(startCondition(), other.startCondition())
&& Objects.equals(stateAsString(), other.stateAsString()) && hasTags() == other.hasTags()
&& Objects.equals(tags(), other.tags()) && Objects.equals(waitForQuietTime(), other.waitForQuietTime())
&& Objects.equals(refreshOnSegmentUpdate(), other.refreshOnSegmentUpdate());
}
/**
* 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("JourneyResponse").add("Activities", hasActivities() ? activities() : null)
.add("ApplicationId", applicationId()).add("CreationDate", creationDate()).add("Id", id())
.add("LastModifiedDate", lastModifiedDate()).add("Limits", limits()).add("LocalTime", localTime())
.add("Name", name()).add("QuietTime", quietTime()).add("RefreshFrequency", refreshFrequency())
.add("Schedule", schedule()).add("StartActivity", startActivity()).add("StartCondition", startCondition())
.add("State", stateAsString()).add("Tags", hasTags() ? tags() : null).add("WaitForQuietTime", waitForQuietTime())
.add("RefreshOnSegmentUpdate", refreshOnSegmentUpdate()).build();
}
public final Optional getValueForField(String fieldName, Class clazz) {
switch (fieldName) {
case "Activities":
return Optional.ofNullable(clazz.cast(activities()));
case "ApplicationId":
return Optional.ofNullable(clazz.cast(applicationId()));
case "CreationDate":
return Optional.ofNullable(clazz.cast(creationDate()));
case "Id":
return Optional.ofNullable(clazz.cast(id()));
case "LastModifiedDate":
return Optional.ofNullable(clazz.cast(lastModifiedDate()));
case "Limits":
return Optional.ofNullable(clazz.cast(limits()));
case "LocalTime":
return Optional.ofNullable(clazz.cast(localTime()));
case "Name":
return Optional.ofNullable(clazz.cast(name()));
case "QuietTime":
return Optional.ofNullable(clazz.cast(quietTime()));
case "RefreshFrequency":
return Optional.ofNullable(clazz.cast(refreshFrequency()));
case "Schedule":
return Optional.ofNullable(clazz.cast(schedule()));
case "StartActivity":
return Optional.ofNullable(clazz.cast(startActivity()));
case "StartCondition":
return Optional.ofNullable(clazz.cast(startCondition()));
case "State":
return Optional.ofNullable(clazz.cast(stateAsString()));
case "tags":
return Optional.ofNullable(clazz.cast(tags()));
case "WaitForQuietTime":
return Optional.ofNullable(clazz.cast(waitForQuietTime()));
case "RefreshOnSegmentUpdate":
return Optional.ofNullable(clazz.cast(refreshOnSegmentUpdate()));
default:
return Optional.empty();
}
}
@Override
public final List> sdkFields() {
return SDK_FIELDS;
}
private static Function getter(Function g) {
return obj -> g.apply((JourneyResponse) obj);
}
private static BiConsumer setter(BiConsumer s) {
return (obj, val) -> s.accept((Builder) obj, val);
}
public interface Builder extends SdkPojo, CopyableBuilder {
/**
*
* A map that contains a set of Activity objects, one object for each activity in the journey. For each Activity
* object, the key is the unique identifier (string) for an activity and the value is the settings for the
* activity.
*
*
* @param activities
* A map that contains a set of Activity objects, one object for each activity in the journey. For each
* Activity object, the key is the unique identifier (string) for an activity and the value is the
* settings for the activity.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder activities(Map activities);
/**
*
* The unique identifier for the application that the journey applies to.
*
*
* @param applicationId
* The unique identifier for the application that the journey applies to.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder applicationId(String applicationId);
/**
*
* The date, in ISO 8601 format, when the journey was created.
*
*
* @param creationDate
* The date, in ISO 8601 format, when the journey was created.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder creationDate(String creationDate);
/**
*
* The unique identifier for the journey.
*
*
* @param id
* The unique identifier for the journey.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder id(String id);
/**
*
* The date, in ISO 8601 format, when the journey was last modified.
*
*
* @param lastModifiedDate
* The date, in ISO 8601 format, when the journey was last modified.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder lastModifiedDate(String lastModifiedDate);
/**
*
* The messaging and entry limits for the journey.
*
*
* @param limits
* The messaging and entry limits for the journey.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder limits(JourneyLimits limits);
/**
*
* The messaging and entry limits for the journey.
*
* This is a convenience that creates an instance of the {@link JourneyLimits.Builder} avoiding the need to
* create one manually via {@link JourneyLimits#builder()}.
*
* When the {@link Consumer} completes, {@link JourneyLimits.Builder#build()} is called immediately and its
* result is passed to {@link #limits(JourneyLimits)}.
*
* @param limits
* a consumer that will call methods on {@link JourneyLimits.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #limits(JourneyLimits)
*/
default Builder limits(Consumer limits) {
return limits(JourneyLimits.builder().applyMutation(limits).build());
}
/**
*
* Specifies whether the journey's scheduled start and end times use each participant's local time. If this
* value is true, the schedule uses each participant's local time.
*
*
* @param localTime
* Specifies whether the journey's scheduled start and end times use each participant's local time. If
* this value is true, the schedule uses each participant's local time.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder localTime(Boolean localTime);
/**
*
* The name of the journey.
*
*
* @param name
* The name of the journey.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder name(String name);
/**
*
* The quiet time settings for the journey. Quiet time is a specific time range when a journey doesn't send
* messages to participants, if all the following conditions are met:
*
*
*
*
* The EndpointDemographic.Timezone property of the endpoint for the participant is set to a valid value.
*
*
*
*
* The current time in the participant's time zone is later than or equal to the time specified by the
* QuietTime.Start property for the journey.
*
*
*
*
* The current time in the participant's time zone is earlier than or equal to the time specified by the
* QuietTime.End property for the journey.
*
*
*
*
* If any of the preceding conditions isn't met, the participant will receive messages from the journey, even if
* quiet time is enabled.
*
*
* @param quietTime
* The quiet time settings for the journey. Quiet time is a specific time range when a journey doesn't
* send messages to participants, if all the following conditions are met:
*
*
*
* The EndpointDemographic.Timezone property of the endpoint for the participant is set to a valid value.
*
*
*
*
* The current time in the participant's time zone is later than or equal to the time specified by the
* QuietTime.Start property for the journey.
*
*
*
*
* The current time in the participant's time zone is earlier than or equal to the time specified by the
* QuietTime.End property for the journey.
*
*
*
*
* If any of the preceding conditions isn't met, the participant will receive messages from the journey,
* even if quiet time is enabled.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder quietTime(QuietTime quietTime);
/**
*
* The quiet time settings for the journey. Quiet time is a specific time range when a journey doesn't send
* messages to participants, if all the following conditions are met:
*
*
*
*
* The EndpointDemographic.Timezone property of the endpoint for the participant is set to a valid value.
*
*
*
*
* The current time in the participant's time zone is later than or equal to the time specified by the
* QuietTime.Start property for the journey.
*
*
*
*
* The current time in the participant's time zone is earlier than or equal to the time specified by the
* QuietTime.End property for the journey.
*
*
*
*
* If any of the preceding conditions isn't met, the participant will receive messages from the journey, even if
* quiet time is enabled.
*
* This is a convenience that creates an instance of the {@link QuietTime.Builder} avoiding the need to create
* one manually via {@link QuietTime#builder()}.
*
* When the {@link Consumer} completes, {@link QuietTime.Builder#build()} is called immediately and its result
* is passed to {@link #quietTime(QuietTime)}.
*
* @param quietTime
* a consumer that will call methods on {@link QuietTime.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #quietTime(QuietTime)
*/
default Builder quietTime(Consumer quietTime) {
return quietTime(QuietTime.builder().applyMutation(quietTime).build());
}
/**
*
* The frequency with which Amazon Pinpoint evaluates segment and event data for the journey, as a duration in
* ISO 8601 format.
*
*
* @param refreshFrequency
* The frequency with which Amazon Pinpoint evaluates segment and event data for the journey, as a
* duration in ISO 8601 format.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder refreshFrequency(String refreshFrequency);
/**
*
* The schedule settings for the journey.
*
*
* @param schedule
* The schedule settings for the journey.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder schedule(JourneySchedule schedule);
/**
*
* The schedule settings for the journey.
*
* This is a convenience that creates an instance of the {@link JourneySchedule.Builder} avoiding the need to
* create one manually via {@link JourneySchedule#builder()}.
*
* When the {@link Consumer} completes, {@link JourneySchedule.Builder#build()} is called immediately and its
* result is passed to {@link #schedule(JourneySchedule)}.
*
* @param schedule
* a consumer that will call methods on {@link JourneySchedule.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #schedule(JourneySchedule)
*/
default Builder schedule(Consumer schedule) {
return schedule(JourneySchedule.builder().applyMutation(schedule).build());
}
/**
*
* The unique identifier for the first activity in the journey.
*
*
* @param startActivity
* The unique identifier for the first activity in the journey.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startActivity(String startActivity);
/**
*
* The segment that defines which users are participants in the journey.
*
*
* @param startCondition
* The segment that defines which users are participants in the journey.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder startCondition(StartCondition startCondition);
/**
*
* The segment that defines which users are participants in the journey.
*
* This is a convenience that creates an instance of the {@link StartCondition.Builder} avoiding the need to
* create one manually via {@link StartCondition#builder()}.
*
* When the {@link Consumer} completes, {@link StartCondition.Builder#build()} is called immediately and its
* result is passed to {@link #startCondition(StartCondition)}.
*
* @param startCondition
* a consumer that will call methods on {@link StartCondition.Builder}
* @return Returns a reference to this object so that method calls can be chained together.
* @see #startCondition(StartCondition)
*/
default Builder startCondition(Consumer startCondition) {
return startCondition(StartCondition.builder().applyMutation(startCondition).build());
}
/**
*
* The current status of the journey. Possible values are:
*
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the journey may
* currently be running or scheduled to start running at a later time. If a journey's status is ACTIVE, you
* can't add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the
* journey and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change, or
* remove activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled end
* time, or passed its scheduled start time and a refresh frequency hasn't been specified for it. If a journey's
* status is CLOSED, you can't add participants to it, and no existing participants can enter the journey for
* the first time. However, any existing participants who are currently waiting to start an activity may
* continue the journey.
*
*
*
*
* @param state
* The current status of the journey. Possible values are:
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the
* journey may currently be running or scheduled to start running at a later time. If a journey's status
* is ACTIVE, you can't add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the
* journey and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change,
* or remove activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled
* end time, or passed its scheduled start time and a refresh frequency hasn't been specified for it. If
* a journey's status is CLOSED, you can't add participants to it, and no existing participants can enter
* the journey for the first time. However, any existing participants who are currently waiting to start
* an activity may continue the journey.
*
*
* @see State
* @return Returns a reference to this object so that method calls can be chained together.
* @see State
*/
Builder state(String state);
/**
*
* The current status of the journey. Possible values are:
*
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the journey may
* currently be running or scheduled to start running at a later time. If a journey's status is ACTIVE, you
* can't add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the
* journey and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change, or
* remove activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled end
* time, or passed its scheduled start time and a refresh frequency hasn't been specified for it. If a journey's
* status is CLOSED, you can't add participants to it, and no existing participants can enter the journey for
* the first time. However, any existing participants who are currently waiting to start an activity may
* continue the journey.
*
*
*
*
* @param state
* The current status of the journey. Possible values are:
*
*
*
* DRAFT - The journey is being developed and hasn't been published yet.
*
*
*
*
* ACTIVE - The journey has been developed and published. Depending on the journey's schedule, the
* journey may currently be running or scheduled to start running at a later time. If a journey's status
* is ACTIVE, you can't add, change, or remove activities from it.
*
*
*
*
* COMPLETED - The journey has been published and has finished running. All participants have entered the
* journey and no participants are waiting to complete the journey or any activities in the journey.
*
*
*
*
* CANCELLED - The journey has been stopped. If a journey's status is CANCELLED, you can't add, change,
* or remove activities or segment settings from the journey.
*
*
*
*
* CLOSED - The journey has been published and has started running. It may have also passed its scheduled
* end time, or passed its scheduled start time and a refresh frequency hasn't been specified for it. If
* a journey's status is CLOSED, you can't add participants to it, and no existing participants can enter
* the journey for the first time. However, any existing participants who are currently waiting to start
* an activity may continue the journey.
*
*
* @see State
* @return Returns a reference to this object so that method calls can be chained together.
* @see State
*/
Builder state(State state);
/**
*
* This object is not used or supported.
*
*
* @param tags
* This object is not used or supported.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder tags(Map tags);
/**
*
* Specifies whether endpoints in quiet hours should enter a wait till the end of their quiet hours.
*
*
* @param waitForQuietTime
* Specifies whether endpoints in quiet hours should enter a wait till the end of their quiet hours.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder waitForQuietTime(Boolean waitForQuietTime);
/**
*
* Specifies whether a journey should be refreshed on segment update.
*
*
* @param refreshOnSegmentUpdate
* Specifies whether a journey should be refreshed on segment update.
* @return Returns a reference to this object so that method calls can be chained together.
*/
Builder refreshOnSegmentUpdate(Boolean refreshOnSegmentUpdate);
}
static final class BuilderImpl implements Builder {
private Map activities = DefaultSdkAutoConstructMap.getInstance();
private String applicationId;
private String creationDate;
private String id;
private String lastModifiedDate;
private JourneyLimits limits;
private Boolean localTime;
private String name;
private QuietTime quietTime;
private String refreshFrequency;
private JourneySchedule schedule;
private String startActivity;
private StartCondition startCondition;
private String state;
private Map tags = DefaultSdkAutoConstructMap.getInstance();
private Boolean waitForQuietTime;
private Boolean refreshOnSegmentUpdate;
private BuilderImpl() {
}
private BuilderImpl(JourneyResponse model) {
activities(model.activities);
applicationId(model.applicationId);
creationDate(model.creationDate);
id(model.id);
lastModifiedDate(model.lastModifiedDate);
limits(model.limits);
localTime(model.localTime);
name(model.name);
quietTime(model.quietTime);
refreshFrequency(model.refreshFrequency);
schedule(model.schedule);
startActivity(model.startActivity);
startCondition(model.startCondition);
state(model.state);
tags(model.tags);
waitForQuietTime(model.waitForQuietTime);
refreshOnSegmentUpdate(model.refreshOnSegmentUpdate);
}
public final Map getActivities() {
Map result = MapOfActivityCopier.copyToBuilder(this.activities);
if (result instanceof SdkAutoConstructMap) {
return null;
}
return result;
}
@Override
public final Builder activities(Map activities) {
this.activities = MapOfActivityCopier.copy(activities);
return this;
}
public final void setActivities(Map activities) {
this.activities = MapOfActivityCopier.copyFromBuilder(activities);
}
public final String getApplicationId() {
return applicationId;
}
@Override
public final Builder applicationId(String applicationId) {
this.applicationId = applicationId;
return this;
}
public final void setApplicationId(String applicationId) {
this.applicationId = applicationId;
}
public final String getCreationDate() {
return creationDate;
}
@Override
public final Builder creationDate(String creationDate) {
this.creationDate = creationDate;
return this;
}
public final void setCreationDate(String creationDate) {
this.creationDate = creationDate;
}
public final String getId() {
return id;
}
@Override
public final Builder id(String id) {
this.id = id;
return this;
}
public final void setId(String id) {
this.id = id;
}
public final String getLastModifiedDate() {
return lastModifiedDate;
}
@Override
public final Builder lastModifiedDate(String lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
return this;
}
public final void setLastModifiedDate(String lastModifiedDate) {
this.lastModifiedDate = lastModifiedDate;
}
public final JourneyLimits.Builder getLimits() {
return limits != null ? limits.toBuilder() : null;
}
@Override
public final Builder limits(JourneyLimits limits) {
this.limits = limits;
return this;
}
public final void setLimits(JourneyLimits.BuilderImpl limits) {
this.limits = limits != null ? limits.build() : null;
}
public final Boolean getLocalTime() {
return localTime;
}
@Override
public final Builder localTime(Boolean localTime) {
this.localTime = localTime;
return this;
}
public final void setLocalTime(Boolean localTime) {
this.localTime = localTime;
}
public final String getName() {
return name;
}
@Override
public final Builder name(String name) {
this.name = name;
return this;
}
public final void setName(String name) {
this.name = name;
}
public final QuietTime.Builder getQuietTime() {
return quietTime != null ? quietTime.toBuilder() : null;
}
@Override
public final Builder quietTime(QuietTime quietTime) {
this.quietTime = quietTime;
return this;
}
public final void setQuietTime(QuietTime.BuilderImpl quietTime) {
this.quietTime = quietTime != null ? quietTime.build() : null;
}
public final String getRefreshFrequency() {
return refreshFrequency;
}
@Override
public final Builder refreshFrequency(String refreshFrequency) {
this.refreshFrequency = refreshFrequency;
return this;
}
public final void setRefreshFrequency(String refreshFrequency) {
this.refreshFrequency = refreshFrequency;
}
public final JourneySchedule.Builder getSchedule() {
return schedule != null ? schedule.toBuilder() : null;
}
@Override
public final Builder schedule(JourneySchedule schedule) {
this.schedule = schedule;
return this;
}
public final void setSchedule(JourneySchedule.BuilderImpl schedule) {
this.schedule = schedule != null ? schedule.build() : null;
}
public final String getStartActivity() {
return startActivity;
}
@Override
public final Builder startActivity(String startActivity) {
this.startActivity = startActivity;
return this;
}
public final void setStartActivity(String startActivity) {
this.startActivity = startActivity;
}
public final StartCondition.Builder getStartCondition() {
return startCondition != null ? startCondition.toBuilder() : null;
}
@Override
public final Builder startCondition(StartCondition startCondition) {
this.startCondition = startCondition;
return this;
}
public final void setStartCondition(StartCondition.BuilderImpl startCondition) {
this.startCondition = startCondition != null ? startCondition.build() : null;
}
public final String getState() {
return state;
}
@Override
public final Builder state(String state) {
this.state = state;
return this;
}
@Override
public final Builder state(State state) {
this.state(state == null ? null : state.toString());
return this;
}
public final void setState(String state) {
this.state = state;
}
public final Map getTags() {
if (tags instanceof SdkAutoConstructMap) {
return null;
}
return tags;
}
@Override
public final Builder tags(Map tags) {
this.tags = MapOf__stringCopier.copy(tags);
return this;
}
public final void setTags(Map tags) {
this.tags = MapOf__stringCopier.copy(tags);
}
public final Boolean getWaitForQuietTime() {
return waitForQuietTime;
}
@Override
public final Builder waitForQuietTime(Boolean waitForQuietTime) {
this.waitForQuietTime = waitForQuietTime;
return this;
}
public final void setWaitForQuietTime(Boolean waitForQuietTime) {
this.waitForQuietTime = waitForQuietTime;
}
public final Boolean getRefreshOnSegmentUpdate() {
return refreshOnSegmentUpdate;
}
@Override
public final Builder refreshOnSegmentUpdate(Boolean refreshOnSegmentUpdate) {
this.refreshOnSegmentUpdate = refreshOnSegmentUpdate;
return this;
}
public final void setRefreshOnSegmentUpdate(Boolean refreshOnSegmentUpdate) {
this.refreshOnSegmentUpdate = refreshOnSegmentUpdate;
}
@Override
public JourneyResponse build() {
return new JourneyResponse(this);
}
@Override
public List> sdkFields() {
return SDK_FIELDS;
}
}
}