Skip to content

Commit

Permalink
Merge pull request #483 from gokulprathin8/lob-annotations
Browse files Browse the repository at this point in the history
Lombok annotations for JPA entity models
  • Loading branch information
gokulprathin8 authored Mar 25, 2024
2 parents a6e23de + c6b93c9 commit 056991e
Show file tree
Hide file tree
Showing 9 changed files with 173 additions and 598 deletions.
7 changes: 7 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,13 @@
<artifactId>spring-boot-starter-web</artifactId>
</dependency>


<dependency>
<groupId>org.projectlombok</groupId>
<artifactId>lombok</artifactId>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.thymeleaf.extras</groupId>
<artifactId>thymeleaf-extras-springsecurity5</artifactId>
Expand Down
83 changes: 22 additions & 61 deletions src/main/java/com/gw/jpa/Checkpoint.java
Original file line number Diff line number Diff line change
@@ -1,7 +1,5 @@
package com.gw.jpa;

import java.util.Date;
import java.util.UUID;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
Expand All @@ -14,22 +12,32 @@
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
import org.hibernate.annotations.GenericGenerator;
import org.hibernate.annotations.Type;

import java.util.Date;
import java.util.UUID;

@Entity
@Table(name = "WorkflowCheckpoint")
@Getter
@Setter
@NoArgsConstructor // Lombok annotations
public class Checkpoint {

@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Type(type = "uuid-char")
@Column(name = "id", columnDefinition = "VARCHAR(36)")
private UUID id;
@Id
@GeneratedValue(generator = "uuid2")
@GenericGenerator(name = "uuid2", strategy = "uuid2")
@Type(type = "uuid-char")
@Column(name = "id", columnDefinition = "VARCHAR(36)")
private UUID id;

@Column(name = "executionId")
private String executionId;
@Column(name = "executionId")
private String executionId;

@Lob
@Column(name = "edges", columnDefinition = "CLOB")
Expand All @@ -47,56 +55,9 @@ public class Checkpoint {
@Temporal(TemporalType.TIMESTAMP)
private Date createdAt;

public String getExecutionId() {
return executionId;
}

public void setExecutionId(String executionId) {
this.executionId = executionId;
}

public Date getCreatedAt() {
return createdAt;
}

public void setCreatedAt(Date createdAt) {
this.createdAt = createdAt;
}

@PrePersist
protected void onCreate() {
createdAt = new Date();
}

public UUID getId() {
return id;
}

public void setId(UUID id) {
this.id = id;
}

public String getEdges() {
return edges;
}

public void setEdges(String edges) {
this.edges = edges;
}

public String getNodes() {
return nodes;
}

public void setNodes(String nodes) {
this.nodes = nodes;
}

public Workflow getWorkflow() {
return workflow;
}
@PrePersist
protected void onCreate() {
createdAt = new Date();
}

public void setWorkflow(Workflow workflow) {
this.workflow = workflow;
}
}
92 changes: 17 additions & 75 deletions src/main/java/com/gw/jpa/Environment.java
Original file line number Diff line number Diff line change
@@ -1,90 +1,32 @@
package com.gw.jpa;

import com.fasterxml.jackson.annotation.JsonProperty;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.FetchType;
import javax.persistence.Id;
import javax.persistence.JoinColumn;
import javax.persistence.ManyToOne;

import com.fasterxml.jackson.annotation.JsonProperty;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

@Entity
@Getter
@Setter
@NoArgsConstructor
public class Environment {
@Id String id;

String name, type, bin, pyenv, basedir;

// String host;

@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "hostid")
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Host hostobj;

@Column(columnDefinition = "LONGTEXT")
String settings;

public Host getHostobj() {
return this.hostobj;
}

public void setHostobj(Host hostobj) {
this.hostobj = hostobj;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getType() {
return type;
}

public void setType(String type) {
this.type = type;
}

public String getBin() {
return bin;
}

public void setBin(String bin) {
this.bin = bin;
}

public String getPyenv() {
return pyenv;
}

public void setPyenv(String pyenv) {
this.pyenv = pyenv;
}

public String getBasedir() {
return basedir;
}
@Id
private String id;

public void setBasedir(String basedir) {
this.basedir = basedir;
}
private String name, type, bin, pyenv, basedir;

public String getSettings() {
return settings;
}
@ManyToOne(fetch = FetchType.LAZY)
@JoinColumn(name = "hostid")
@JsonProperty(access = JsonProperty.Access.WRITE_ONLY)
private Host hostobj;

public void setSettings(String settings) {
this.settings = settings;
}
@Column(columnDefinition = "LONGTEXT")
private String settings;
}
93 changes: 23 additions & 70 deletions src/main/java/com/gw/jpa/GWProcess.java
Original file line number Diff line number Diff line change
@@ -1,90 +1,43 @@
package com.gw.jpa;

import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;

import javax.persistence.Column;
import javax.persistence.Lob;
import javax.persistence.Entity;
import javax.persistence.Id;
import javax.persistence.Lob;

/**
* Process POJO
*
* @author jensensun
*
*/
@Entity
@Getter
@Setter
@NoArgsConstructor
public class GWProcess {

@Id String id;

String name;

@Lob
@Column(columnDefinition = "LONGTEXT")
String description;

@Lob
@Column(columnDefinition = "LONGTEXT")
String code;

String lang;

String owner;
@Id
private String id;

// true: private; false: public
String confidential;
private String name;

public String getOwner() {
return this.owner;
}
@Lob
@Column(columnDefinition = "LONGTEXT")
private String description;

public void setOwner(String owner) {
this.owner = owner;
}
@Lob
@Column(columnDefinition = "LONGTEXT")
private String code;

public String getConfidential() {
return this.confidential;
}
private String lang;

public void setConfidential(String confidential) {
this.confidential = confidential;
}
private String owner;

public String getLang() {
return this.lang;
}

public void setLang(String lang) {
this.lang = lang;
}

public String getId() {
return id;
}

public void setId(String id) {
this.id = id;
}

public String getName() {
return name;
}

public void setName(String name) {
this.name = name;
}

public String getDescription() {
return description;
}

public void setDescription(String description) {
this.description = description;
}

public String getCode() {
return code;
}

public void setCode(String code) {
this.code = code;
}
//true: private; false: public
private String confidential;
}

Loading

0 comments on commit 056991e

Please sign in to comment.