dev.fitko.fitconnect.api.domain.model.reply.replychannel.ReplyChannel Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of client Show documentation
Show all versions of client Show documentation
Library that provides client access to the FIT-Connect api-endpoints for sending, subscribing and
routing
The newest version!
package dev.fitko.fitconnect.api.domain.model.reply.replychannel;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.nimbusds.jose.jwk.JWK;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.NoArgsConstructor;
import java.util.List;
import java.util.UUID;
@Data
@NoArgsConstructor
@AllArgsConstructor
@JsonInclude(JsonInclude.Include.NON_NULL)
public class ReplyChannel {
@JsonProperty("deMail")
private DeMail deMail;
@JsonProperty("elster")
private Elster elster;
@JsonProperty("eMail")
private Email eMail;
@JsonProperty("fink")
private Fink fink;
@JsonProperty("fitConnect")
private FitConnect fitConnect;
@JsonProperty("idBundDeMailbox")
private IdBundDeMailbox idBundDeMailbox;
private ReplyChannel(final Fink fink) {
this.fink = fink;
}
private ReplyChannel(final Email eMail) {
this.eMail = eMail;
}
private ReplyChannel(final DeMail deMail) {
this.deMail = deMail;
}
private ReplyChannel(final Elster elster) {
this.elster = elster;
}
private ReplyChannel(final FitConnect fitConnect) {
this.fitConnect = fitConnect;
}
private ReplyChannel(final IdBundDeMailbox idBundDeMailbox) {
this.idBundDeMailbox = idBundDeMailbox;
}
/**
* Set a postbox address of an interoperable service account (FINK) as reply channel.
*
* @param finkPostboxRef unique identifier of the fink postbox
* @param host url of the service account
* @return the {@link ReplyChannel}
*/
public static ReplyChannel ofFink(final String finkPostboxRef, final String host) {
return new ReplyChannel(new Fink(finkPostboxRef, host));
}
/**
* Set email with PGP-key as reply channel.
*
* @param address email address
* @param pgpPublicKey public pgp key
* @return the {@link ReplyChannel}
* @see Reply Channel Creation
*/
public static ReplyChannel ofEmailWithPgp(final String address, final String pgpPublicKey) {
return new ReplyChannel(new Email(address, true, pgpPublicKey));
}
/**
* Set email as reply channel.
*
* @param address email address
* @return the {@link ReplyChannel}
*/
public static ReplyChannel ofEmail(final String address) {
return new ReplyChannel(new Email(address, false, null));
}
/**
* Set deMail as reply channel.
*
* @param address email address
* @return the {@link ReplyChannel}
*/
public static ReplyChannel ofDeMail(final String address) {
return new ReplyChannel(new DeMail(address));
}
/**
* Set an elster account as reply channel.
*
* @param accountId elster account id
* @param deliveryTicket elster delivery ticket
* @param reference elster reference
* @return the {@link ReplyChannel}
*/
public static ReplyChannel ofElster(final String accountId, final String deliveryTicket, final String reference) {
return new ReplyChannel(new Elster(accountId, deliveryTicket, reference));
}
/**
* Set FIT-Connect as reply channel.
*
* @param encryptionKey JWK of the public encryption key the reply sender can encrypt the reply data with
* @param processStandards list of URIs that reference a data processing standard
* @return the {@link ReplyChannel}
*/
public static ReplyChannel ofFitConnect(final JWK encryptionKey, final List processStandards) {
return new ReplyChannel(new FitConnect(EncryptionPublicKey.fromJwk(encryptionKey), processStandards));
}
/**
* Set a mailboxId for id.bund.de as reply channel.
*
* @param mailboxId postkorbHandle of the bund id mailbox
* @return the {@link ReplyChannel}
*/
public static ReplyChannel ofIdBundDeMailbox(final UUID mailboxId) {
return new ReplyChannel(new IdBundDeMailbox(mailboxId));
}
/**
* Checks if reply channel type is DeMail.
*
* @return true or false
*/
public boolean isDeMail() {
return this.deMail != null;
}
/**
* Checks if reply channel type is Elster.
*
* @return true or false
*/
public boolean isElster() {
return this.elster != null;
}
/**
* Checks if reply channel type is eMail.
*
* @return true or false
*/
public boolean isEMail() {
return this.eMail != null;
}
/**
* Checks if reply channel type is Fink.
*
* @return true or false
*/
public boolean isFink() {
return this.fink != null;
}
/**
* Checks if reply channel type is FIT-Connect.
*
* @return true or false
*/
public boolean isFitConnect() {
return this.fitConnect != null;
}
/**
* Checks if reply channel type is IdBundDeId.
*
* @return true or false
*/
public boolean isIdBundDeMailbox() {
return this.idBundDeMailbox != null;
}
}