Skip to content

Instantly share code, notes, and snippets.

@porcelli
Created May 26, 2020 18:45
Show Gist options
  • Save porcelli/6ec9ad0a5822886453c0ffecf65735ec to your computer and use it in GitHub Desktop.
Save porcelli/6ec9ad0a5822886453c0ffecf65735ec to your computer and use it in GitHub Desktop.
Code for blog post: BPMN Extension for VSCode Now Available
$ curl -X POST http://kogito-persons.apps-crc.testing/persons \
-H 'content-type: application/json' \
-H 'accept: application/json' \
-d '{"person": {"name":"John Quark", "age": 30}}'
$ curl -X POST http://localhost:8080/persons \
-H 'content-type: application/json' \
-H 'accept: application/json' \
-d '{"person": {"name":"John Quark", "age": 20}}'
{"id":"6906da37-4f09-436c-a1dc-8ec340e97664","person":{"adult":false,"age":20,"name":"John Quark"}}
$ curl -X POST http://localhost:8080/persons \
-H 'content-type: application/json' \
-H 'accept: application/json' \
-d '{"person": {"name":"John Quark", "age": 20}}'
{"id":"f5500cd5-9a1c-4ed8-9835-569a333a11c0","person":{"adult":true,"age":20,"name":"John Quark"}}
$ kogito deploy kogito-persons https://github.com/porcelli/kogito-demo.git
$ mvn io.quarkus:quarkus-maven-plugin:0.21.2:create \
-DprojectGroupId=org.acme \
-DprojectArtifactId=using-kogito \
-Dextensions="kogito"
$ oc logs -f bc/person-demo-builder -n kogito-dw-demo
package org.acme.kogito
import org.acme.kogito.model.Person;
rule "Is adult" ruleflow-group "person"
when
$person: Person(age > 21)
then
modify($person) {
setAdult(true)
};
end
package org.acme.kogito.model;
public class Person {
private String name;
private int age;
private boolean adult;
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public int getAge() {
return age;
}
public void setAge(int age) {
this.age = age;
}
public boolean isAdult() {
return adult;
}
public void setAdult(boolean adult) {
this.adult = adult;
}
@Override
public String toString() {
return "Person [name=" + name + ", age=" + age + ", adult=" + adult + "]";
}
}
$ ./mvnw clean compile quarkus:dev
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment