Skip to content

Commit c977085

Browse files
authored
Merge pull request #488 from Sudakatux/add_metadata
Adds metadata attribute
2 parents c866da7 + c501da5 commit c977085

File tree

3 files changed

+20
-0
lines changed

3 files changed

+20
-0
lines changed

common/src/main/java/com/netflix/conductor/common/metadata/workflow/WorkflowDef.java

Lines changed: 11 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -106,6 +106,9 @@ public enum TimeoutPolicy {
106106
@ProtoField(id = 21)
107107
private boolean enforceSchema = true;
108108

109+
@ProtoField(id = 22)
110+
private Map<String, Object> metadata = new HashMap<>();
111+
109112
public boolean isEnforceSchema() {
110113
return enforceSchema;
111114
}
@@ -366,6 +369,14 @@ public void setOutputSchema(SchemaDef outputSchema) {
366369
this.outputSchema = outputSchema;
367370
}
368371

372+
public Map<String, Object> getMetadata() {
373+
return metadata;
374+
}
375+
376+
public void setMetadata(Map<String, Object> metadata) {
377+
this.metadata = metadata;
378+
}
379+
369380
public boolean containsType(String taskType) {
370381
return collectTasks().stream().anyMatch(t -> t.getType().equals(taskType));
371382
}

grpc/src/main/java/com/netflix/conductor/grpc/AbstractProtoMapper.java

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1339,6 +1339,9 @@ public WorkflowDefPb.WorkflowDef toProto(WorkflowDef from) {
13391339
to.setOutputSchema( toProto( from.getOutputSchema() ) );
13401340
}
13411341
to.setEnforceSchema( from.isEnforceSchema() );
1342+
for (Map.Entry<String, Object> pair : from.getMetadata().entrySet()) {
1343+
to.putMetadata( pair.getKey(), toProto( pair.getValue() ) );
1344+
}
13421345
return to.build();
13431346
}
13441347

@@ -1382,6 +1385,11 @@ public WorkflowDef fromProto(WorkflowDefPb.WorkflowDef from) {
13821385
to.setOutputSchema( fromProto( from.getOutputSchema() ) );
13831386
}
13841387
to.setEnforceSchema( from.getEnforceSchema() );
1388+
Map<String, Object> metadataMap = new HashMap<String, Object>();
1389+
for (Map.Entry<String, Value> pair : from.getMetadataMap().entrySet()) {
1390+
metadataMap.put( pair.getKey(), fromProto( pair.getValue() ) );
1391+
}
1392+
to.setMetadata(metadataMap);
13851393
return to;
13861394
}
13871395

grpc/src/main/proto/model/workflowdef.proto

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -35,4 +35,5 @@ message WorkflowDef {
3535
SchemaDef input_schema = 19;
3636
SchemaDef output_schema = 20;
3737
bool enforce_schema = 21;
38+
map<string, google.protobuf.Value> metadata = 22;
3839
}

0 commit comments

Comments
 (0)