@Override public int hashCode() { return getForestId() != null ? getForestId().hashCode() : 0; } }
public ForestConfigurationImpl readForestConfig() { List<ForestImpl> forests = new ArrayList<>(); JsonNode results = ((DatabaseClientImpl) client).getServices() .getResource(null, "internal/forestinfo", null, null, new JacksonHandle()) .get(); for ( JsonNode forestNode : results ) { String id = forestNode.get("id").asText(); String name = forestNode.get("name").asText(); String database = forestNode.get("database").asText(); String host = forestNode.get("host").asText(); String openReplicaHost = null; if ( forestNode.get("openReplicaHost") != null ) openReplicaHost = forestNode.get("openReplicaHost").asText(); String requestHost = null; if ( forestNode.get("requestHost") != null ) requestHost = forestNode.get("requestHost").asText(); String alternateHost = null; if ( forestNode.get("alternateHost") != null ) alternateHost = forestNode.get("alternateHost").asText(); // Since we added the forestinfo end point to populate both alternateHost and requestHost // in case we have a requestHost so that we don't break the existing API code, we will make the // alternateHost as null if both alternateHost and requestHost is set. if ( requestHost != null && alternateHost != null ) alternateHost = null; boolean isUpdateable = "all".equals(forestNode.get("updatesAllowed").asText()); boolean isDeleteOnly = false; // TODO: get this for real after we start using a REST endpoint forests.add( new ForestImpl(host, openReplicaHost, requestHost, alternateHost, database, name, id, isUpdateable, isDeleteOnly) ); } return new ForestConfigurationImpl(forests.toArray(new ForestImpl[forests.size()])); }
host = renames.get(host); return new ForestImpl(host, openReplicaHost, requestHost, alternateHost, forest.getDatabaseName(), forest.getForestName(), forest.getForestId(), forest.isUpdateable(), false); }).toArray(Forest[]::new); if(requestHost != null) requestHost = host; return new ForestImpl(host, openReplicaHost, requestHost, alternateHost, forest.getDatabaseName(), forest.getForestName(), forest.getForestId(), forest.isUpdateable(), false); } else { host = replaceHost(host, validHosts); return new ForestImpl(host, openReplicaHost, requestHost, alternateHost, forest.getDatabaseName(), forest.getForestName(), forest.getForestId(), forest.isUpdateable(), false); } else {
@Override public boolean equals(Object obj) { if ( obj == null ) return false; if ( ! (obj instanceof ForestImpl) ) return false; ForestImpl forestObj = (ForestImpl) obj; return getForestId().equals(forestObj.getForestId()); }