Skip to content

Commit

Permalink
defined atomic types.
Browse files Browse the repository at this point in the history
  • Loading branch information
zhy2002 committed May 29, 2016
1 parent 498cc7e commit 65dc579
Show file tree
Hide file tree
Showing 23 changed files with 298 additions and 22 deletions.
25 changes: 24 additions & 1 deletion pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -14,13 +14,15 @@
<groupId>io.spring.platform</groupId>
<artifactId>platform-bom</artifactId>
<version>2.0.3.RELEASE</version>
<relativePath />
</parent>

<modules>
<module>sba2-web</module>
<module>sba2-domain</module>
<module>sba2-atomic</module>
<module>sba2-atomic-custom</module>
<module>sba2-core</module>
</modules>

<properties>
Expand All @@ -31,6 +33,7 @@

<dependencyManagement>
<dependencies>
<!-- project modules -->
<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-atomic</artifactId>
Expand All @@ -41,7 +44,26 @@
<artifactId>sba2-atomic-custom</artifactId>
<version>${project.version}</version>
</dependency>

<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-domain</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-core</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-dto</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-workflow</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>
</dependencyManagement>

Expand All @@ -57,6 +79,7 @@
<build>
<pluginManagement>
<plugins>

</plugins>
</pluginManagement>

Expand Down
29 changes: 29 additions & 0 deletions sba2-core/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
<?xml version="1.0" encoding="UTF-8"?>
<project xmlns="http://maven.apache.org/POM/4.0.0"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/xsd/maven-4.0.0.xsd">
<parent>
<artifactId>spring-boot-angular2</artifactId>
<groupId>zhy2002</groupId>
<version>1.0-SNAPSHOT</version>
</parent>
<modelVersion>4.0.0</modelVersion>

<artifactId>sba2-core</artifactId>

<dependencies>
<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-domain</artifactId>
</dependency>
<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-dto</artifactId>
</dependency>
<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-workflow</artifactId>
</dependency>
</dependencies>

</project>
7 changes: 7 additions & 0 deletions sba2-core/src/main/java/zhy2002/sba2/core/ActionCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package zhy2002.sba2.core;

/**
* Created by ZHY on 30/04/2016.
*/
public class ActionCommand {
}
7 changes: 7 additions & 0 deletions sba2-core/src/main/java/zhy2002/sba2/core/ActionResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package zhy2002.sba2.core;

/**
* Created by ZHY on 30/04/2016.
*/
public class ActionResult {
}
22 changes: 22 additions & 0 deletions sba2-core/src/main/java/zhy2002/sba2/core/Engine.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
package zhy2002.sba2.core;

import org.springframework.beans.factory.annotation.Autowired;
import zhy2002.sba2.domain.security.User;

