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

model.OutboundMessage Maven / Gradle / Ivy

There is a newer version: 1.3.9
Show newest version
package model;

import com.fasterxml.jackson.annotation.JsonIgnoreProperties;
import java.io.File;
import java.util.ArrayList;
import java.util.List;

@JsonIgnoreProperties(ignoreUnknown = true)
public class OutboundMessage {
    private String message;
    private String data;
    private File[] attachment;
    private List contentAttachment;

    public OutboundMessage() {}

    public OutboundMessage(String message) {
        this.message = message;
    }

    public OutboundMessage(String message, String data) {
        this.message = message;
        this.data = data;
    }

    public OutboundMessage(String message, File[] attachment) {
        this.message = message;
        this.attachment = attachment;
    }

    public OutboundMessage(String message, File attachment) {
        this.message = message;
        this.attachment = new File[] { attachment };
    }

    public OutboundMessage(String message, String data, File[] attachment) {
        this.message = message;
        this.data = data;
        this.attachment = attachment;
    }

    public OutboundMessage(String message, String data, File attachment) {
        this.message = message;
        this.data = data;
        this.attachment = new File[] { attachment };
    }

    public OutboundMessage(String message, List contentAttachment) {
        this.message = message;
        this.contentAttachment = contentAttachment;
    }

    public OutboundMessage(String message, ContentAttachment contentAttachment) {
        this.message = message;
        this.contentAttachment = new ArrayList<>();
        this.contentAttachment.add(contentAttachment);
    }

    public OutboundMessage(String message, String data, List contentAttachment) {
        this.message = message;
        this.data = data;
        this.contentAttachment = contentAttachment;
    }

    public OutboundMessage(String message, String data, ContentAttachment contentAttachment) {
        this.message = message;
        this.data = data;
        this.contentAttachment = new ArrayList<>();
        this.contentAttachment.add(contentAttachment);
    }

    public String getMessage() {
        return message;
    }

    public void setMessage(String message) {
        this.message = message;
    }

    public String getData() {
        return data;
    }

    public void setData(String data) {
        this.data = data;
    }

    public File[] getAttachment() {
        return attachment;
    }

    public void setAttachment(File[] attachment) {
        this.attachment = attachment;
    }

    public void setAttachment(File attachment) {
        this.attachment = new File[] { attachment };
    }

    public void addAttachment(File attachment) {
        if (this.attachment == null) {
            this.attachment = new File[] { attachment };
            return;
        }
        File[] newArray = new File[this.attachment.length + 1];
        System.arraycopy(this.attachment, 0, newArray, 0, this.attachment.length);
        newArray[newArray.length - 1] = attachment;
        this.attachment = newArray;
    }

    public List getContentAttachment() {
        return contentAttachment;
    }

    public void setContentAttachment(List contentAttachment) {
        this.contentAttachment = contentAttachment;
    }

    public void setContentAttachment(ContentAttachment contentAttachment) {
        this.contentAttachment = new ArrayList<>();
        this.contentAttachment.add(contentAttachment);
    }

    public void addContentAttachment(ContentAttachment contentAttachment) {
        if (this.contentAttachment == null) {
            this.contentAttachment = new ArrayList<>();
        }
        this.contentAttachment.add(contentAttachment);
    }

    public boolean hasAttachment() {
        return (this.attachment != null && this.attachment.length > 0 && this.attachment[0] != null)
            || (this.contentAttachment != null && !this.contentAttachment.isEmpty()
                && this.contentAttachment.get(0) != null);
    }
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy