-
Notifications
You must be signed in to change notification settings - Fork 40
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Recreate and move full-stack example to dedicated directory
- Loading branch information
Showing
18 changed files
with
213 additions
and
250 deletions.
There are no files selected for viewing
This file was deleted.
Oops, something went wrong.
This file was deleted.
Oops, something went wrong.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
HELP.md | ||
.gradle | ||
build/ | ||
!gradle/wrapper/gradle-wrapper.jar | ||
!**/src/main/**/build/ | ||
!**/src/test/**/build/ | ||
|
||
### STS ### | ||
.apt_generated | ||
.classpath | ||
.factorypath | ||
.project | ||
.settings | ||
.springBeans | ||
.sts4-cache | ||
bin/ | ||
!**/src/main/**/bin/ | ||
!**/src/test/**/bin/ | ||
|
||
### IntelliJ IDEA ### | ||
.idea | ||
*.iws | ||
*.iml | ||
*.ipr | ||
out/ | ||
!**/src/main/**/out/ | ||
!**/src/test/**/out/ | ||
|
||
### NetBeans ### | ||
/nbproject/private/ | ||
/nbbuild/ | ||
/dist/ | ||
/nbdist/ | ||
/.nb-gradle/ | ||
|
||
### VS Code ### | ||
.vscode/ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,38 @@ | ||
plugins { | ||
id 'org.springframework.boot' version '2.4.2' | ||
id 'io.spring.dependency-management' version '1.0.11.RELEASE' | ||
id 'de.undercouch.download' version '4.1.1' | ||
id 'java' | ||
} | ||
|
||
group = 'io.nflow.springboot.fullstack.maven' | ||
version = '0.0.1-SNAPSHOT' | ||
sourceCompatibility = '1.8' | ||
|
||
repositories { | ||
mavenCentral() | ||
} | ||
|
||
configurations { | ||
nflowExplorer | ||
} | ||
|
||
dependencies { | ||
compile("io.nflow:nflow-rest-api-spring-web:7.2.2") | ||
implementation 'org.springframework.boot:spring-boot-starter-jdbc' | ||
implementation 'org.springframework.boot:spring-boot-starter-web' | ||
runtimeOnly 'com.h2database:h2' | ||
testImplementation 'org.springframework.boot:spring-boot-starter-test' | ||
nflowExplorer group: 'io.nflow', name: 'nflow-explorer', version: '7.2.2', ext: 'tar.gz' | ||
} | ||
|
||
task resolveNflowExplorer(type: Copy) { | ||
destinationDir = file("$buildDir/resources/main/static/explorer") | ||
from { tarTree(resources.gzip(configurations.nflowExplorer.singleFile)) } | ||
} | ||
|
||
test { | ||
useJUnitPlatform() | ||
} | ||
|
||
processResources.dependsOn resolveNflowExplorer |
Binary file renamed
BIN
+54.3 KB
...l-stack/gradle/wrapper/gradle-wrapper.jar → .../gradle/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 1 addition & 1 deletion
2
.../gradle/wrapper/gradle-wrapper.properties → .../gradle/wrapper/gradle-wrapper.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,5 +1,5 @@ | ||
distributionBase=GRADLE_USER_HOME | ||
distributionPath=wrapper/dists | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-5.5.1-bin.zip | ||
distributionUrl=https\://services.gradle.org/distributions/gradle-6.7.1-bin.zip | ||
zipStoreBase=GRADLE_USER_HOME | ||
zipStorePath=wrapper/dists |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1 @@ | ||
rootProject.name = 'demo' |
44 changes: 44 additions & 0 deletions
44
...full-stack/gradle/src/main/java/io/nflow/springboot/fullstack/gradle/DemoApplication.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
package io.nflow.springboot.fullstack.gradle; | ||
|
||
import javax.inject.Inject; | ||
|
||
import org.springframework.boot.SpringApplication; | ||
import org.springframework.boot.autoconfigure.SpringBootApplication; | ||
import org.springframework.boot.context.event.ApplicationReadyEvent; | ||
import org.springframework.context.annotation.Bean; | ||
import org.springframework.context.annotation.Import; | ||
import org.springframework.context.event.EventListener; | ||
|
||
import io.nflow.rest.config.RestConfiguration; | ||
import io.nflow.engine.service.WorkflowInstanceService; | ||
import io.nflow.engine.workflow.instance.WorkflowInstanceFactory; | ||
|
||
@SpringBootApplication | ||
@Import(RestConfiguration.class) | ||
public class DemoApplication { | ||
|
||
@Inject | ||
private WorkflowInstanceService workflowInstances; | ||
|
||
@Inject | ||
private WorkflowInstanceFactory workflowInstanceFactory; | ||
|
||
@EventListener(ApplicationReadyEvent.class) | ||
public void insertWorkflowInstance() { | ||
workflowInstances.insertWorkflowInstance(workflowInstanceFactory.newWorkflowInstanceBuilder() | ||
.setType(ExampleWorkflow.TYPE) | ||
.setExternalId("example") | ||
.putStateVariable(ExampleWorkflow.VAR_COUNTER, 0) | ||
.build()); | ||
} | ||
|
||
@Bean | ||
public ExampleWorkflow exampleWorkflow() { | ||
return new ExampleWorkflow(); | ||
} | ||
|
||
public static void main(String[] args) { | ||
SpringApplication.run(DemoApplication.class, args); | ||
} | ||
|
||
} |
51 changes: 51 additions & 0 deletions
51
...full-stack/gradle/src/main/java/io/nflow/springboot/fullstack/gradle/ExampleWorkflow.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,51 @@ | ||
package io.nflow.springboot.fullstack.gradle; | ||
|
||
import org.joda.time.DateTime; | ||
|
||
import io.nflow.engine.workflow.definition.NextAction; | ||
import io.nflow.engine.workflow.definition.StateExecution; | ||
import io.nflow.engine.workflow.definition.WorkflowDefinition; | ||
import io.nflow.engine.workflow.definition.WorkflowStateType; | ||
|
||
import static io.nflow.engine.workflow.definition.WorkflowStateType.manual; | ||
import static io.nflow.engine.workflow.definition.WorkflowStateType.start; | ||
|
||
public class ExampleWorkflow extends WorkflowDefinition<ExampleWorkflow.State> { | ||
|
||
public static final String TYPE = "repeatingWorkflow"; | ||
public static final String VAR_COUNTER = "VAR_COUNTER"; | ||
|
||
public enum State implements io.nflow.engine.workflow.definition.WorkflowState { | ||
repeat(start, "Repeating state"), | ||
error(manual, "Error state"); | ||
|
||
private WorkflowStateType type; | ||
private String description; | ||
|
||
State(WorkflowStateType type, String description) { | ||
this.type = type; | ||
this.description = description; | ||
} | ||
|
||
@Override | ||
public WorkflowStateType getType() { | ||
return type; | ||
} | ||
|
||
@Override | ||
public String getDescription() { | ||
return description; | ||
} | ||
} | ||
|
||
public ExampleWorkflow() { | ||
super(TYPE, State.repeat, State.error); | ||
permit(State.repeat, State.repeat); | ||
} | ||
|
||
public NextAction repeat(StateExecution execution) { | ||
System.out.println("Counter: " + execution.getVariable(VAR_COUNTER)); | ||
execution.setVariable(VAR_COUNTER, execution.getVariable(VAR_COUNTER, Integer.class) + 1); | ||
return NextAction.moveToStateAfter(State.repeat, DateTime.now().plusSeconds(10), "Next iteration"); | ||
} | ||
} |
2 changes: 2 additions & 0 deletions
2
nflow-examples/spring-boot/full-stack/gradle/src/main/resources/application.properties
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
spring.profiles.active=nflow.db.h2 | ||
logging.level.root=WARN |
Oops, something went wrong.