Skip to content

Commit

Permalink
#169 - Added Lombok to domain objects
Browse files Browse the repository at this point in the history
  • Loading branch information
gazbert committed Nov 12, 2024
1 parent d76e5fc commit 58c6b7a
Show file tree
Hide file tree
Showing 18 changed files with 60 additions and 811 deletions.
3 changes: 3 additions & 0 deletions bxbot-domain-objects/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,9 @@ dependencies {
implementation libraries.hibernate_validator_annotation_processor
implementation libraries.springdoc_openapi_ui

compileOnly libraries.lombok
annotationProcessor libraries.lombok

testImplementation libraries.spring_boot_starter_test
}

Expand Down
4 changes: 4 additions & 0 deletions bxbot-domain-objects/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -43,6 +43,10 @@
<groupId>org.springdoc</groupId>
<artifactId>springdoc-openapi-starter-webmvc-ui</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
</dependency>

<!--
Testing dependencies
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@

package com.gazbert.bxbot.domain.bot;

import com.google.common.base.MoreObjects;
import io.swagger.v3.oas.annotations.media.Schema;
import java.util.Date;
import lombok.Data;

/**
* Domain object representing the Bot's status.
*
* @author gazbert
*/
@Data
@Schema
public class BotStatus {

Expand Down Expand Up @@ -67,60 +68,6 @@ public BotStatus(String botId, String displayName, String status, Date datetime)
setDatetime(datetime);
}

/**
* Returns the bot id.
*
* @return the bot id.
*/
public String getBotId() {
return botId;
}

/**
* Sets the bot id.
*
* @param botId the bot id.
*/
public void setBotId(String botId) {
this.botId = botId;
}

/**
* Returns the display name.
*
* @return the display name.
*/
public String getDisplayName() {
return displayName;
}

/**
* Sets the display name.
*
* @param displayName the display name.
*/
public void setDisplayName(String displayName) {
this.displayName = displayName;
}

/**
* Returns the status.
*
* @return the status.
*/
public String getStatus() {
return status;
}

/**
* Sets the status.
*
* @param status the status.
*/
public void setStatus(String status) {
this.status = status;
}

/**
* Returns the datetime.
*
Expand All @@ -138,14 +85,4 @@ public Date getDatetime() {
public void setDatetime(Date datetime) {
this.datetime = datetime != null ? new Date(datetime.getTime()) : null;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("botId", botId)
.add("displayName", displayName)
.add("status", status)
.add("datetime", getDatetime())
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,16 @@

package com.gazbert.bxbot.domain.emailalerts;

import com.google.common.base.MoreObjects;
import io.swagger.v3.oas.annotations.media.Schema;
import lombok.Data;

/**
* Domain object representing the Email Alerts config.
*
* @author gazbert
*/
@Schema
@Data
public class EmailAlertsConfig {

@Schema(
Expand Down Expand Up @@ -59,48 +60,4 @@ public EmailAlertsConfig(boolean enabled, SmtpConfig smtpConfig) {
this.enabled = enabled;
this.smtpConfig = smtpConfig;
}

/**
* Returns alerts enabled.
*
* @return alerts enabled.
*/
public boolean isEnabled() {
return enabled;
}

/**
* Sets alerts enabled.
*
* @param enabled alerts enabled.
*/
public void setEnabled(boolean enabled) {
this.enabled = enabled;
}

/**
* Returns the SMTP config.
*
* @return the SMTP config.
*/
public SmtpConfig getSmtpConfig() {
return smtpConfig;
}

/**
* Sets the SMTP config.
*
* @param smtpConfig the SMTP config.
*/
public void setSmtpConfig(SmtpConfig smtpConfig) {
this.smtpConfig = smtpConfig;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("enabled", enabled)
.add("smtpConfig", smtpConfig)
.toString();
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -23,16 +23,18 @@

package com.gazbert.bxbot.domain.emailalerts;

import com.google.common.base.MoreObjects;
import io.swagger.v3.oas.annotations.media.Schema;
import jakarta.validation.constraints.Email;
import jakarta.validation.constraints.Positive;
import lombok.Data;
import lombok.ToString;

/**
* Domain object representing the SMTP config used for Email Alerts.
*
* @author gazbert
*/
@Data
@Schema(requiredMode = Schema.RequiredMode.REQUIRED)
public class SmtpConfig {

Expand All @@ -51,6 +53,7 @@ public class SmtpConfig {
@Schema(
requiredMode = Schema.RequiredMode.REQUIRED,
description = "The sender email account password.")
@ToString.Exclude
private String accountPassword;

@Schema(requiredMode = Schema.RequiredMode.REQUIRED, description = "The email From address.")
Expand Down Expand Up @@ -91,124 +94,4 @@ public SmtpConfig(
this.fromAddress = fromAddress;
this.toAddress = toAddress;
}

/**
* Returns the host.
*
* @return the host.
*/
public String getHost() {
return host;
}

/**
* Sets the host.
*
* @param host the host.
*/
public void setHost(String host) {
this.host = host;
}

/**
* Returns the TLS port.
*
* @return the TLS port.
*/
public int getTlsPort() {
return tlsPort;
}

/**
* Sets the TLS port.
*
* @param tlsPort the TLS port.
*/
public void setTlsPort(int tlsPort) {
this.tlsPort = tlsPort;
}

/**
* Returns the account username.
*
* @return the account username.
*/
public String getAccountUsername() {
return accountUsername;
}

/**
* Sets the account username.
*
* @param accountUsername the account username.
*/
public void setAccountUsername(String accountUsername) {
this.accountUsername = accountUsername;
}

/**
* Returns the account password.
*
* @return the account password.
*/
public String getAccountPassword() {
return accountPassword;
}

/**
* Sets the account password.
*
* @param accountPassword the account password.
*/
public void setAccountPassword(String accountPassword) {
this.accountPassword = accountPassword;
}

/**
* Returns the from address.
*
* @return the from address.
*/
public String getFromAddress() {
return fromAddress;
}

/**
* Sets the from address.
*
* @param fromAddress the from address.
*/
public void setFromAddress(String fromAddress) {
this.fromAddress = fromAddress;
}

/**
* Returns the to address.
*
* @return the to address.
*/
public String getToAddress() {
return toAddress;
}

/**
* Sets the to address.
*
* @param toAddress the to address.
*/
public void setToAddress(String toAddress) {
this.toAddress = toAddress;
}

@Override
public String toString() {
return MoreObjects.toStringHelper(this)
.add("host", host)
.add("tlsPort", tlsPort)
.add("accountUsername", accountUsername)
// accountPassword is not included
.add("fromAddress", fromAddress)
.add("toAddress", toAddress)
.toString();
}
}
Loading

0 comments on commit 58c6b7a

Please sign in to comment.