Skip to content

Commit

Permalink
add default logic to connection creation
Browse files Browse the repository at this point in the history
  • Loading branch information
pmossman committed Sep 26, 2022
1 parent 39998c0 commit a77e2ea
Showing 1 changed file with 7 additions and 1 deletion.
Original file line number Diff line number Diff line change
Expand Up @@ -121,11 +121,17 @@ public ConnectionRead createConnection(final ConnectionCreate connectionCreate)

final UUID connectionId = uuidGenerator.get();

// If not specified, default the NamespaceDefinition to 'source'
final NamespaceDefinitionType namespaceDefinitionType =
connectionCreate.getNamespaceDefinition() == null
? NamespaceDefinitionType.SOURCE
: Enums.convertTo(connectionCreate.getNamespaceDefinition(), NamespaceDefinitionType.class);

// persist sync
final StandardSync standardSync = new StandardSync()
.withConnectionId(connectionId)
.withName(connectionCreate.getName() != null ? connectionCreate.getName() : defaultName)
.withNamespaceDefinition(Enums.convertTo(connectionCreate.getNamespaceDefinition(), NamespaceDefinitionType.class))
.withNamespaceDefinition(namespaceDefinitionType)
.withNamespaceFormat(connectionCreate.getNamespaceFormat())
.withPrefix(connectionCreate.getPrefix())
.withSourceId(connectionCreate.getSourceId())
Expand Down

0 comments on commit a77e2ea

Please sign in to comment.