@Override public boolean equals(Object o) { if (!(o instanceof PartialTemplate)) { return false; } PartialTemplate other = (PartialTemplate) o; return super.equals(other) && Objects.equal(immutable, other.immutable); }
@Override public int hashCode() { return Objects.hashCode(super.hashCode(), compatibilities, constraints, administration, links); }
@Override protected void addChildFields(T template, JsonObject jsonObj, JsonSerializationContext context) { jsonObj.add(DEFAULTS_KEY, context.serialize(template.getClusterDefaults())); jsonObj.add(COMPATIBILITY_KEY, context.serialize(template.getCompatibilities())); jsonObj.add(CONSTRAINTS_KEY, context.serialize(template.getConstraints())); jsonObj.add(ADMINISTRATION_KEY, context.serialize(template.getAdministration())); jsonObj.add(LINKS_KEY, context.serialize(template.getLinks())); }
private <T extends AbstractTemplate> boolean validateTemplate(T template, HttpResponder responder) { long initial = template.getAdministration().getLeaseDuration().getInitial(); initial = initial == 0 ? Long.MAX_VALUE : initial; long max = template.getAdministration().getLeaseDuration().getMax(); max = max == 0 ? Long.MAX_VALUE : max; if (max < initial) { responder.sendString(HttpResponseStatus.BAD_REQUEST, "Initial lease duration cannot be more than max lease duration for template " + template.getName()); return false; } return true; } }
@Override public boolean equals(Object o) { if (!(o instanceof ClusterTemplate)) { return false; } ClusterTemplate other = (ClusterTemplate) o; return super.equals(other) && Objects.equal(includes, other.includes) && Objects.equal(parent, other.parent); }
@Override public int hashCode() { return Objects.hashCode(super.hashCode(), compatibilities, constraints, administration, links); }