|
1 | 1 | /*
|
2 |
| - * Copyright 2020 Netflix, Inc. |
3 |
| - * <p> |
4 |
| - * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
5 |
| - * the License. You may obtain a copy of the License at |
6 |
| - * <p> |
7 |
| - * http://www.apache.org/licenses/LICENSE-2.0 |
8 |
| - * <p> |
9 |
| - * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
10 |
| - * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
11 |
| - * specific language governing permissions and limitations under the License. |
| 2 | + * Copyright 2021 Netflix, Inc. |
| 3 | + * <p> |
| 4 | + * Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with |
| 5 | + * the License. You may obtain a copy of the License at |
| 6 | + * <p> |
| 7 | + * http://www.apache.org/licenses/LICENSE-2.0 |
| 8 | + * <p> |
| 9 | + * Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on |
| 10 | + * an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the |
| 11 | + * specific language governing permissions and limitations under the License. |
12 | 12 | */
|
13 | 13 | package com.netflix.conductor.common.run;
|
14 | 14 |
|
|
18 | 18 | import com.netflix.conductor.common.metadata.Auditable;
|
19 | 19 | import com.netflix.conductor.common.metadata.tasks.Task;
|
20 | 20 | import com.netflix.conductor.common.metadata.workflow.WorkflowDef;
|
| 21 | +import org.apache.commons.lang3.StringUtils; |
21 | 22 |
|
22 | 23 | import javax.validation.constraints.Max;
|
23 | 24 | import javax.validation.constraints.Min;
|
@@ -485,6 +486,10 @@ public void setLastRetriedTime(long lastRetriedTime) {
|
485 | 486 | this.lastRetriedTime = lastRetriedTime;
|
486 | 487 | }
|
487 | 488 |
|
| 489 | + public boolean hasParent() { |
| 490 | + return StringUtils.isNotEmpty(parentWorkflowId); |
| 491 | + } |
| 492 | + |
488 | 493 | public Task getTaskByRefName(String refName) {
|
489 | 494 | if (refName == null) {
|
490 | 495 | throw new RuntimeException(
|
@@ -541,6 +546,14 @@ public String toString() {
|
541 | 546 | return getWorkflowName() + "." + getWorkflowVersion() + "/" + workflowId + "." + status;
|
542 | 547 | }
|
543 | 548 |
|
| 549 | + /** |
| 550 | + * A string representation of all relevant fields that identify this workflow. |
| 551 | + * Intended for use in log and other system generated messages. |
| 552 | + */ |
| 553 | + public String identifierString() { |
| 554 | + return String.format("%s.%s/%s", getWorkflowName(), getWorkflowVersion(), workflowId); |
| 555 | + } |
| 556 | + |
544 | 557 | @Override
|
545 | 558 | public boolean equals(Object o) {
|
546 | 559 | if (this == o) {
|
|
0 commit comments