Skip to content

Commit

Permalink
Merge pull request #7026 from deutschebank/db-contrib/waltz-7022-phys…
Browse files Browse the repository at this point in the history
…ical-flow-registration-name-error

Physical flow registration name error
  • Loading branch information
davidwatkins73 authored Mar 8, 2024
2 parents 254a234 + e8614a5 commit ab3b04a
Show file tree
Hide file tree
Showing 6 changed files with 47 additions and 4 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ public class PhysicalFlowDao {
PhysicalFlowRecord record = r.into(PHYSICAL_FLOW);
return ImmutablePhysicalFlow.builder()
.id(record.getId())
.name(Optional.ofNullable(record.getName()).orElse(""))
.name(record.getName())
.provenance(record.getProvenance())
.specificationId(record.getSpecificationId())
.basisOffset(record.getBasisOffset())
Expand Down Expand Up @@ -197,7 +197,12 @@ public List<PhysicalFlow> findBySelector(Select<Record1<Long>> selector) {

public List<PhysicalFlow> findByAttributesAndSpecification(PhysicalFlow flow) {

Condition nameCondition = flow.name() == null
? PHYSICAL_FLOW.NAME.isNull()
:PHYSICAL_FLOW.NAME.eq(flow.name());

Condition sameFlow = PHYSICAL_FLOW.SPECIFICATION_ID.eq(flow.specificationId())
.and(nameCondition)
.and(PHYSICAL_FLOW.BASIS_OFFSET.eq(flow.basisOffset()))
.and(PHYSICAL_FLOW.FREQUENCY.eq(flow.frequency().value()))
.and(PHYSICAL_FLOW.TRANSPORT.eq(flow.transport().value()))
Expand Down Expand Up @@ -302,6 +307,7 @@ public long create(PhysicalFlow flow) {
PhysicalFlowRecord record = dsl.newRecord(PHYSICAL_FLOW);
record.setLogicalFlowId(flow.logicalFlowId());

record.setName(flow.name());
record.setFrequency(flow.frequency().value());
record.setTransport(flow.transport().value());
record.setBasisOffset(flow.basisOffset());
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,16 +20,18 @@

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.finos.waltz.model.Criticality;
import org.finos.waltz.model.DescriptionProvider;
import org.finos.waltz.model.ExternalIdProvider;
import org.finos.waltz.model.Nullable;
import org.immutables.value.Value;

@Value.Immutable
@JsonSerialize(as = ImmutableFlowAttributes.class)
@JsonDeserialize(as = ImmutableFlowAttributes.class)
public abstract class FlowAttributes implements DescriptionProvider, ExternalIdProvider {

@Nullable
public abstract String name();
public abstract TransportKindValue transport();

public abstract FrequencyKindValue frequency();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,22 @@

import com.fasterxml.jackson.databind.annotation.JsonDeserialize;
import com.fasterxml.jackson.databind.annotation.JsonSerialize;
import org.finos.waltz.model.*;
import org.finos.waltz.model.CreatedUserTimestampProvider;
import org.finos.waltz.model.DescriptionProvider;
import org.finos.waltz.model.EntityKind;
import org.finos.waltz.model.EntityKindProvider;
import org.finos.waltz.model.EntityLifecycleStatusProvider;
import org.finos.waltz.model.EntityReference;
import org.finos.waltz.model.ExternalIdProvider;
import org.finos.waltz.model.FreshnessIndicator;
import org.finos.waltz.model.IdProvider;
import org.finos.waltz.model.ImmutableEntityReference;
import org.finos.waltz.model.IsRemovedProvider;
import org.finos.waltz.model.LastAttestedProvider;
import org.finos.waltz.model.LastUpdatedProvider;
import org.finos.waltz.model.Nullable;
import org.finos.waltz.model.ProvenanceProvider;
import org.finos.waltz.model.WaltzEntity;
import org.immutables.value.Value;

import java.util.Optional;
Expand All @@ -37,7 +52,6 @@
@JsonDeserialize(as = ImmutablePhysicalFlow.class)
public abstract class PhysicalFlow implements
IdProvider,
NameProvider,
IsRemovedProvider,
CreatedUserTimestampProvider,
DescriptionProvider,
Expand All @@ -54,6 +68,9 @@ public abstract class PhysicalFlow implements

public abstract long specificationId();

@Nullable
public abstract String name();

public abstract FrequencyKindValue frequency();

// e.g. for representing T+0, T+1, T+7, T-1
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,6 +35,7 @@
} else {
workingCopy = {
name: null,
transport: null,
frequency: null,
criticality: null,
Expand All @@ -54,6 +55,7 @@
$physicalFlow = Object.assign(
{},
{
name: workingCopy.name,
transport: workingCopy.transport,
frequency: workingCopy.frequency,
basisOffset,
Expand Down Expand Up @@ -105,6 +107,8 @@
<div style="font-weight: lighter">
<div>Selected Characteristics:</div>
<ul>
<li>
Name: <span class:text-muted={!$physicalFlow.name}>{$physicalFlow.name || "Not provided"}</span></li>
<li>
Transport: {toTransportKindName($nestedEnums, $physicalFlow.transport)}</li>
<li>
Expand Down Expand Up @@ -137,6 +141,18 @@
<form autocomplete="off"
on:submit|preventDefault={save}>

<div class="form-group">
<label for="name">
Name
</label>
<input class="form-control"
id="name"
bind:value={workingCopy.name}/>
</div>
<div class="help-block">
Name to describe this physical flow.
</div>

<EnumSelect options={transportKinds}
bind:value={workingCopy.transport}
mandatory="true"
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,6 +67,7 @@
}
const flowAttributes = {
name: $physicalFlow.name,
transport: $physicalFlow.transport,
frequency: $physicalFlow.frequency,
basisOffset: $physicalFlow.basisOffset,
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -233,6 +233,7 @@ public PhysicalFlowCreateCommandResponse create(PhysicalFlowCreateCommand comman

ImmutablePhysicalFlow.Builder flowBuilder = ImmutablePhysicalFlow.builder()
.specificationId(specId)
.name(command.flowAttributes().name())
.basisOffset(command.flowAttributes().basisOffset())
.frequency(command.flowAttributes().frequency())
.transport(command.flowAttributes().transport())
Expand Down

0 comments on commit ab3b04a

Please sign in to comment.