/**
* A singleton class used to process requests.
*/
public class Engine {

@Autowired
private EngineEnvironment engineEnvironment;

public QueryResult query(User user, QueryCommand queryCommand) {
//todo implement
return null;
}

public ActionResult execute(User user, ActionCommand actionCommand) {
return null;
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package zhy2002.sba2.core;

import java.util.Locale;

/**
* Defines the environment the engine needs to run.
*/
public interface EngineEnvironment {
}
7 changes: 7 additions & 0 deletions sba2-core/src/main/java/zhy2002/sba2/core/QueryCommand.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package zhy2002.sba2.core;

/**
* Created by ZHY on 30/04/2016.
*/
public class QueryCommand {
}
7 changes: 7 additions & 0 deletions sba2-core/src/main/java/zhy2002/sba2/core/QueryResult.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package zhy2002.sba2.core;

/**
* Created by ZHY on 30/04/2016.
*/
public class QueryResult {
}
5 changes: 5 additions & 0 deletions sba2-domain/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -22,5 +22,10 @@
<artifactId>sba2-atomic-custom</artifactId>
<scope>runtime</scope>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-data-jpa</artifactId>
</dependency>
</dependencies>
</project>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package zhy2002.sba2.domain.data;

/**
* Created by ZHY on 25/04/2016.
*/
public class AtomicDataField extends DataField {

private String atomicListTypeName;
private String defaultValueProviderName;


}
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package zhy2002.sba2.domain;
package zhy2002.sba2.domain.data;

import org.springframework.context.ApplicationContext;
import org.springframework.context.support.ClassPathXmlApplicationContext;
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
package zhy2002.sba2.domain.data;

/**
* Created by ZHY on 25/04/2016.
*/
public abstract class DataField {
private DataFieldId id;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
package zhy2002.sba2.domain.data;

import javax.persistence.Embeddable;

/**
* Created by ZHY on 26/04/2016.
*/
@Embeddable
public class DataFieldId {
private Long id;
private Integer version;

public Long getId() {
return id;
}

public void setId(Long id) {
this.id = id;
}

public Integer getVersion() {
return version;
}

public void setVersion(Integer version) {
this.version = version;
}
}

Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package zhy2002.sba2.domain.data;

/**
* Created by ZHY on 26/04/2016.
*/
public class DataObjectInstance {

private DataObjectType dataObject;
private String dataJson;

}
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
package zhy2002.sba2.domain.data;

/**
* Created by ZHY on 25/04/2016.
*/
public class DataObjectSlot {

private DataField dataField;
private Integer minCount;
private Integer maxCount;
private Boolean allowDuplicates;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
package zhy2002.sba2.domain.data;

import java.util.List;

/**
* Created by ZHY on 25/04/2016.
*/
public class DataObjectType extends DataField{

private List<DataObjectSlot> slots;
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
package zhy2002.sba2.domain.security;

/**
* Created by ZHY on 30/04/2016.
*/
public class User {
}
8 changes: 7 additions & 1 deletion sba2-web/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://maven.apache.org/maven-v4_0_0.xsd">
<modelVersion>4.0.0</modelVersion>

<artifactId>sba-webapp</artifactId>
<artifactId>sba2-web</artifactId>
<packaging>war</packaging>
<name>sba-webapp Maven Webapp</name>
<url>http://maven.apache.org</url>
Expand All @@ -14,6 +14,12 @@
</parent>

<dependencies>

<dependency>
<groupId>zhy2002</groupId>
<artifactId>sba2-core</artifactId>
</dependency>

<dependency>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-web</artifactId>
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
package zhy2002.sba2.webapp;
package zhy2002.sba2.web;

import org.springframework.boot.SpringApplication;
import org.springframework.boot.autoconfigure.SpringBootApplication;
Expand All @@ -9,7 +9,7 @@
/**
* This is the main Spring configuration class.
*/
@SpringBootApplication(scanBasePackages = "zhy2002.sba2")
@SpringBootApplication(scanBasePackages = "zhy2002.sba2.web")
public class WebConfig extends SpringBootServletInitializer {

@Override
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
package zhy2002.sba2.web.mvc.controller;

import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.Map;

/**
* A controller used for testing purpose.
*/
@RestController
@RequestMapping("/test")
public class TestController {

@RequestMapping("/hello")
public String home() {
return "Spring Boot says hello!";
}

@RequestMapping("/data")
public Object home2() {
String[] array = {"value1", "value2"};
return array;
}

@RequestMapping("/params")
public Object param(@RequestBody Map<String, Object> params) {
return new Object[] {"result is:", params};
}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
package zhy2002.sba2.web.rest;

import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RequestMethod;
import org.springframework.web.bind.annotation.RestController;
import zhy2002.sba2.core.Engine;
import zhy2002.sba2.domain.security.User;
import zhy2002.sba2.core.ActionCommand;
import zhy2002.sba2.core.ActionResult;
import zhy2002.sba2.core.QueryCommand;
import zhy2002.sba2.core.QueryResult;

/**
* This controller expose the engine functionality as web api.
*/
@RestController
@RequestMapping("/api")
public class EngineApiController {

@Autowired
private Engine engine;

@Autowired
private User user;

@RequestMapping(path = "/query", method = RequestMethod.POST)
public QueryResult query(QueryCommand queryCommand) {
return engine.query(user, queryCommand);
}

@RequestMapping(path = "/execute", method = RequestMethod.POST)
public ActionResult execute(ActionCommand actionCommand) {
return engine.execute(user, actionCommand);
}

//todo handle exceptions

}

This file was deleted.

Loading

0 comments on commit 65dc579

Please sign in to comment.