test_class.declarator: JSON_RESOURCE_1 = "org/flowable/dmn/editor/converter/decisiontable_regression_model_v1.json"
test_class.modifier: private static final
test_class.original_string: private static final String JSON_RESOURCE_1 = "org/flowable/dmn/editor/converter/decisiontable_regression_model_v1.json";
test_class.type: String
test_class.var_name: JSON_RESOURCE_1
test_class.declarator: JSON_RESOURCE_2 = "org/flowable/dmn/editor/converter/decisiontable_regression_model_v2.json"
test_class.modifier: private static final
test_class.original_string: private static final String JSON_RESOURCE_2 = "org/flowable/dmn/editor/converter/decisiontable_regression_model_v2.json";
test_class.type: String
test_class.var_name: JSON_RESOURCE_2
test_class.declarator: OBJECT_MAPPER = new ObjectMapper()
test_class.modifier: private static final
test_class.original_string: private static final ObjectMapper OBJECT_MAPPER = new ObjectMapper();
test_class.type: ObjectMapper
test_class.var_name: OBJECT_MAPPER
test_class.file: modules/flowable-dmn-json-converter/src/test/java/org/flowable/dmn/editor/converter/DmnJsonConverterUtilTest.java
test_class.identifier: DmnJsonConverterUtilTest
test_case.body: @Test
      public void migrateV1ToV3() {
          JsonNode testJsonResource = parseJson(JSON_RESOURCE_1);
  
          boolean wasMigrated = new DmnJsonConverterUtil().migrateModelV3(testJsonResource, OBJECT_MAPPER);
  
          assertThat(wasMigrated).isTrue();
          assertThat(testJsonResource.get("modelVersion").asText()).isEqualTo("3");
  
          DmnDefinition dmnDefinition = new DmnJsonConverter().convertToDmn(testJsonResource, "abc", 1, new Date());
          DecisionTable decisionTable = (DecisionTable) dmnDefinition.getDecisions().get(0).getExpression();
  
          assertThat(decisionTable.getRules().get(0).getInputEntries().get(0).getInputEntry().getText()).isEqualTo("== \"TEST\"");
          assertThat(decisionTable.getRules().get(0).getInputEntries().get(1).getInputEntry().getText()).isEqualTo("== 100");
          assertThat(decisionTable.getRules().get(0).getInputEntries().get(2).getInputEntry().getText()).isEqualTo("== true");
          assertThat(decisionTable.getRules().get(0).getInputEntries().get(3).getInputEntry().getText()).isEqualTo("== date:toDate('2017-06-01')");
  
          assertThat(decisionTable.getRules().get(1).getInputEntries().get(0).getInputEntry().getText()).isEqualTo("!= \"TEST\"");
          assertThat(decisionTable.getRules().get(1).getInputEntries().get(1).getInputEntry().getText()).isEqualTo("!= 100");
          assertThat(decisionTable.getRules().get(1).getInputEntries().get(2).getInputEntry().getText()).isEqualTo("== false");
          assertThat(decisionTable.getRules().get(1).getInputEntries().get(3).getInputEntry().getText()).isEqualTo("!= date:toDate('2017-06-01')");
  
          assertThat(decisionTable.getRules().get(2).getInputEntries().get(0).getInputEntry().getText()).isEqualTo("-");
          assertThat(decisionTable.getRules().get(2).getInputEntries().get(1).getInputEntry().getText()).isEqualTo("-");
          assertThat(decisionTable.getRules().get(2).getInputEntries().get(2).getInputEntry().getText()).isEqualTo("-");
          assertThat(decisionTable.getRules().get(2).getInputEntries().get(3).getInputEntry().getText()).isEqualTo("-");
      }
