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

com.enonic.xp.attachment.UpdateAttachmentsParams Maven / Gradle / Ivy

There is a newer version: 7.14.4
Show newest version
package com.enonic.xp.attachment;

import java.util.HashSet;
import java.util.Set;

import com.enonic.xp.annotation.PublicApi;
import com.enonic.xp.content.ContentId;

@PublicApi
public class UpdateAttachmentsParams
{
    private final ContentId contentId;

    private final Attachments attachments;

    private UpdateAttachmentsParams( final Builder builder )
    {
        this.contentId = builder.contentId;
        this.attachments = Attachments.from( builder.attachments );
    }

    public Attachments getAttachments()
    {
        return attachments;
    }

    public ContentId getContentId()
    {
        return contentId;
    }

    public static Builder create( final ContentId contentId )
    {
        return new Builder( contentId );
    }

    public static class Builder
    {
        private final ContentId contentId;

        private final Set attachments = new HashSet<>();

        public Builder( final ContentId contentId )
        {
            this.contentId = contentId;
        }

        public Builder addAttachments( final Attachment attachment )
        {
            this.attachments.add( attachment );
            return this;
        }

        public UpdateAttachmentsParams build()
        {
            return new UpdateAttachmentsParams( this );
        }
    }
}




© 2015 - 2024 Weber Informatics LLC | Privacy Policy