Skip to content

Commit

Permalink
KOGITO-9196 : YaRD editor: Create yard-validation project with model
Browse files Browse the repository at this point in the history
parser
KOGITO-9197 : YaRD editor: Use old dtable validation codes for
subsumption
KOGITO-9517 : YaRD editor: Use J2CL to generate a JS module
  • Loading branch information
Rikkola committed Jul 21, 2023
1 parent c010130 commit 089adec
Show file tree
Hide file tree
Showing 54 changed files with 2,778 additions and 0 deletions.
28 changes: 28 additions & 0 deletions packages/yard-model/env/index.js
Original file line number Diff line number Diff line change
@@ -0,0 +1,28 @@
/*
* Copyright 2023 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/

const { varsWithName, composeEnv } = require("@kie-tools-scripts/build-env");

module.exports = composeEnv([require("@kie-tools/root-env/env")], {
vars: varsWithName({}),
get env() {
return {
dmnDevDeploymentQuarkusApp: {
version: require("../package.json").version,
},
};
},
});
40 changes: 40 additions & 0 deletions packages/yard-model/package.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
{
"private": true,
"name": "@kie-tools/yard-model",
"version": "0.0.0",
"description": "",
"license": "Apache-2.0",
"homepage": "https://github.com/kiegroup/kie-tools",
"repository": {
"type": "git",
"url": "https://github.com/kiegroup/kie-tools.git"
},
"bugs": {
"url": "https://github.com/kiegroup/kie-tools/issues"
},
"scripts": {
"build:dev": "run-script-os",
"build:dev:darwin:linux": "pnpm install:mvnw && mvn clean install -DskipTests",
"build:dev:win32": "pnpm install:mvnw && pnpm powershell \"mvn clean install `-DskipTests\"",
"build:prod": "pnpm lint && run-script-os",
"build:prod:darwin:linux": "pnpm install:mvnw && mvn clean install -DskipTests=$(build-env tests.run --not) -Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)",
"build:prod:win32": "pnpm install:mvnw && pnpm powershell \"mvn clean install `-DskipTests=$(build-env tests.run --not) `-Dmaven.test.failure.ignore=$(build-env tests.ignoreFailures)\"",
"install": "node install.js",
"install:mvnw": "run-script-os",
"install:mvnw:darwin:linux": "mvn wrapper:wrapper",
"install:mvnw:win32": "pnpm powershell \"mvn wrapper:wrapper\"",
"lint": "echo 'Linting'",
"powershell": "@powershell -NoProfile -ExecutionPolicy Unrestricted -Command"
},
"devDependencies": {
"@kie-tools/maven-config-setup-helper": "workspace:*",
"@kie-tools/root-env": "workspace:*",
"run-script-os": "^1.1.6"
},
"kieTools": {
"requiredPreinstalledCliCommands": [
"java",
"mvn"
]
}
}
84 changes: 84 additions & 0 deletions packages/yard-model/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
<?xml version="1.0"?>
<!--
~ Copyright 2023 Red Hat, Inc. and/or its affiliates.
~
~ Licensed under the Apache License, Version 2.0 (the "License");
~ you may not use this file except in compliance with the License.
~ You may obtain a copy of the License at
~
~ http://www.apache.org/licenses/LICENSE-2.0
~
~ Unless required by applicable law or agreed to in writing, software
~ distributed under the License is distributed on an "AS IS" BASIS,
~ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
~ See the License for the specific language governing permissions and
~ limitations under the License.
-->
<project xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 https://maven.apache.org/xsd/maven-4.0.0.xsd"
xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
<modelVersion>4.0.0</modelVersion>
<groupId>org.kie.kogito</groupId>
<artifactId>yard-model</artifactId>
<version>1.0</version> <!-- TODO get the actual version -->

<properties>
<yaml.mapper>0.4</yaml.mapper>
<helper.maven.plugin>3.2.0</helper.maven.plugin>
<maven.compiler.source>11</maven.compiler.source>
<maven.compiler.target>11</maven.compiler.target>
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>

</properties>

<dependencies>
<dependency>
<groupId>org.treblereel.gwt.yaml.mapper</groupId>
<artifactId>common</artifactId>
<version>${yaml.mapper}</version>
</dependency>

<dependency>
<groupId>org.treblereel.gwt.yaml.mapper</groupId>
<artifactId>processor</artifactId>
<version>${yaml.mapper}</version>
<scope>provided</scope>
</dependency>
</dependencies>
<build>
<plugins>
<plugin>
<groupId>org.codehaus.mojo</groupId>
<artifactId>build-helper-maven-plugin</artifactId>
<version>${helper.maven.plugin}</version>
<executions>
<execution>
<id>add-source</id>
<phase>generate-sources</phase>
<goals>
<goal>add-source</goal>
</goals>
<configuration>
<sources>
<source>target/generated-sources/annotations</source>
</sources>
</configuration>
</execution>
</executions>
</plugin>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-source-plugin</artifactId>
<executions>
<execution>
<id>attach-sources</id>
<goals>
<goal>jar</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
/*
* Copyright 2023 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yard.model;


import org.treblereel.gwt.yaml.api.annotation.YamlSubtype;
import org.treblereel.gwt.yaml.api.annotation.YamlTypeInfo;

@YamlTypeInfo(
key = "type",
value = {
@YamlSubtype(alias = "DecisionTable", type = DecisionTable.class),
@YamlSubtype(alias = "LiteralExpression", type = LiteralExpression.class)
})
public interface DecisionLogic {
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,69 @@
/*
* Copyright 2023 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yard.model;


import org.treblereel.gwt.yaml.api.annotation.YAMLMapper;
import org.treblereel.gwt.yaml.api.annotation.YamlTypeDeserializer;
import org.treblereel.gwt.yaml.api.annotation.YamlTypeSerializer;
import org.yard.model.RuleDefSerializer;

import java.util.List;

@YAMLMapper
public class DecisionTable implements DecisionLogic {
private List<String> inputs;
private String hitPolicy = "ANY";
@Deprecated
private List<String> outputComponents;
@YamlTypeSerializer(RuleDefSerializer.class)
@YamlTypeDeserializer(RuleDefSerializer.class)
private List rules;

public void setInputs(List<String> inputs) {
this.inputs = inputs;
}

public void setOutputComponents(List<String> outputComponents) {
this.outputComponents = outputComponents;
}

public List<String> getInputs() {
return inputs;
}

@Deprecated
public List<String> getOutputComponents() {
return outputComponents;
}

public String getHitPolicy() {
return hitPolicy;
}

public void setHitPolicy(String hitPolicy) {
this.hitPolicy = hitPolicy;
}

public List getRules() {
return rules;
}

public void setRules(List rules) {
this.rules = rules;
}

}
62 changes: 62 additions & 0 deletions packages/yard-model/src/main/java/org/yard/model/Element.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,62 @@
/*
* Copyright 2023 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yard.model;


import org.treblereel.gwt.yaml.api.annotation.YAMLMapper;

import java.util.List;

@YAMLMapper
public class Element {

private String name;
private String type;
private List<String> requirements;
private DecisionLogic logic;

public void setName(String name) {
this.name = name;
}

public void setType(String type) {
this.type = type;
}

public void setRequirements(List<String> requirements) {
this.requirements = requirements;
}

public void setLogic(DecisionLogic logic) {
this.logic = logic;
}

public String getName() {
return name;
}

public String getType() {
return type;
}

public List<String> getRequirements() {
return requirements;
}

public DecisionLogic getLogic() {
return logic;
}
}
39 changes: 39 additions & 0 deletions packages/yard-model/src/main/java/org/yard/model/InlineRule.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
/*
* Copyright 2023 Red Hat, Inc. and/or its affiliates.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
* You may obtain a copy of the License at
*
* http://www.apache.org/licenses/LICENSE-2.0
*
* Unless required by applicable law or agreed to in writing, software
* distributed under the License is distributed on an "AS IS" BASIS,
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
* See the License for the specific language governing permissions and
* limitations under the License.
*/
package org.yard.model;

import java.util.List;

public class InlineRule implements Rule {

public List def;

public InlineRule() {

}

public InlineRule(List data) {
this.def = data;
}

public List getDef() {
return def;
}

public void setDef(List def) {
this.def = def;
}
}
Loading

0 comments on commit 089adec

Please sign in to comment.