Skip to content

Commit

Permalink
added support of discrete point feature
Browse files Browse the repository at this point in the history
  • Loading branch information
xuelianhan007 committed Nov 21, 2024
1 parent 8391627 commit d500420
Show file tree
Hide file tree
Showing 3 changed files with 19 additions and 2 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,10 @@ spec:
- name: mapper.order.uni.add.bandwidth
title: "Bandwidth of the UNI"
source: "@{{productOrderItem[0].product.productConfiguration.bandwidth}}"
sourceType: discrete
sourceValues:
- 1000
- 10000
target: "@{{speed}}"
sourceLocation: BODY
targetLocation: BODY
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package com.consoleconnect.kraken.operator.core.enums;

import lombok.AllArgsConstructor;
import lombok.Getter;

@Getter
@AllArgsConstructor
public enum MappingTypeEnum {
ENUM("enum"),
DISCRETE("discrete");
private final String name;
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@
import com.consoleconnect.kraken.operator.core.dto.UnifiedAssetDto;
import com.consoleconnect.kraken.operator.core.enums.ActionTypeEnum;
import com.consoleconnect.kraken.operator.core.enums.ExpectTypeEnum;
import com.consoleconnect.kraken.operator.core.enums.MappingTypeEnum;
import com.consoleconnect.kraken.operator.core.enums.ParamLocationEnum;
import com.consoleconnect.kraken.operator.core.exception.KrakenException;
import com.consoleconnect.kraken.operator.core.model.AppProperty;
Expand Down Expand Up @@ -41,7 +42,6 @@ public class MappingMatrixCheckerActionRunner extends AbstractActionRunner {
public static final String MESSAGE_ALERT = "api use case is not supported %s";
public static final String CHECK_NAME_ENABLED = "enabled";
public static final String PARAM_NAME = "param";
public static final String ENUM = "enum";
public static final String NOT_FOUND = "notFound";
public static final String COLON = ":";
private final UnifiedAssetService unifiedAssetService;
Expand Down Expand Up @@ -217,7 +217,8 @@ public void checkRequestConstraints(String targetKey, Map<String, Object> inputs
|| ParamLocationEnum.HYBRID.name().equals(mapper.getTargetLocation())) {
continue;
}
if (Objects.equals(mapper.getSourceType(), ENUM)) {
if (MappingTypeEnum.ENUM.getName().equals(mapper.getSourceType())
|| MappingTypeEnum.DISCRETE.getName().equals(mapper.getSourceType())) {
checkEnumValue(mapper.getSource(), mapper.getTarget(), inputs, mapper.getSourceValues());
} else if (mapper.getTarget() != null && !mapper.getTarget().contains("@{{")) {
checkConstantValue(mapper.getSource(), mapper.getTarget(), inputs);
Expand Down

0 comments on commit d500420

Please sign in to comment.