Skip to content
This repository has been archived by the owner on Dec 13, 2023. It is now read-only.

Commit

Permalink
Merge pull request #1437 from Netflix/summary_objects_equals_hashcode
Browse files Browse the repository at this point in the history
added equals and hashcode to summary objects
  • Loading branch information
apanicker-nflx committed Dec 9, 2019
2 parents 4e56485 + 730c230 commit b13b615
Show file tree
Hide file tree
Showing 2 changed files with 75 additions and 15 deletions.
@@ -1,4 +1,4 @@
/**
/*
* Copyright 2016 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,18 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
*/
package com.netflix.conductor.common.run;

import com.github.vmg.protogen.annotations.ProtoField;
import com.github.vmg.protogen.annotations.ProtoMessage;
import com.netflix.conductor.common.metadata.tasks.Task;
import com.netflix.conductor.common.metadata.tasks.Task.Status;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import java.util.TimeZone;

import com.github.vmg.protogen.annotations.*;
import com.netflix.conductor.common.metadata.tasks.Task;
import com.netflix.conductor.common.metadata.tasks.Task.Status;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down Expand Up @@ -408,4 +406,38 @@ public int getWorkflowPriority() {
public void setWorkflowPriority(int workflowPriority) {
this.workflowPriority = workflowPriority;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
TaskSummary that = (TaskSummary) o;
return getExecutionTime() == that.getExecutionTime() &&
getQueueWaitTime() == that.getQueueWaitTime() &&
getWorkflowPriority() == that.getWorkflowPriority() &&
getWorkflowId().equals(that.getWorkflowId()) &&
getWorkflowType().equals(that.getWorkflowType()) &&
Objects.equals(getCorrelationId(), that.getCorrelationId()) &&
getScheduledTime().equals(that.getScheduledTime()) &&
Objects.equals(getStartTime(), that.getStartTime()) &&
Objects.equals(getUpdateTime(), that.getUpdateTime()) &&
Objects.equals(getEndTime(), that.getEndTime()) &&
getStatus() == that.getStatus() &&
Objects.equals(getReasonForIncompletion(), that.getReasonForIncompletion()) &&
Objects.equals(getTaskDefName(), that.getTaskDefName()) &&
getTaskType().equals(that.getTaskType()) &&
getTaskId().equals(that.getTaskId());
}

@Override
public int hashCode() {
return Objects.hash(getWorkflowId(), getWorkflowType(), getCorrelationId(), getScheduledTime(), getStartTime(),
getUpdateTime(), getEndTime(), getStatus(), getReasonForIncompletion(), getExecutionTime(),
getQueueWaitTime(),
getTaskDefName(), getTaskType(), getTaskId(), getWorkflowPriority());
}
}
@@ -1,4 +1,4 @@
/**
/*
* Copyright 2016 Netflix, Inc.
*
* Licensed under the Apache License, Version 2.0 (the "License");
Expand All @@ -13,18 +13,16 @@
* See the License for the specific language governing permissions and
* limitations under the License.
*/
/**
*
*/
package com.netflix.conductor.common.run;

import com.github.vmg.protogen.annotations.ProtoField;
import com.github.vmg.protogen.annotations.ProtoMessage;
import com.netflix.conductor.common.run.Workflow.WorkflowStatus;
import java.text.SimpleDateFormat;
import java.util.Date;
import java.util.Objects;
import java.util.TimeZone;
import java.util.stream.Collectors;

import com.github.vmg.protogen.annotations.*;
import com.netflix.conductor.common.run.Workflow.WorkflowStatus;
import org.apache.commons.lang3.StringUtils;

/**
Expand Down Expand Up @@ -341,4 +339,34 @@ public int getPriority() {
public void setPriority(int priority) {
this.priority = priority;
}

@Override
public boolean equals(Object o) {
if (this == o) {
return true;
}
if (o == null || getClass() != o.getClass()) {
return false;
}
WorkflowSummary that = (WorkflowSummary) o;
return getVersion() == that.getVersion() &&
getExecutionTime() == that.getExecutionTime() &&
getPriority() == that.getPriority() &&
getWorkflowType().equals(that.getWorkflowType()) &&
getWorkflowId().equals(that.getWorkflowId()) &&
Objects.equals(getCorrelationId(), that.getCorrelationId()) &&
getStartTime().equals(that.getStartTime()) &&
getUpdateTime().equals(that.getUpdateTime()) &&
getEndTime().equals(that.getEndTime()) &&
getStatus() == that.getStatus() &&
Objects.equals(getReasonForIncompletion(), that.getReasonForIncompletion()) &&
Objects.equals(getEvent(), that.getEvent());
}

@Override
public int hashCode() {
return Objects
.hash(getWorkflowType(), getVersion(), getWorkflowId(), getCorrelationId(), getStartTime(), getUpdateTime(),
getEndTime(), getStatus(), getReasonForIncompletion(), getExecutionTime(), getEvent(), getPriority());
}
}

0 comments on commit b13b615

Please sign in to comment.