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

software.amazon.awssdk.services.workdocs.model.DocumentVersionMetadata Maven / Gradle / Ivy

Go to download

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

There is a newer version: 2.29.39
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.workdocs.model;

import java.io.Serializable;
import java.time.Instant;
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.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;

/**
 * 

* Describes a version of a document. *

*/ @Generated("software.amazon.awssdk:codegen") public final class DocumentVersionMetadata implements SdkPojo, Serializable, ToCopyableBuilder { private static final SdkField ID_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Id") .getter(getter(DocumentVersionMetadata::id)).setter(setter(Builder::id)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Id").build()).build(); private static final SdkField NAME_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Name") .getter(getter(DocumentVersionMetadata::name)).setter(setter(Builder::name)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Name").build()).build(); private static final SdkField CONTENT_TYPE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("ContentType").getter(getter(DocumentVersionMetadata::contentType)).setter(setter(Builder::contentType)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContentType").build()).build(); private static final SdkField SIZE_FIELD = SdkField. builder(MarshallingType.LONG).memberName("Size") .getter(getter(DocumentVersionMetadata::size)).setter(setter(Builder::size)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Size").build()).build(); private static final SdkField SIGNATURE_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("Signature").getter(getter(DocumentVersionMetadata::signature)).setter(setter(Builder::signature)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Signature").build()).build(); private static final SdkField STATUS_FIELD = SdkField. builder(MarshallingType.STRING).memberName("Status") .getter(getter(DocumentVersionMetadata::statusAsString)).setter(setter(Builder::status)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Status").build()).build(); private static final SdkField CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("CreatedTimestamp").getter(getter(DocumentVersionMetadata::createdTimestamp)) .setter(setter(Builder::createdTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatedTimestamp").build()).build(); private static final SdkField MODIFIED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("ModifiedTimestamp").getter(getter(DocumentVersionMetadata::modifiedTimestamp)) .setter(setter(Builder::modifiedTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ModifiedTimestamp").build()).build(); private static final SdkField CONTENT_CREATED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("ContentCreatedTimestamp").getter(getter(DocumentVersionMetadata::contentCreatedTimestamp)) .setter(setter(Builder::contentCreatedTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContentCreatedTimestamp").build()) .build(); private static final SdkField CONTENT_MODIFIED_TIMESTAMP_FIELD = SdkField. builder(MarshallingType.INSTANT) .memberName("ContentModifiedTimestamp").getter(getter(DocumentVersionMetadata::contentModifiedTimestamp)) .setter(setter(Builder::contentModifiedTimestamp)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("ContentModifiedTimestamp").build()) .build(); private static final SdkField CREATOR_ID_FIELD = SdkField. builder(MarshallingType.STRING) .memberName("CreatorId").getter(getter(DocumentVersionMetadata::creatorId)).setter(setter(Builder::creatorId)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("CreatorId").build()).build(); private static final SdkField> THUMBNAIL_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("Thumbnail") .getter(getter(DocumentVersionMetadata::thumbnailAsStrings)) .setter(setter(Builder::thumbnailWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Thumbnail").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> SOURCE_FIELD = SdkField .> builder(MarshallingType.MAP) .memberName("Source") .getter(getter(DocumentVersionMetadata::sourceAsStrings)) .setter(setter(Builder::sourceWithStrings)) .traits(LocationTrait.builder().location(MarshallLocation.PAYLOAD).locationName("Source").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 List> SDK_FIELDS = Collections.unmodifiableList(Arrays.asList(ID_FIELD, NAME_FIELD, CONTENT_TYPE_FIELD, SIZE_FIELD, SIGNATURE_FIELD, STATUS_FIELD, CREATED_TIMESTAMP_FIELD, MODIFIED_TIMESTAMP_FIELD, CONTENT_CREATED_TIMESTAMP_FIELD, CONTENT_MODIFIED_TIMESTAMP_FIELD, CREATOR_ID_FIELD, THUMBNAIL_FIELD, SOURCE_FIELD)); private static final long serialVersionUID = 1L; private final String id; private final String name; private final String contentType; private final Long size; private final String signature; private final String status; private final Instant createdTimestamp; private final Instant modifiedTimestamp; private final Instant contentCreatedTimestamp; private final Instant contentModifiedTimestamp; private final String creatorId; private final Map thumbnail; private final Map source; private DocumentVersionMetadata(BuilderImpl builder) { this.id = builder.id; this.name = builder.name; this.contentType = builder.contentType; this.size = builder.size; this.signature = builder.signature; this.status = builder.status; this.createdTimestamp = builder.createdTimestamp; this.modifiedTimestamp = builder.modifiedTimestamp; this.contentCreatedTimestamp = builder.contentCreatedTimestamp; this.contentModifiedTimestamp = builder.contentModifiedTimestamp; this.creatorId = builder.creatorId; this.thumbnail = builder.thumbnail; this.source = builder.source; } /** *

* The ID of the version. *

* * @return The ID of the version. */ public String id() { return id; } /** *

* The name of the version. *

* * @return The name of the version. */ public String name() { return name; } /** *

* The content type of the document. *

* * @return The content type of the document. */ public String contentType() { return contentType; } /** *

* The size of the document, in bytes. *

* * @return The size of the document, in bytes. */ public Long size() { return size; } /** *

* The signature of the document. *

* * @return The signature of the document. */ public String signature() { return signature; } /** *

* The status of the document. *

*

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

* * @return The status of the document. * @see DocumentStatusType */ public DocumentStatusType status() { return DocumentStatusType.fromValue(status); } /** *

* The status of the document. *

*

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

* * @return The status of the document. * @see DocumentStatusType */ public String statusAsString() { return status; } /** *

* The timestamp when the document was first uploaded. *

* * @return The timestamp when the document was first uploaded. */ public Instant createdTimestamp() { return createdTimestamp; } /** *

* The timestamp when the document was last uploaded. *

* * @return The timestamp when the document was last uploaded. */ public Instant modifiedTimestamp() { return modifiedTimestamp; } /** *

* The timestamp when the content of the document was originally created. *

* * @return The timestamp when the content of the document was originally created. */ public Instant contentCreatedTimestamp() { return contentCreatedTimestamp; } /** *

* The timestamp when the content of the document was modified. *

* * @return The timestamp when the content of the document was modified. */ public Instant contentModifiedTimestamp() { return contentModifiedTimestamp; } /** *

* The ID of the creator. *

* * @return The ID of the creator. */ public String creatorId() { return creatorId; } /** *

* The thumbnail of the document. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasThumbnail()} to see if a value was sent in this field. *

* * @return The thumbnail of the document. */ public Map thumbnail() { return DocumentThumbnailUrlMapCopier.copyStringToEnum(thumbnail); } /** * Returns true if the Thumbnail 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 boolean hasThumbnail() { return thumbnail != null && !(thumbnail instanceof SdkAutoConstructMap); } /** *

* The thumbnail of the document. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasThumbnail()} to see if a value was sent in this field. *

* * @return The thumbnail of the document. */ public Map thumbnailAsStrings() { return thumbnail; } /** *

* The source of the document. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasSource()} to see if a value was sent in this field. *

* * @return The source of the document. */ public Map source() { return DocumentSourceUrlMapCopier.copyStringToEnum(source); } /** * Returns true if the Source 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 boolean hasSource() { return source != null && !(source instanceof SdkAutoConstructMap); } /** *

* The source of the document. *

*

* Attempts to modify the collection returned by this method will result in an UnsupportedOperationException. *

*

* You can use {@link #hasSource()} to see if a value was sent in this field. *

* * @return The source of the document. */ public Map sourceAsStrings() { return source; } @Override public Builder toBuilder() { return new BuilderImpl(this); } public static Builder builder() { return new BuilderImpl(); } public static Class serializableBuilderClass() { return BuilderImpl.class; } @Override public int hashCode() { int hashCode = 1; hashCode = 31 * hashCode + Objects.hashCode(id()); hashCode = 31 * hashCode + Objects.hashCode(name()); hashCode = 31 * hashCode + Objects.hashCode(contentType()); hashCode = 31 * hashCode + Objects.hashCode(size()); hashCode = 31 * hashCode + Objects.hashCode(signature()); hashCode = 31 * hashCode + Objects.hashCode(statusAsString()); hashCode = 31 * hashCode + Objects.hashCode(createdTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(modifiedTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(contentCreatedTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(contentModifiedTimestamp()); hashCode = 31 * hashCode + Objects.hashCode(creatorId()); hashCode = 31 * hashCode + Objects.hashCode(thumbnailAsStrings()); hashCode = 31 * hashCode + Objects.hashCode(sourceAsStrings()); return hashCode; } @Override public boolean equals(Object obj) { return equalsBySdkFields(obj); } @Override public boolean equalsBySdkFields(Object obj) { if (this == obj) { return true; } if (obj == null) { return false; } if (!(obj instanceof DocumentVersionMetadata)) { return false; } DocumentVersionMetadata other = (DocumentVersionMetadata) obj; return Objects.equals(id(), other.id()) && Objects.equals(name(), other.name()) && Objects.equals(contentType(), other.contentType()) && Objects.equals(size(), other.size()) && Objects.equals(signature(), other.signature()) && Objects.equals(statusAsString(), other.statusAsString()) && Objects.equals(createdTimestamp(), other.createdTimestamp()) && Objects.equals(modifiedTimestamp(), other.modifiedTimestamp()) && Objects.equals(contentCreatedTimestamp(), other.contentCreatedTimestamp()) && Objects.equals(contentModifiedTimestamp(), other.contentModifiedTimestamp()) && Objects.equals(creatorId(), other.creatorId()) && Objects.equals(thumbnailAsStrings(), other.thumbnailAsStrings()) && Objects.equals(sourceAsStrings(), other.sourceAsStrings()); } /** * 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 String toString() { return ToString.builder("DocumentVersionMetadata").add("Id", id()).add("Name", name()).add("ContentType", contentType()) .add("Size", size()).add("Signature", signature()).add("Status", statusAsString()) .add("CreatedTimestamp", createdTimestamp()).add("ModifiedTimestamp", modifiedTimestamp()) .add("ContentCreatedTimestamp", contentCreatedTimestamp()) .add("ContentModifiedTimestamp", contentModifiedTimestamp()).add("CreatorId", creatorId()) .add("Thumbnail", thumbnailAsStrings() == null ? null : "*** Sensitive Data Redacted ***") .add("Source", sourceAsStrings() == null ? null : "*** Sensitive Data Redacted ***").build(); } public Optional getValueForField(String fieldName, Class clazz) { switch (fieldName) { case "Id": return Optional.ofNullable(clazz.cast(id())); case "Name": return Optional.ofNullable(clazz.cast(name())); case "ContentType": return Optional.ofNullable(clazz.cast(contentType())); case "Size": return Optional.ofNullable(clazz.cast(size())); case "Signature": return Optional.ofNullable(clazz.cast(signature())); case "Status": return Optional.ofNullable(clazz.cast(statusAsString())); case "CreatedTimestamp": return Optional.ofNullable(clazz.cast(createdTimestamp())); case "ModifiedTimestamp": return Optional.ofNullable(clazz.cast(modifiedTimestamp())); case "ContentCreatedTimestamp": return Optional.ofNullable(clazz.cast(contentCreatedTimestamp())); case "ContentModifiedTimestamp": return Optional.ofNullable(clazz.cast(contentModifiedTimestamp())); case "CreatorId": return Optional.ofNullable(clazz.cast(creatorId())); case "Thumbnail": return Optional.ofNullable(clazz.cast(thumbnailAsStrings())); case "Source": return Optional.ofNullable(clazz.cast(sourceAsStrings())); default: return Optional.empty(); } } @Override public List> sdkFields() { return SDK_FIELDS; } private static Function getter(Function g) { return obj -> g.apply((DocumentVersionMetadata) obj); } private static BiConsumer setter(BiConsumer s) { return (obj, val) -> s.accept((Builder) obj, val); } public interface Builder extends SdkPojo, CopyableBuilder { /** *

* The ID of the version. *

* * @param id * The ID of the version. * @return Returns a reference to this object so that method calls can be chained together. */ Builder id(String id); /** *

* The name of the version. *

* * @param name * The name of the version. * @return Returns a reference to this object so that method calls can be chained together. */ Builder name(String name); /** *

* The content type of the document. *

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

* The size of the document, in bytes. *

* * @param size * The size of the document, in bytes. * @return Returns a reference to this object so that method calls can be chained together. */ Builder size(Long size); /** *

* The signature of the document. *

* * @param signature * The signature of the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder signature(String signature); /** *

* The status of the document. *

* * @param status * The status of the document. * @see DocumentStatusType * @return Returns a reference to this object so that method calls can be chained together. * @see DocumentStatusType */ Builder status(String status); /** *

* The status of the document. *

* * @param status * The status of the document. * @see DocumentStatusType * @return Returns a reference to this object so that method calls can be chained together. * @see DocumentStatusType */ Builder status(DocumentStatusType status); /** *

* The timestamp when the document was first uploaded. *

* * @param createdTimestamp * The timestamp when the document was first uploaded. * @return Returns a reference to this object so that method calls can be chained together. */ Builder createdTimestamp(Instant createdTimestamp); /** *

* The timestamp when the document was last uploaded. *

* * @param modifiedTimestamp * The timestamp when the document was last uploaded. * @return Returns a reference to this object so that method calls can be chained together. */ Builder modifiedTimestamp(Instant modifiedTimestamp); /** *

* The timestamp when the content of the document was originally created. *

* * @param contentCreatedTimestamp * The timestamp when the content of the document was originally created. * @return Returns a reference to this object so that method calls can be chained together. */ Builder contentCreatedTimestamp(Instant contentCreatedTimestamp); /** *

* The timestamp when the content of the document was modified. *

* * @param contentModifiedTimestamp * The timestamp when the content of the document was modified. * @return Returns a reference to this object so that method calls can be chained together. */ Builder contentModifiedTimestamp(Instant contentModifiedTimestamp); /** *

* The ID of the creator. *

* * @param creatorId * The ID of the creator. * @return Returns a reference to this object so that method calls can be chained together. */ Builder creatorId(String creatorId); /** *

* The thumbnail of the document. *

* * @param thumbnail * The thumbnail of the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder thumbnailWithStrings(Map thumbnail); /** *

* The thumbnail of the document. *

* * @param thumbnail * The thumbnail of the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder thumbnail(Map thumbnail); /** *

* The source of the document. *

* * @param source * The source of the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder sourceWithStrings(Map source); /** *

* The source of the document. *

* * @param source * The source of the document. * @return Returns a reference to this object so that method calls can be chained together. */ Builder source(Map source); } static final class BuilderImpl implements Builder { private String id; private String name; private String contentType; private Long size; private String signature; private String status; private Instant createdTimestamp; private Instant modifiedTimestamp; private Instant contentCreatedTimestamp; private Instant contentModifiedTimestamp; private String creatorId; private Map thumbnail = DefaultSdkAutoConstructMap.getInstance(); private Map source = DefaultSdkAutoConstructMap.getInstance(); private BuilderImpl() { } private BuilderImpl(DocumentVersionMetadata model) { id(model.id); name(model.name); contentType(model.contentType); size(model.size); signature(model.signature); status(model.status); createdTimestamp(model.createdTimestamp); modifiedTimestamp(model.modifiedTimestamp); contentCreatedTimestamp(model.contentCreatedTimestamp); contentModifiedTimestamp(model.contentModifiedTimestamp); creatorId(model.creatorId); thumbnailWithStrings(model.thumbnail); sourceWithStrings(model.source); } 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 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 String getContentType() { return contentType; } @Override public final Builder contentType(String contentType) { this.contentType = contentType; return this; } public final void setContentType(String contentType) { this.contentType = contentType; } public final Long getSize() { return size; } @Override public final Builder size(Long size) { this.size = size; return this; } public final void setSize(Long size) { this.size = size; } public final String getSignature() { return signature; } @Override public final Builder signature(String signature) { this.signature = signature; return this; } public final void setSignature(String signature) { this.signature = signature; } public final String getStatus() { return status; } @Override public final Builder status(String status) { this.status = status; return this; } @Override public final Builder status(DocumentStatusType status) { this.status(status == null ? null : status.toString()); return this; } public final void setStatus(String status) { this.status = status; } public final Instant getCreatedTimestamp() { return createdTimestamp; } @Override public final Builder createdTimestamp(Instant createdTimestamp) { this.createdTimestamp = createdTimestamp; return this; } public final void setCreatedTimestamp(Instant createdTimestamp) { this.createdTimestamp = createdTimestamp; } public final Instant getModifiedTimestamp() { return modifiedTimestamp; } @Override public final Builder modifiedTimestamp(Instant modifiedTimestamp) { this.modifiedTimestamp = modifiedTimestamp; return this; } public final void setModifiedTimestamp(Instant modifiedTimestamp) { this.modifiedTimestamp = modifiedTimestamp; } public final Instant getContentCreatedTimestamp() { return contentCreatedTimestamp; } @Override public final Builder contentCreatedTimestamp(Instant contentCreatedTimestamp) { this.contentCreatedTimestamp = contentCreatedTimestamp; return this; } public final void setContentCreatedTimestamp(Instant contentCreatedTimestamp) { this.contentCreatedTimestamp = contentCreatedTimestamp; } public final Instant getContentModifiedTimestamp() { return contentModifiedTimestamp; } @Override public final Builder contentModifiedTimestamp(Instant contentModifiedTimestamp) { this.contentModifiedTimestamp = contentModifiedTimestamp; return this; } public final void setContentModifiedTimestamp(Instant contentModifiedTimestamp) { this.contentModifiedTimestamp = contentModifiedTimestamp; } public final String getCreatorId() { return creatorId; } @Override public final Builder creatorId(String creatorId) { this.creatorId = creatorId; return this; } public final void setCreatorId(String creatorId) { this.creatorId = creatorId; } public final Map getThumbnail() { return thumbnail; } @Override public final Builder thumbnailWithStrings(Map thumbnail) { this.thumbnail = DocumentThumbnailUrlMapCopier.copy(thumbnail); return this; } @Override public final Builder thumbnail(Map thumbnail) { this.thumbnail = DocumentThumbnailUrlMapCopier.copyEnumToString(thumbnail); return this; } public final void setThumbnail(Map thumbnail) { this.thumbnail = DocumentThumbnailUrlMapCopier.copy(thumbnail); } public final Map getSource() { return source; } @Override public final Builder sourceWithStrings(Map source) { this.source = DocumentSourceUrlMapCopier.copy(source); return this; } @Override public final Builder source(Map source) { this.source = DocumentSourceUrlMapCopier.copyEnumToString(source); return this; } public final void setSource(Map source) { this.source = DocumentSourceUrlMapCopier.copy(source); } @Override public DocumentVersionMetadata build() { return new DocumentVersionMetadata(this); } @Override public List> sdkFields() { return SDK_FIELDS; } } }




© 2015 - 2025 Weber Informatics LLC | Privacy Policy