Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions samples/xapi-server/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,14 @@

This sample demonstrates how the xAPI model can be used in applications that receive xAPI statements.

## Lombok Usage

This sample uses [Project Lombok](https://projectlombok.org/) to reduce boilerplate code in the `StatementEntity` class. Lombok annotations such as `@Data`, `@NoArgsConstructor`, and `@AllArgsConstructor` automatically generate getters, setters, constructors, and other common methods at compile time. This demonstrates best practices for using Lombok in xAPI-based applications and makes it easier for contributors to get started.

If you're using an IDE, you may need to install the Lombok plugin and enable annotation processing for proper IDE support.

## Running the Server

The server can be run with the following command:

```bash
Expand Down
22 changes: 22 additions & 0 deletions samples/xapi-server/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,11 @@
<artifactId>hypersistence-utils-hibernate-70</artifactId>
<version>3.13.2</version>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-devtools</artifactId>
Expand All @@ -38,4 +43,21 @@
<scope>test</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,10 @@
import jakarta.persistence.Entity;
import jakarta.persistence.Id;
import java.util.UUID;
import lombok.AllArgsConstructor;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.Type;

/**
Expand All @@ -18,62 +22,15 @@
* @author Thomas Turrell-Croft
*/
@Entity
@Getter
@Setter
@NoArgsConstructor
@AllArgsConstructor
public class StatementEntity {

@Id private UUID id;

@Type(JsonType.class)
@Column(columnDefinition = "BLOB")
private JsonNode statement;

/** StatementEntity Constructor. */
public StatementEntity() {}

/**
* StatementEntity Constructor.
*
* @param id the statement id
* @param statement the statement as JSON
*/
public StatementEntity(UUID id, JsonNode statement) {

this.id = id;
this.statement = statement;
}

/**
* Gets the id.
*
* @return the id
*/
public UUID getId() {
return id;
}

/**
* Sets the id.
*
* @param id the id to set
*/
public void setId(UUID id) {
this.id = id;
}

/**
* Gets the statement.
*
* @return the statement
*/
public JsonNode getStatement() {
return statement;
}

/**
* Sets the statement.
*
* @param statement the statement to set
*/
public void setStatement(JsonNode statement) {
this.statement = statement;
}
}
4 changes: 0 additions & 4 deletions xapi-model-spring-boot-starter/lombok.config

This file was deleted.

23 changes: 0 additions & 23 deletions xapi-model-spring-boot-starter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -39,16 +39,6 @@
<groupId>dev.learning.xapi</groupId>
<artifactId>xapi-model</artifactId>
</dependency>
<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>
<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-test</artifactId>
<scope>test</scope>
</dependency>
</dependencies>

<build>
Expand All @@ -57,19 +47,6 @@
<groupId>org.jacoco</groupId>
<artifactId>jacoco-maven-plugin</artifactId>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-compiler-plugin</artifactId>
<configuration>
<annotationProcessorPaths>
<path>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<version>${lombok.version}</version>
</path>
</annotationProcessorPaths>
</configuration>
</plugin>
</plugins>
</build>

Expand Down

This file was deleted.