Start line:  
End line:  

Snippet Preview

Snippet HTML Code

Stack Overflow Questions
  /*
   * Copyright (c) 2014 Spotify AB.
   *
   * Licensed to the Apache Software Foundation (ASF) under one
   * or more contributor license agreements.  See the NOTICE file
   * distributed with this work for additional information
   * regarding copyright ownership.  The ASF licenses this file
   * to you under the Apache License, Version 2.0 (the
   * "License"); you may not use this file except in compliance
  * with the License.  You may obtain a copy of the License at
  *
  *   http://www.apache.org/licenses/LICENSE-2.0
  *
  * Unless required by applicable law or agreed to in writing,
  * software distributed under the License is distributed on an
  * "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
  * KIND, either express or implied.  See the License for the
  * specific language governing permissions and limitations
  * under the License.
  */
 
 package com.spotify.helios.common.descriptors;
 
 
 
 import static com.google.common.base.Preconditions.checkNotNull;

Represents something that has happened to a deployment group. A typical JSON representation of an event might be:
 {
   "action" : DEPLOY_NEW_JOB,
   "target": "myhost"
   "rolloutTaskStatus" : OK,
   "deploymentGroup" : { #... see definition of DeploymentGroup },
   "deploymentGroupState" : ROLLING_OUT,
   "timestamp" : 1410308461448
 }
 
 
 @JsonIgnoreProperties(ignoreUnknown = true)
 public class DeploymentGroupEvent extends Descriptor {
 
   public static final String KAFKA_TOPIC = "HeliosDeploymentGroupEvents";
 
   private final RolloutTask.Action action;
   private final String target;
   private final RolloutTask.Status rolloutTaskStatus;
   private final DeploymentGroup deploymentGroup;
   private final long timestamp;

  
Constructor.

Parameters:
action RolloutTask.Action.
target The target of the action.
rolloutTaskStatus The status of the task at the point of the event. See RolloutTask.Status
deploymentGroup DeploymentGroup
deploymentGroupState DeploymentGroupStatus.State
timestamp The timestamp of the event.
 
   public DeploymentGroupEvent(
       @JsonProperty("action"final RolloutTask.Action action,
       @JsonProperty("target"final String target,
       @JsonProperty("rolloutTaskStatus"final RolloutTask.Status rolloutTaskStatus,
       @JsonProperty("deploymentGroup"final DeploymentGroup deploymentGroup,
       @JsonProperty("deploymentGroupState"final DeploymentGroupStatus.State deploymentGroupState,
       @JsonProperty("timestamp"final long timestamp) {
     this. = action;
     this. = target;
     this. = rolloutTaskStatus;
     this. = deploymentGroup;
     this. = deploymentGroupState;
     this. = timestamp;
   }
 
   private DeploymentGroupEvent(final Builder builder) {
     this. = checkNotNull(builder.deploymentGroup);
     this. = checkNotNull(builder.deploymentGroupState);
 
     // Optional
     this. = builder.action;
     this. = builder.target;
     this. = builder.rolloutTaskStatus;
     this. = builder.timestamp != null ? builder.timestamp : System.currentTimeMillis();
   }
 
   public RolloutTask.Action getAction() {
     return ;
   }
 
   public String getTarget() {
    return ;
  }
    return ;
  }
    return ;
  }
    return ;
  }
  public long getTimestamp() {
    return ;
  }
  public static Builder newBuilder() {
    return new Builder();
  }
  public static class Builder {
    private RolloutTask.Action action;
    private String target;
    private Long timestamp;
    public Builder setAction(final RolloutTask.Action action) {
      this. = action;
      return this;
    }
    public Builder setTarget(final String target) {
      this. = target;
      return this;
    }
    public Builder setRolloutTaskStatus(final RolloutTask.Status rolloutTaskStatus) {
      this. = rolloutTaskStatus;
      return this;
    }
    public Builder setDeploymentGroup(final DeploymentGroup deploymentGroup) {
      this. = deploymentGroup;
      return this;
    }
    public Builder setDeploymentGroupState(final DeploymentGroupStatus.State deploymentGroupState) {
      this. = deploymentGroupState;
      return this;
    }
    public Builder setTimestamp(final long timestamp) {
      this. = timestamp;
      return this;
    }
    public DeploymentGroupEvent build() {
      return new DeploymentGroupEvent(this);
    }
  }
  public String toString() {
    return Objects.toStringHelper(DeploymentGroupEvent.class)
        .add("action")
        .add("target")
        .add("rolloutTaskStatus")
        .add("deploymentGroup")
        .add("deploymentGroupState")
        .add("timestamp")
        .toString();
  }
  public boolean equals(Object o) {
    if (this == o) {
      return true;
    }
    if (o == null || getClass() != o.getClass()) {
      return false;
    }
    if ( != that.timestamp) {
      return false;
    }
    if ( != that.action) {
      return false;
    }
    if ( != null ? !.equals(that.target) : that.target != null) {
      return false;
    }
    if ( != that.rolloutTaskStatus) {
      return false;
    }
    if ( != null ? !.equals(that.deploymentGroup)
                                : that.deploymentGroup != null) {
      return false;
    }
    return  == that.deploymentGroupState;
  }
  public int hashCode() {
    int result =  != null ? .hashCode() : 0;
    result = 31 * result + ( != null ? .hashCode() : 0);
    result = 31 * result + ( != null ? .hashCode() : 0);
    result = 31 * result + ( != null ? .hashCode() : 0);
    result = 31 * result + ( != null ? .hashCode() : 0);
    result = 31 * result + (int) ( ^ ( >>> 32));
    return result;
  }
New to GrepCode? Check out our FAQ X