public static ComponentRevision fromRevision(final Revision revision) { final ComponentRevision componentRevision = new ComponentRevision(); componentRevision.setVersion(revision.getVersion()); componentRevision.setClientId(revision.getClientId()); componentRevision.setComponentId(revision.getComponentId()); return componentRevision; }
public Revision toRevision() { return new Revision(getVersion(), getClientId(), getComponentId()); }
@Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if ((obj instanceof ComponentRevision) == false) { return false; } ComponentRevision thatRevision = (ComponentRevision) obj; // ensure that component ID's are the same (including null) if (thatRevision.getComponentId() == null && getComponentId() != null) { return false; } if (thatRevision.getComponentId() != null && getComponentId() == null) { return false; } if (thatRevision.getComponentId() != null && !thatRevision.getComponentId().equals(getComponentId())) { return false; } if (this.version != null && this.version.equals(thatRevision.version)) { return true; } else { return clientId != null && !clientId.trim().isEmpty() && clientId.equals(thatRevision.getClientId()); } }
private ConnectionResponseMessage createConnectionResponse(final ConnectionRequest request, final NodeIdentifier resolvedNodeIdentifier, final DataFlow clusterDataFlow) { if (clusterDataFlow == null) { final ConnectionResponseMessage responseMessage = new ConnectionResponseMessage(); responseMessage.setConnectionResponse(new ConnectionResponse(5, "The cluster dataflow is not yet available")); return responseMessage; } // Set node's status to 'CONNECTING' NodeConnectionStatus status = getConnectionStatus(resolvedNodeIdentifier); if (status == null) { addNodeEvent(resolvedNodeIdentifier, "Connection requested from new node. Setting status to connecting."); } else { addNodeEvent(resolvedNodeIdentifier, "Connection requested from existing node. Setting status to connecting."); } status = new NodeConnectionStatus(resolvedNodeIdentifier, NodeConnectionState.CONNECTING, null, null, null, System.currentTimeMillis()); updateNodeStatus(status); final ConnectionResponse response = new ConnectionResponse(resolvedNodeIdentifier, clusterDataFlow, instanceId, getConnectionStatuses(), revisionManager.getAllRevisions().stream().map(rev -> ComponentRevision.fromRevision(rev)).collect(Collectors.toList())); final ConnectionResponseMessage responseMessage = new ConnectionResponseMessage(); responseMessage.setConnectionResponse(response); return responseMessage; }
@Override public boolean equals(final Object obj) { if (obj == null) { return false; } if (obj == this) { return true; } if ((obj instanceof ComponentRevision) == false) { return false; } ComponentRevision thatRevision = (ComponentRevision) obj; // ensure that component ID's are the same (including null) if (thatRevision.getComponentId() == null && getComponentId() != null) { return false; } if (thatRevision.getComponentId() != null && getComponentId() == null) { return false; } if (thatRevision.getComponentId() != null && !thatRevision.getComponentId().equals(getComponentId())) { return false; } if (this.version != null && this.version.equals(thatRevision.version)) { return true; } else { return clientId != null && !clientId.trim().isEmpty() && clientId.equals(thatRevision.getClientId()); } }
request.setComponentRevisions(revisionManager.getAllRevisions().stream().map(rev -> ComponentRevision.fromRevision(rev)).collect(Collectors.toList()));
public static ComponentRevision fromRevision(final Revision revision) { final ComponentRevision componentRevision = new ComponentRevision(); componentRevision.setVersion(revision.getVersion()); componentRevision.setClientId(revision.getClientId()); componentRevision.setComponentId(revision.getComponentId()); return componentRevision; }
public Revision toRevision() { return new Revision(getVersion(), getClientId(), getComponentId()); }