test_case.class_method_signature: DmnJsonConverterUtilTest.migrateV1ToV3()
test_case.full_signature: @Test public void migrateV1ToV3()
test_case.identifier: migrateV1ToV3
test_case.invocations: parseJson migrateModelV3 isTrue assertThat isEqualTo assertThat asText get convertToDmn getExpression get getDecisions isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules isEqualTo assertThat getText getInputEntry get getInputEntries get getRules
test_case.modifiers: @Test public
test_case.parameters: ()
test_case.return: void
test_case.signature: void migrateV1ToV3()
focal_class.declarator: LOGGER = LoggerFactory.getLogger(DmnJsonConverterUtil.class)
focal_class.modifier: protected static final
focal_class.original_string: protected static final Logger LOGGER = LoggerFactory.getLogger(DmnJsonConverterUtil.class);
focal_class.type: Logger
focal_class.var_name: LOGGER
focal_class.declarator: objectMapper = new ObjectMapper()
focal_class.modifier: protected static final
focal_class.original_string: protected static final ObjectMapper objectMapper = new ObjectMapper();
focal_class.type: ObjectMapper
focal_class.var_name: objectMapper
focal_class.declarator: lineWidth = 0.05d
focal_class.modifier: protected static
focal_class.original_string: protected static double lineWidth = 0.05d;
focal_class.type: double
focal_class.var_name: lineWidth
focal_class.file: modules/flowable-dmn-json-converter/src/main/java/org/flowable/dmn/editor/converter/DmnJsonConverterUtil.java
focal_class.identifier: DmnJsonConverterUtil
focal_class.interfaces: implements EditorJsonConstants, DmnStencilConstants
focal_class.class_method_signature: DmnJsonConverterUtil.getValueAsString(String name, JsonNode objectNode)
focal_class.full_signature: public static String getValueAsString(String name, JsonNode objectNode)
focal_class.identifier: getValueAsString
focal_class.modifiers: public static
focal_class.parameters: (String name, JsonNode objectNode)
focal_class.return: String
focal_class.signature: String getValueAsString(String name, JsonNode objectNode)
focal_class.class_method_signature: DmnJsonConverterUtil.migrateModel(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.full_signature: public static boolean migrateModel(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.identifier: migrateModel
focal_class.modifiers: public static
focal_class.parameters: (JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.return: boolean
focal_class.signature: boolean migrateModel(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.class_method_signature: DmnJsonConverterUtil.migrateModelV3(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.full_signature: public static boolean migrateModelV3(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.identifier: migrateModelV3
focal_class.modifiers: public static
focal_class.parameters: (JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.return: boolean
focal_class.signature: boolean migrateModelV3(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_class.class_method_signature: DmnJsonConverterUtil.determineExpressionType(String expressionValue)
focal_class.full_signature: public static String determineExpressionType(String expressionValue)
focal_class.identifier: determineExpressionType
focal_class.modifiers: public static
focal_class.parameters: (String expressionValue)
focal_class.return: String
focal_class.signature: String determineExpressionType(String expressionValue)
focal_class.class_method_signature: DmnJsonConverterUtil.formatCollectionExpression(String containsOperator, String inputVariable, String expressionValue)
focal_class.full_signature: public static String formatCollectionExpression(String containsOperator, String inputVariable, String expressionValue)
focal_class.identifier: formatCollectionExpression
focal_class.modifiers: public static
focal_class.parameters: (String containsOperator, String inputVariable, String expressionValue)
focal_class.return: String
focal_class.signature: String formatCollectionExpression(String containsOperator, String inputVariable, String expressionValue)
focal_class.class_method_signature: DmnJsonConverterUtil.isCollectionOperator(String operator)
focal_class.full_signature: public static boolean isCollectionOperator(String operator)
focal_class.identifier: isCollectionOperator
focal_class.modifiers: public static
focal_class.parameters: (String operator)
focal_class.return: boolean
focal_class.signature: boolean isCollectionOperator(String operator)
focal_class.class_method_signature: DmnJsonConverterUtil.isDRD(JsonNode definitionNode)
focal_class.full_signature: public static boolean isDRD(JsonNode definitionNode)
focal_class.identifier: isDRD
focal_class.modifiers: public static
focal_class.parameters: (JsonNode definitionNode)
focal_class.return: boolean
focal_class.signature: boolean isDRD(JsonNode definitionNode)
focal_class.class_method_signature: DmnJsonConverterUtil.getStencilId(JsonNode objectNode)
focal_class.full_signature: public static String getStencilId(JsonNode objectNode)
focal_class.identifier: getStencilId
focal_class.modifiers: public static
focal_class.parameters: (JsonNode objectNode)
focal_class.return: String
focal_class.signature: String getStencilId(JsonNode objectNode)
focal_class.class_method_signature: DmnJsonConverterUtil.getElementId(JsonNode objectNode)
focal_class.full_signature: public static String getElementId(JsonNode objectNode)
focal_class.identifier: getElementId
focal_class.modifiers: public static
focal_class.parameters: (JsonNode objectNode)
focal_class.return: String
focal_class.signature: String getElementId(JsonNode objectNode)
focal_class.class_method_signature: DmnJsonConverterUtil.getUniqueElementId()
focal_class.full_signature: public static String getUniqueElementId()
focal_class.identifier: getUniqueElementId
focal_class.modifiers: public static
focal_class.parameters: ()
focal_class.return: String
focal_class.signature: String getUniqueElementId()
focal_class.class_method_signature: DmnJsonConverterUtil.getUniqueElementId(String prefix)
focal_class.full_signature: public static String getUniqueElementId(String prefix)
focal_class.identifier: getUniqueElementId
focal_class.modifiers: public static
focal_class.parameters: (String prefix)
focal_class.return: String
focal_class.signature: String getUniqueElementId(String prefix)
focal_class.class_method_signature: DmnJsonConverterUtil.getPropertyValueAsString(String name, JsonNode objectNode)
focal_class.full_signature: public static String getPropertyValueAsString(String name, JsonNode objectNode)
focal_class.identifier: getPropertyValueAsString
focal_class.modifiers: public static
focal_class.parameters: (String name, JsonNode objectNode)
focal_class.return: String
focal_class.signature: String getPropertyValueAsString(String name, JsonNode objectNode)
focal_class.class_method_signature: DmnJsonConverterUtil.getProperty(String name, JsonNode objectNode)
focal_class.full_signature: public static JsonNode getProperty(String name, JsonNode objectNode)
focal_class.identifier: getProperty
focal_class.modifiers: public static
focal_class.parameters: (String name, JsonNode objectNode)
focal_class.return: JsonNode
focal_class.signature: JsonNode getProperty(String name, JsonNode objectNode)
focal_class.class_method_signature: DmnJsonConverterUtil.createChildShape(String id, String type, double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.full_signature: public static ObjectNode createChildShape(String id, String type, double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.identifier: createChildShape
focal_class.modifiers: public static
focal_class.parameters: (String id, String type, double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.return: ObjectNode
focal_class.signature: ObjectNode createChildShape(String id, String type, double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.class_method_signature: DmnJsonConverterUtil.createBoundsNode(double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.full_signature: public static ObjectNode createBoundsNode(double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.identifier: createBoundsNode
focal_class.modifiers: public static
focal_class.parameters: (double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.return: ObjectNode
focal_class.signature: ObjectNode createBoundsNode(double lowerRightX, double lowerRightY, double upperLeftX, double upperLeftY)
focal_class.class_method_signature: DmnJsonConverterUtil.createPositionNode(double x, double y)
focal_class.full_signature: public static ObjectNode createPositionNode(double x, double y)
focal_class.identifier: createPositionNode
focal_class.modifiers: public static
focal_class.parameters: (double x, double y)
focal_class.return: ObjectNode
focal_class.signature: ObjectNode createPositionNode(double x, double y)
focal_class.class_method_signature: DmnJsonConverterUtil.createRectangle(GraphicInfo graphicInfo)
focal_class.full_signature: public static Area createRectangle(GraphicInfo graphicInfo)
focal_class.identifier: createRectangle
focal_class.modifiers: public static
focal_class.parameters: (GraphicInfo graphicInfo)
focal_class.return: Area
focal_class.signature: Area createRectangle(GraphicInfo graphicInfo)
focal_class.class_method_signature: DmnJsonConverterUtil.createGraphicInfo(double x, double y)
focal_class.full_signature: public static GraphicInfo createGraphicInfo(double x, double y)
focal_class.identifier: createGraphicInfo
focal_class.modifiers: public static
focal_class.parameters: (double x, double y)
focal_class.return: GraphicInfo
focal_class.signature: GraphicInfo createGraphicInfo(double x, double y)
focal_class.class_method_signature: DmnJsonConverterUtil.getIntersections(java.awt.geom.Line2D line, Area shape)
focal_class.full_signature: public static Collection<Point2D> getIntersections(java.awt.geom.Line2D line, Area shape)
focal_class.identifier: getIntersections
focal_class.modifiers: public static
focal_class.parameters: (java.awt.geom.Line2D line, Area shape)
focal_class.return: Collection<Point2D>
focal_class.signature: Collection<Point2D> getIntersections(java.awt.geom.Line2D line, Area shape)
focal_class.class_method_signature: DmnJsonConverterUtil.getLineShape(java.awt.geom.Line2D line2D)
focal_class.full_signature: public static Shape getLineShape(java.awt.geom.Line2D line2D)
focal_class.identifier: getLineShape
focal_class.modifiers: public static
focal_class.parameters: (java.awt.geom.Line2D line2D)
focal_class.return: Shape
focal_class.signature: Shape getLineShape(java.awt.geom.Line2D line2D)
focal_class.class_method_signature: DmnJsonConverterUtil.getDmnModelChildShapesPropertyValues(JsonNode editorJsonNode, String propertyName, List<String> allowedStencilTypes)
focal_class.full_signature: public static List<JsonLookupResult> getDmnModelChildShapesPropertyValues(JsonNode editorJsonNode, String propertyName, List<String> allowedStencilTypes)
focal_class.identifier: getDmnModelChildShapesPropertyValues
focal_class.modifiers: public static
focal_class.parameters: (JsonNode editorJsonNode, String propertyName, List<String> allowedStencilTypes)
focal_class.return: List<JsonLookupResult>
focal_class.signature: List<JsonLookupResult> getDmnModelChildShapesPropertyValues(JsonNode editorJsonNode, String propertyName, List<String> allowedStencilTypes)
focal_class.class_method_signature: DmnJsonConverterUtil.filterOutJsonNodes(List<JsonLookupResult> lookupResults)
focal_class.full_signature: public static List<JsonNode> filterOutJsonNodes(List<JsonLookupResult> lookupResults)
focal_class.identifier: filterOutJsonNodes
focal_class.modifiers: public static
focal_class.parameters: (List<JsonLookupResult> lookupResults)
focal_class.return: List<JsonNode>
focal_class.signature: List<JsonNode> filterOutJsonNodes(List<JsonLookupResult> lookupResults)
focal_class.class_method_signature: DmnJsonConverterUtil.getDmnModelDecisionTableReferences(ObjectNode editorJsonNode)
focal_class.full_signature: public static List<JsonLookupResult> getDmnModelDecisionTableReferences(ObjectNode editorJsonNode)
focal_class.identifier: getDmnModelDecisionTableReferences
focal_class.modifiers: public static
focal_class.parameters: (ObjectNode editorJsonNode)
focal_class.return: List<JsonLookupResult>
focal_class.signature: List<JsonLookupResult> getDmnModelDecisionTableReferences(ObjectNode editorJsonNode)
focal_class.class_method_signature: DmnJsonConverterUtil.updateDecisionTableModelReferences(ObjectNode decisionServiceObjectNode, DmnJsonConverterContext converterContext)
focal_class.full_signature: public static void updateDecisionTableModelReferences(ObjectNode decisionServiceObjectNode, DmnJsonConverterContext converterContext)
focal_class.identifier: updateDecisionTableModelReferences
focal_class.modifiers: public static
focal_class.parameters: (ObjectNode decisionServiceObjectNode, DmnJsonConverterContext converterContext)
focal_class.return: void
focal_class.signature: void updateDecisionTableModelReferences(ObjectNode decisionServiceObjectNode, DmnJsonConverterContext converterContext)
focal_class.class_method_signature: DmnJsonConverterUtil.internalGetDmnChildShapePropertyValues(JsonNode editorJsonNode, String propertyName,
          List<String> allowedStencilTypes, List<JsonLookupResult> result)
focal_class.full_signature: protected static void internalGetDmnChildShapePropertyValues(JsonNode editorJsonNode, String propertyName,
          List<String> allowedStencilTypes, List<JsonLookupResult> result)
focal_class.identifier: internalGetDmnChildShapePropertyValues
focal_class.modifiers: protected static
focal_class.parameters: (JsonNode editorJsonNode, String propertyName,
          List<String> allowedStencilTypes, List<JsonLookupResult> result)
focal_class.return: void
focal_class.signature: void internalGetDmnChildShapePropertyValues(JsonNode editorJsonNode, String propertyName,
          List<String> allowedStencilTypes, List<JsonLookupResult> result)
focal_class.class_method_signature: DmnJsonConverterUtil.getDMNContainsExpressionMethod(String containsOperator)
focal_class.full_signature: protected static String getDMNContainsExpressionMethod(String containsOperator)
focal_class.identifier: getDMNContainsExpressionMethod
focal_class.modifiers: protected static
focal_class.parameters: (String containsOperator)
focal_class.return: String
focal_class.signature: String getDMNContainsExpressionMethod(String containsOperator)
focal_class.class_method_signature: DmnJsonConverterUtil.formatCollectionExpressionValue(String expressionValue)
focal_class.full_signature: protected static String formatCollectionExpressionValue(String expressionValue)
focal_class.identifier: formatCollectionExpressionValue
focal_class.modifiers: protected static
focal_class.parameters: (String expressionValue)
focal_class.return: String
focal_class.signature: String formatCollectionExpressionValue(String expressionValue)
focal_class.class_method_signature: DmnJsonConverterUtil.split(String str)
focal_class.full_signature: protected static List<String> split(String str)
focal_class.identifier: split
focal_class.modifiers: protected static
focal_class.parameters: (String str)
focal_class.return: List<String>
focal_class.signature: List<String> split(String str)
focal_class.class_method_signature: DmnJsonConverterUtil.transformCollectionOperation(String operatorValue, String inputType)
focal_class.full_signature: protected static String transformCollectionOperation(String operatorValue, String inputType)
focal_class.identifier: transformCollectionOperation
focal_class.modifiers: protected static
focal_class.parameters: (String operatorValue, String inputType)
focal_class.return: String
focal_class.signature: String transformCollectionOperation(String operatorValue, String inputType)
focal_method.body: public static boolean migrateModelV3(JsonNode decisionTableNode, ObjectMapper objectMapper) {
          // migrate to v2
          boolean wasMigrated = migrateModel(decisionTableNode, objectMapper);
  
          // migrate to v3
          if (decisionTableNode.has("modelVersion") && decisionTableNode.get("modelVersion").asText().equals("2") && decisionTableNode.has("name")) {
              wasMigrated = true;
  
              String modelName = decisionTableNode.get("name").asText();
              LOGGER.info("Decision table model {} found with version v2; migrating to v3", modelName);
  
              ObjectNode decisionTableObjectNode = (ObjectNode) decisionTableNode;
              decisionTableObjectNode.put("modelVersion", "3");
  
              JsonNode inputExpressionNodes = decisionTableNode.get("inputExpressions");
              Map<String, String> inputExpressionIds = new HashMap<>();
  
              if (inputExpressionNodes != null && !inputExpressionNodes.isNull()) {
                  for (JsonNode inputExpressionNode : inputExpressionNodes) {
                      if (inputExpressionNode.get("id") != null && !inputExpressionNode.get("id").isNull()) {
                          String inputId = inputExpressionNode.get("id").asText();
  
                          String inputType = null;
                          if (inputExpressionNode.get("type") != null && !inputExpressionNode.get("type").isNull()) {
                              inputType = inputExpressionNode.get("type").asText();
                          }
  
                          inputExpressionIds.put(inputId, inputType);
                      }
                  }
              }
  
              // split input rule nodes
              JsonNode ruleNodes = decisionTableNode.get("rules");
  
              if (ruleNodes != null && !ruleNodes.isNull()) {
                  for (JsonNode ruleNode : ruleNodes) {
  
                      for (String inputExpressionId : inputExpressionIds.keySet()) {
  
                          // get operator
                          String inputExpressionOperatorId = inputExpressionId + "_operator";
  
                          if (ruleNode.has(inputExpressionOperatorId)) {
                              if (ruleNode.get(inputExpressionOperatorId) != null && !ruleNode.get(inputExpressionOperatorId).isNull()) {
                                  String oldInputExpressionOperatorValue = ruleNode.get(inputExpressionOperatorId).asText();
                                  String inputType = inputExpressionIds.get(inputExpressionId);
                                  try {
                                      String newInputExpressionOperatorValue = transformCollectionOperation(oldInputExpressionOperatorValue, inputType);
  
                                      // replace operator value
                                      ((ObjectNode) ruleNode).put(inputExpressionOperatorId, newInputExpressionOperatorValue);
                                  } catch (IllegalArgumentException iae) {
                                      LOGGER.warn("Skipping model migration; could not transform collection operator for model name: {}", modelName, iae);
                                  }
                              }
                          }
                      }
                  }
              }
  
              LOGGER.info("Decision table model {} migrated to v3", modelName);
          }
  
          return wasMigrated;
      }
focal_method.class_method_signature: DmnJsonConverterUtil.migrateModelV3(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_method.full_signature: public static boolean migrateModelV3(JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_method.identifier: migrateModelV3
focal_method.invocations: migrateModel has equals asText get has asText get info put get isNull get isNull get asText get get isNull get asText get put get isNull keySet has get isNull get asText get get transformCollectionOperation put warn info
focal_method.modifiers: public static
focal_method.parameters: (JsonNode decisionTableNode, ObjectMapper objectMapper)
focal_method.return: boolean
focal_method.signature: boolean migrateModelV3(JsonNode decisionTableNode, ObjectMapper objectMapper)