Commit 774673a3 authored by Mohamed Khalil Labidi's avatar Mohamed Khalil Labidi
Browse files

Merge branch 'fix-86' into 'proactive-dev'

Filter hardware types according to jclouds supported ones

See merge request !137
parents d3c1ddb8 bbfabae4
......@@ -168,8 +168,15 @@ public class PAGateway {
* @return the list of all available hardware
public List<Hardware> getHardwareList() {
return EntityManagerHelper.createQuery("SELECT hw FROM Hardware hw",
List<Hardware> allHardwares = EntityManagerHelper.createQuery("SELECT hw FROM Hardware hw",
return -> JCloudsInstancesUtils.isHandledHardwareInstanceType(
......@@ -5,12 +5,15 @@ import com.fasterxml.jackson.annotation.JsonProperty;
import com.fasterxml.jackson.annotation.JsonValue;
import lombok.AllArgsConstructor;
import lombok.NoArgsConstructor;
import org.activeeon.morphemic.service.EntityManagerHelper;
import org.hibernate.annotations.GenericGenerator;
import javax.persistence.*;
import java.util.List;
import java.util.Locale;
import java.util.Objects;
import java.util.Optional;
......@@ -296,6 +299,19 @@ public class NodeCandidate implements Serializable {
return nodeCandidateType.value.equals("BYON");
* Find the first node candidate that
* @param hardware A given stored hardware
* @return The first found node candidate that uses the given hardware
public static NodeCandidate findFirstNodeCandidateWithHardware(Hardware hardware) {
List<NodeCandidate> nodeCandidates = EntityManagerHelper.createQuery("SELECT nc FROM NodeCandidate nc",
Optional<NodeCandidate> optNodeCandidate =
.filter(nodeCandidate -> hardware.equals(nodeCandidate.getHardware())).findFirst();
return optNodeCandidate.orElse(null);
public boolean equals(java.lang.Object o) {
if (this == o) {
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment