Please wait. This can take some minutes ...
Many resources are needed to download a project. Please understand that we have to compensate our server costs. Thank you in advance.
Project price only 1 $
You can buy this project and download/modify it how often you want.
org.apache.brooklyn.rest.domain.TaskSummary Maven / Gradle / Ivy
/*
* 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 org.apache.brooklyn.rest.domain;
import java.io.Serializable;
import java.net.URI;
import java.util.ArrayList;
import java.util.Collection;
import java.util.List;
import java.util.Map;
import java.util.Objects;
import java.util.Set;
import org.apache.brooklyn.util.collections.Jsonya;
import com.fasterxml.jackson.annotation.JsonIgnore;
import com.fasterxml.jackson.annotation.JsonInclude;
import com.fasterxml.jackson.annotation.JsonInclude.Include;
import com.fasterxml.jackson.annotation.JsonProperty;
import com.google.common.collect.ImmutableList;
import com.google.common.collect.ImmutableMap;
public class TaskSummary implements HasId, Serializable {
private static final long serialVersionUID = 4637850742127078158L;
private final String id;
private final String displayName;
private final String entityId;
private final String entityDisplayName;
private final String description;
private final Collection tags;
private final Long submitTimeUtc;
private final Long startTimeUtc;
private final Long endTimeUtc;
private final String currentStatus;
private final Object result;
private final boolean isError;
private final boolean isCancelled;
private final List children;
private final LinkWithMetadata submittedByTask;
@JsonInclude(Include.NON_NULL)
private final LinkWithMetadata blockingTask;
@JsonInclude(Include.NON_NULL)
private final String blockingDetails;
private final String detailedStatus;
@JsonInclude(Include.NON_NULL)
private final Map streams;
private final Map links;
public TaskSummary(
@JsonProperty("id") String id,
@JsonProperty("displayName") String displayName,
@JsonProperty("description") String description,
@JsonProperty("entityId") String entityId,
@JsonProperty("entityDisplayName") String entityDisplayName,
@JsonProperty("tags") Set tags,
@JsonProperty("submitTimeUtc") Long submitTimeUtc,
@JsonProperty("startTimeUtc") Long startTimeUtc,
@JsonProperty("endTimeUtc") Long endTimeUtc,
@JsonProperty("currentStatus") String currentStatus,
@JsonProperty("result") Object result,
@JsonProperty("isError") boolean isError,
@JsonProperty("isCancelled") boolean isCancelled,
@JsonProperty("children") List children,
@JsonProperty("submittedByTask") LinkWithMetadata submittedByTask,
@JsonProperty("blockingTask") LinkWithMetadata blockingTask,
@JsonProperty("blockingDetails") String blockingDetails,
@JsonProperty("detailedStatus") String detailedStatus,
@JsonProperty("streams") Map streams,
@JsonProperty("links") Map links) {
this.id = id;
this.displayName = displayName;
this.description = description;
this.entityId = entityId;
this.entityDisplayName = entityDisplayName;
this.tags = (tags == null) ? ImmutableList.of() : ImmutableList. copyOf(tags);
this.submitTimeUtc = submitTimeUtc;
this.startTimeUtc = startTimeUtc;
this.endTimeUtc = endTimeUtc;
this.currentStatus = currentStatus;
this.result = result;
this.isError = isError;
this.isCancelled = isCancelled;
this.children = children;
this.blockingDetails = blockingDetails;
this.blockingTask = blockingTask;
this.submittedByTask = submittedByTask;
this.detailedStatus = detailedStatus;
this.streams = streams;
this.links = (links == null) ? ImmutableMap. of() : ImmutableMap.copyOf(links);
}
@Override
public String getId() {
return id;
}
public String getDisplayName() {
return displayName;
}
public String getDescription() {
return description;
}
public String getEntityId() {
return entityId;
}
public String getEntityDisplayName() {
return entityDisplayName;
}
public Collection getTags() {
List result = new ArrayList();
for (Object t : tags) {
// TODO if we had access to a mapper we could use it to give better json
result.add(Jsonya.convertToJsonPrimitive(t));
}
return result;
}
@JsonIgnore
public Collection getRawTags() {
return tags;
}
public Long getSubmitTimeUtc() {
return submitTimeUtc;
}
public Long getStartTimeUtc() {
return startTimeUtc;
}
public Long getEndTimeUtc() {
return endTimeUtc;
}
public String getCurrentStatus() {
return currentStatus;
}
public Object getResult() {
return result;
}
public boolean isError() {
return isError;
}
public boolean isCancelled() {
return isCancelled;
}
public List getChildren() {
return children;
}
public LinkWithMetadata getSubmittedByTask() {
return submittedByTask;
}
public LinkWithMetadata getBlockingTask() {
return blockingTask;
}
public String getBlockingDetails() {
return blockingDetails;
}
public String getDetailedStatus() {
return detailedStatus;
}
public Map getStreams() {
return streams;
}
public Map getLinks() {
return links;
}
@Override
public boolean equals(Object o) {
if (this == o) return true;
if (!(o instanceof TaskSummary)) return false;
TaskSummary that = (TaskSummary) o;
return isError == that.isError &&
isCancelled == that.isCancelled &&
Objects.equals(id, that.id) &&
Objects.equals(displayName, that.displayName) &&
Objects.equals(entityId, that.entityId) &&
Objects.equals(entityDisplayName, that.entityDisplayName) &&
Objects.equals(description, that.description) &&
Objects.equals(tags, that.tags) &&
Objects.equals(submitTimeUtc, that.submitTimeUtc) &&
Objects.equals(startTimeUtc, that.startTimeUtc) &&
Objects.equals(endTimeUtc, that.endTimeUtc) &&
Objects.equals(currentStatus, that.currentStatus) &&
Objects.equals(result, that.result) &&
Objects.equals(children, that.children) &&
Objects.equals(submittedByTask, that.submittedByTask) &&
Objects.equals(blockingTask, that.blockingTask) &&
Objects.equals(blockingDetails, that.blockingDetails) &&
Objects.equals(detailedStatus, that.detailedStatus) &&
Objects.equals(streams, that.streams) &&
Objects.equals(links, that.links);
}
@Override
public int hashCode() {
return Objects.hash(id, displayName, entityId, entityDisplayName, description, tags, submitTimeUtc, startTimeUtc, endTimeUtc, currentStatus, result, isError, isCancelled, children, submittedByTask, blockingTask, blockingDetails, detailedStatus, streams, links);
}
@Override
public String toString() {
return "TaskSummary{" +
"id='" + id + '\'' +
", displayName='" + displayName + '\'' +
", entityId='" + entityId + '\'' +
", entityDisplayName='" + entityDisplayName + '\'' +
", description='" + description + '\'' +
", tags=" + tags +
", submitTimeUtc=" + submitTimeUtc +
", startTimeUtc=" + startTimeUtc +
", endTimeUtc=" + endTimeUtc +
", currentStatus='" + currentStatus + '\'' +
", result=" + result +
", isError=" + isError +
", isCancelled=" + isCancelled +
", children=" + children +
", submittedByTask=" + submittedByTask +
", blockingTask=" + blockingTask +
", blockingDetails='" + blockingDetails + '\'' +
", detailedStatus='" + detailedStatus + '\'' +
", streams=" + streams +
", links=" + links +
'}';
}
}