Skip to content

Commit

Permalink
adding lombok getters, setters, and EqualsAndHashCode
Browse files Browse the repository at this point in the history
  • Loading branch information
ankicabarisic committed Nov 27, 2024
1 parent 4705079 commit 558f6a1
Show file tree
Hide file tree
Showing 9 changed files with 92 additions and 1,175 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -10,22 +10,25 @@
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.*;
import lombok.experimental.Accessors;


/**
* Attributes defining an EDGE node
*/
@AllArgsConstructor
@NoArgsConstructor
@Accessors(chain = true)
@EqualsAndHashCode
@Getter
@Setter
@ToString(callSuper = true)
public class EdgeDefinition {

public static final String DEFAULT_PORT = "22";

public static final String ANY_JOB_ID = "any";

// Constants for JSON properties
public static final String JSON_NAME = "name";

public static final String JSON_LOGIN_CREDENTIAL = "loginCredential";
Expand Down
94 changes: 3 additions & 91 deletions sal-common/src/main/java/org/ow2/proactive/sal/model/EdgeNode.java
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@
import com.fasterxml.jackson.annotation.JsonProperty;

import lombok.AllArgsConstructor;
import lombok.EqualsAndHashCode;
import lombok.Getter;
import lombok.NoArgsConstructor;
import lombok.Setter;
Expand All @@ -25,9 +26,10 @@
@AllArgsConstructor
@NoArgsConstructor
@Entity
@Table(name = "EDGE_NODE")
@Getter
@Setter
@Table(name = "EDGE_NODE")
@EqualsAndHashCode
public class EdgeNode extends AbstractNode {

@Column(name = "NAME")
Expand Down Expand Up @@ -79,100 +81,10 @@ public class EdgeNode extends AbstractNode {
@JsonProperty(EdgeDefinition.JSON_JAR_URL)
private String jarURL = null;

public EdgeNode name(String name) {
this.setName(name);
return this;
}

public EdgeNode loginCredential(LoginCredential loginCredential) {
this.setLoginCredential(loginCredential);
return this;
}

public EdgeNode ipAddresses(List<IpAddress> ipAddresses) {
this.setIpAddresses(ipAddresses);
return this;
}

public EdgeNode addIpAddressesItem(IpAddress ipAddressesItem) {
this.addIpAddressesItem(ipAddressesItem);
return this;
}

public EdgeNode nodeProperties(NodeProperties nodeProperties) {
this.setNodeProperties(nodeProperties);
return this;
}

public EdgeNode reason(String reason) {
this.setReason(reason);
return this;
}

public EdgeNode diagnostic(String diagnostic) {
this.setDiagnostic(diagnostic);
return this;
}

public EdgeNode id(String id) {
this.setId(id);
return this;
}

public EdgeNode userId(String userId) {
this.setUserId(userId);
return this;
}

public EdgeNode allocated(Boolean allocated) {
this.setAllocated(allocated);
return this;
}

public String composeNodeSourceName() {
return "EDGE_NS_" + this.systemArch + "_" + this.id;
}

public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
EdgeNode edgeNode = (EdgeNode) o;
return Objects.equals(this.name, edgeNode.getName()) &&
Objects.equals(this.loginCredential, edgeNode.getLoginCredential()) &&
Objects.equals(this.ipAddresses, edgeNode.getIpAddresses()) &&
Objects.equals(this.nodeProperties, edgeNode.getNodeProperties()) &&
Objects.equals(this.reason, edgeNode.getReason()) &&
Objects.equals(this.diagnostic, edgeNode.getDiagnostic()) &&
Objects.equals(this.nodeCandidate, edgeNode.getNodeCandidate()) &&
Objects.equals(this.id, edgeNode.getId()) && Objects.equals(this.userId, edgeNode.getUserId()) &&
Objects.equals(this.allocated, edgeNode.getAllocated()) &&
Objects.equals(this.jobId, edgeNode.getJobId()) &&
Objects.equals(this.systemArch, edgeNode.getSystemArch()) &&
Objects.equals(this.scriptURL, edgeNode.getScriptURL()) && Objects.equals(jarURL, edgeNode.getJarURL());
}

@Override
public int hashCode() {
return Objects.hash(this.name,
this.id,
this.loginCredential,
this.ipAddresses,
this.nodeProperties,
this.reason,
this.diagnostic,
this.nodeProperties,
this.userId,
this.allocated,
this.jobId,
this.systemArch,
this.scriptURL,
this.jarURL);
}

@Override
public String toString() {
StringBuilder sb = new StringBuilder();
Expand Down
Loading

0 comments on commit 558f6a1

Please sign in to comment.