forked from 2pm.tech/traqtor
Compare commits
No commits in common. 'master' and 'master' have entirely different histories.
@ -1,7 +1,39 @@
|
|||||||
.settings
|
#Maven
|
||||||
target
|
target/
|
||||||
|
pom.xml.tag
|
||||||
|
pom.xml.releaseBackup
|
||||||
|
pom.xml.versionsBackup
|
||||||
|
release.properties
|
||||||
|
|
||||||
|
# Eclipse
|
||||||
.project
|
.project
|
||||||
.gitignore
|
|
||||||
.classpath
|
.classpath
|
||||||
nbactions.xml
|
.settings/
|
||||||
traqtor-demo-workspace
|
bin/
|
||||||
|
|
||||||
|
# IntelliJ
|
||||||
|
.idea
|
||||||
|
*.ipr
|
||||||
|
*.iml
|
||||||
|
*.iws
|
||||||
|
|
||||||
|
# NetBeans
|
||||||
|
nb-configuration.xml
|
||||||
|
|
||||||
|
# Visual Studio Code
|
||||||
|
.vscode
|
||||||
|
.factorypath
|
||||||
|
|
||||||
|
# OSX
|
||||||
|
.DS_Store
|
||||||
|
|
||||||
|
# Vim
|
||||||
|
*.swp
|
||||||
|
*.swo
|
||||||
|
|
||||||
|
# patch
|
||||||
|
*.orig
|
||||||
|
*.rej
|
||||||
|
|
||||||
|
# Local environment
|
||||||
|
.env
|
||||||
|
|||||||
@ -1,32 +1,150 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0"?>
|
||||||
<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">
|
<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>
|
<modelVersion>4.0.0</modelVersion>
|
||||||
|
<groupId>two.pm.tools</groupId>
|
||||||
<groupId>link.pagan</groupId>
|
<artifactId>traqtor-core</artifactId>
|
||||||
<artifactId>traqtor</artifactId>
|
<version>0.0.1-alpha</version>
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
<properties>
|
||||||
<packaging>pom</packaging>
|
<compiler-plugin.version>3.8.1</compiler-plugin.version>
|
||||||
<name>TraQtor</name>
|
<maven.compiler.parameters>true</maven.compiler.parameters>
|
||||||
|
<maven.compiler.source>11</maven.compiler.source>
|
||||||
<modules>
|
<maven.compiler.target>11</maven.compiler.target>
|
||||||
<module>traqtor-framework</module>
|
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
||||||
<module>traqtor-generator</module>
|
<project.reporting.outputEncoding>UTF-8</project.reporting.outputEncoding>
|
||||||
<module>traqtor-schema</module>
|
<quarkus-plugin.version>1.11.1.Final</quarkus-plugin.version>
|
||||||
<module>traqtor-schema-ref</module>
|
<quarkus.platform.artifact-id>quarkus-universe-bom</quarkus.platform.artifact-id>
|
||||||
<module>traqtor-api</module>
|
<quarkus.platform.group-id>io.quarkus</quarkus.platform.group-id>
|
||||||
</modules>
|
<quarkus.platform.version>1.11.1.Final</quarkus.platform.version>
|
||||||
|
<surefire-plugin.version>2.22.1</surefire-plugin.version>
|
||||||
|
</properties>
|
||||||
|
<dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>${quarkus.platform.group-id}</groupId>
|
||||||
|
<artifactId>${quarkus.platform.artifact-id}</artifactId>
|
||||||
|
<version>${quarkus.platform.version}</version>
|
||||||
|
<type>pom</type>
|
||||||
|
<scope>import</scope>
|
||||||
|
</dependency>
|
||||||
|
</dependencies>
|
||||||
|
</dependencyManagement>
|
||||||
|
<dependencies>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-arc</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-resteasy</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-resteasy-jackson</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-smallrye-openapi</artifactId>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>com.h2database</groupId>
|
||||||
|
<artifactId>h2</artifactId>
|
||||||
|
<version>1.4.198</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cayenne</groupId>
|
||||||
|
<artifactId>cayenne-server</artifactId>
|
||||||
|
<version>4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.apache.cayenne</groupId>
|
||||||
|
<artifactId>cayenne-crypto</artifactId>
|
||||||
|
<version>4.1</version>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>org.postgresql</groupId>
|
||||||
|
<artifactId>postgresql</artifactId>
|
||||||
|
<version>42.2.18</version>
|
||||||
|
</dependency>
|
||||||
|
|
||||||
|
|
||||||
|
<!-- <dependency>
|
||||||
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-junit5</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency>
|
||||||
|
<dependency>
|
||||||
|
<groupId>io.rest-assured</groupId>
|
||||||
|
<artifactId>rest-assured</artifactId>
|
||||||
|
<scope>test</scope>
|
||||||
|
</dependency> -->
|
||||||
|
</dependencies>
|
||||||
<build>
|
<build>
|
||||||
<plugins>
|
<plugins>
|
||||||
<plugin>
|
<plugin>
|
||||||
<groupId>org.apache.maven.plugins</groupId>
|
<groupId>io.quarkus</groupId>
|
||||||
|
<artifactId>quarkus-maven-plugin</artifactId>
|
||||||
|
<version>${quarkus-plugin.version}</version>
|
||||||
|
<extensions>true</extensions>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>build</goal>
|
||||||
|
<goal>generate-code</goal>
|
||||||
|
<goal>generate-code-tests</goal>
|
||||||
|
</goals>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
<artifactId>maven-compiler-plugin</artifactId>
|
||||||
<version>3.2</version>
|
<version>${compiler-plugin.version}</version>
|
||||||
|
</plugin>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-surefire-plugin</artifactId>
|
||||||
|
<version>${surefire-plugin.version}</version>
|
||||||
<configuration>
|
<configuration>
|
||||||
<source>11</source>
|
<systemPropertyVariables>
|
||||||
<target>11</target>
|
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||||
|
<maven.home>${maven.home}</maven.home>
|
||||||
|
</systemPropertyVariables>
|
||||||
</configuration>
|
</configuration>
|
||||||
</plugin>
|
</plugin>
|
||||||
</plugins>
|
</plugins>
|
||||||
</build>
|
</build>
|
||||||
|
<profiles>
|
||||||
|
<profile>
|
||||||
|
<id>native</id>
|
||||||
|
<activation>
|
||||||
|
<property>
|
||||||
|
<name>native</name>
|
||||||
|
</property>
|
||||||
|
</activation>
|
||||||
|
<build>
|
||||||
|
<plugins>
|
||||||
|
<plugin>
|
||||||
|
<artifactId>maven-failsafe-plugin</artifactId>
|
||||||
|
<version>${surefire-plugin.version}</version>
|
||||||
|
<executions>
|
||||||
|
<execution>
|
||||||
|
<goals>
|
||||||
|
<goal>integration-test</goal>
|
||||||
|
<goal>verify</goal>
|
||||||
|
</goals>
|
||||||
|
<configuration>
|
||||||
|
<systemPropertyVariables>
|
||||||
|
<native.image.path>${project.build.directory}/${project.build.finalName}-runner</native.image.path>
|
||||||
|
<java.util.logging.manager>org.jboss.logmanager.LogManager</java.util.logging.manager>
|
||||||
|
<maven.home>${maven.home}</maven.home>
|
||||||
|
</systemPropertyVariables>
|
||||||
|
</configuration>
|
||||||
|
</execution>
|
||||||
|
</executions>
|
||||||
|
</plugin>
|
||||||
|
</plugins>
|
||||||
|
</build>
|
||||||
|
<properties>
|
||||||
|
<quarkus.package.type>native</quarkus.package.type>
|
||||||
|
</properties>
|
||||||
|
</profile>
|
||||||
|
</profiles>
|
||||||
</project>
|
</project>
|
||||||
|
|||||||
|
Before Width: | Height: | Size: 162 KiB After Width: | Height: | Size: 162 KiB |
|
Before Width: | Height: | Size: 227 KiB After Width: | Height: | Size: 227 KiB |
@ -1,75 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<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">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>link.pagan</groupId>
|
|
||||||
<artifactId>traqtor</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<groupId>link.pagan</groupId>
|
|
||||||
<artifactId>traqtor-api</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>TraQtor / API </name>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
<dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit</groupId>
|
|
||||||
<artifactId>junit-bom</artifactId>
|
|
||||||
<version>5.7.1</version>
|
|
||||||
<type>pom</type>
|
|
||||||
<scope>import</scope>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</dependencyManagement>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>traqtor-schema</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>traqtor-schema-ref</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>traqtor-generator</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>traqtor-framework</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.junit.jupiter</groupId>
|
|
||||||
<artifactId>junit-jupiter</artifactId>
|
|
||||||
<scope>test</scope>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>2.12.1</version>
|
|
||||||
</dependency>
|
|
||||||
|
|
||||||
</dependencies>
|
|
||||||
<build>
|
|
||||||
<plugins>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-compiler-plugin</artifactId>
|
|
||||||
<version>3.8.1</version>
|
|
||||||
</plugin>
|
|
||||||
<plugin>
|
|
||||||
<artifactId>maven-surefire-plugin</artifactId>
|
|
||||||
<version>2.22.2</version>
|
|
||||||
</plugin>
|
|
||||||
</plugins>
|
|
||||||
</build>
|
|
||||||
</project>
|
|
||||||
@ -1,24 +0,0 @@
|
|||||||
package link.pagan.traqtor._api;
|
|
||||||
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public abstract class BinaryCommand<T extends Commanded, R extends Commanded> extends UnaryCommand<T> {
|
|
||||||
|
|
||||||
protected R arg2;
|
|
||||||
|
|
||||||
public CommandExecResult subexec(BinaryCommand<T, R> subcommand) {
|
|
||||||
subcommand.setResultHolder(result);
|
|
||||||
subcommand.setArg(arg);
|
|
||||||
subcommand.setArg2(arg2);
|
|
||||||
return subcommand.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArg2(R arg2) {
|
|
||||||
this.arg2 = arg2;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,9 +0,0 @@
|
|||||||
package link.pagan.traqtor._api;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public interface Commanded {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
//package link.pagan.traqtor._api;
|
|
||||||
//
|
|
||||||
//import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
//import link.pagan.traqtor._api.result.CommandExecResultStatus;
|
|
||||||
//
|
|
||||||
///**
|
|
||||||
// *
|
|
||||||
// * @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
// */
|
|
||||||
//public abstract class Executor<T extends Executor<T>> extends Commanded<T> {
|
|
||||||
//
|
|
||||||
//
|
|
||||||
//
|
|
||||||
// @SuppressWarnings("unchecked")
|
|
||||||
// public CommandExecResult execute(Command<T> command) {
|
|
||||||
// CommandExecResult result = new CommandExecResult();
|
|
||||||
// command.setResultHolder(result);
|
|
||||||
// command.exec((T) this);
|
|
||||||
// if (!mute) {
|
|
||||||
// if (paranoindLoggin) {
|
|
||||||
// result.print();
|
|
||||||
// } else {
|
|
||||||
// if (result.getStatus() != CommandExecResultStatus.DONE) {
|
|
||||||
// result.print();
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// }
|
|
||||||
// return result;
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
//}
|
|
||||||
@ -1,77 +0,0 @@
|
|||||||
package link.pagan.traqtor._api;
|
|
||||||
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
import link.pagan.traqtor._api.result.message.CommandExecMessage;
|
|
||||||
import link.pagan.traqtor._api.result.message.CommandExecMessageStatus;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public abstract class UnaryCommand<T extends Commanded> {
|
|
||||||
|
|
||||||
private static boolean paranoindLoggin = false;
|
|
||||||
private static boolean mute = true;
|
|
||||||
|
|
||||||
public static void enableParanoindLoggin() {
|
|
||||||
enableLog();
|
|
||||||
paranoindLoggin = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static void enableLog() {
|
|
||||||
mute = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CommandExecResult result;
|
|
||||||
protected T arg;
|
|
||||||
|
|
||||||
public abstract CommandExecResult exec();
|
|
||||||
|
|
||||||
public CommandExecResult subexec(UnaryCommand<T> subcommand) {
|
|
||||||
subcommand.setResultHolder(result);
|
|
||||||
subcommand.setArg(arg);
|
|
||||||
return subcommand.exec();
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CommandExecResult fail(String message) {
|
|
||||||
result.add(new CommandExecMessage(CommandExecMessageStatus.FAIL, message));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CommandExecResult info(String message) {
|
|
||||||
result.add(new CommandExecMessage(CommandExecMessageStatus.INFO, message));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CommandExecResult warn(String message) {
|
|
||||||
result.add(new CommandExecMessage(CommandExecMessageStatus.WARN, message));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CommandExecResult done(String message) {
|
|
||||||
result.add(new CommandExecMessage(CommandExecMessageStatus.DONE, message));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
protected CommandExecResult done() {
|
|
||||||
result.add(new CommandExecMessage(CommandExecMessageStatus.DONE, "OK"));
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setResultHolder(CommandExecResult result) {
|
|
||||||
this.result = result;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void setArg(T arg) {
|
|
||||||
this.arg = arg;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean paranoidLoggingEnabled() {
|
|
||||||
return paranoindLoggin;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static boolean mute() {
|
|
||||||
return mute;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
package link.pagan.traqtor._api.result;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import link.pagan.traqtor._api.result.message.CommandExecMessage;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class CommandExecResult {
|
|
||||||
|
|
||||||
final ArrayList<CommandExecMessage> messages;
|
|
||||||
|
|
||||||
public CommandExecResult() {
|
|
||||||
this.messages = new ArrayList<CommandExecMessage>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public void add(CommandExecMessage message) {
|
|
||||||
this.messages.add(message);
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean OK () {
|
|
||||||
return this.getStatus() != CommandExecResultStatus.FAIL;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecResultStatus getStatus() {
|
|
||||||
int status = 100;
|
|
||||||
for (CommandExecMessage message : messages) {
|
|
||||||
if (status > message.getStatus().getCode()) {
|
|
||||||
status = message.getStatus().getCode();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return CommandExecResultStatus.ofCode(status);
|
|
||||||
}
|
|
||||||
|
|
||||||
public void print() {
|
|
||||||
for (CommandExecMessage message : messages) {
|
|
||||||
message.print();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
package link.pagan.traqtor._api.result;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public enum CommandExecResultStatus {
|
|
||||||
DONE(0),
|
|
||||||
WARN(-1),
|
|
||||||
FAIL(-2);
|
|
||||||
|
|
||||||
int code;
|
|
||||||
|
|
||||||
private CommandExecResultStatus(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static CommandExecResultStatus ofCode (int code) {
|
|
||||||
if (code < -1) return FAIL;
|
|
||||||
if (code == -1) return WARN;
|
|
||||||
return DONE;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,33 +0,0 @@
|
|||||||
package link.pagan.traqtor._api.result.message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class CommandExecMessage {
|
|
||||||
|
|
||||||
final CommandExecMessageStatus status;
|
|
||||||
final String message;
|
|
||||||
|
|
||||||
public CommandExecMessage(CommandExecMessageStatus status, String message) {
|
|
||||||
this.status = status;
|
|
||||||
this.message = message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecMessageStatus getStatus() {
|
|
||||||
return status;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String getMessage() {
|
|
||||||
return message;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void print() {
|
|
||||||
// if (status.getCode() < 0) {
|
|
||||||
System.out.println(status.toString() + " : " + message);
|
|
||||||
// } else {
|
|
||||||
// System.out.println(status.toString() + " : " + message);
|
|
||||||
// }
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,28 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor._api.result.message;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public enum CommandExecMessageStatus {
|
|
||||||
INFO(1),
|
|
||||||
DONE(0),
|
|
||||||
WARN(-1),
|
|
||||||
FAIL(-2);
|
|
||||||
|
|
||||||
int code;
|
|
||||||
|
|
||||||
private CommandExecMessageStatus(int code) {
|
|
||||||
this.code = code;
|
|
||||||
}
|
|
||||||
|
|
||||||
public int getCode() {
|
|
||||||
return code;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,303 +0,0 @@
|
|||||||
package link.pagan.traqtor.api;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import link.pagan.traqtor._api.UnaryCommand;
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
import link.pagan.traqtor._api.result.message.CommandExecMessage;
|
|
||||||
import link.pagan.traqtor._api.result.message.CommandExecMessageStatus;
|
|
||||||
import link.pagan.traqtor.api.project.Project;
|
|
||||||
import link.pagan.traqtor.api.project.universe.UniverseProject;
|
|
||||||
import link.pagan.traqtor.api.workspace.Workspace;
|
|
||||||
import link.pagan.traqtor.schema.data.DataTypeSchema;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class API {
|
|
||||||
|
|
||||||
private static boolean workspaceExists (CommandExecResult result, Traqtor traqtor) {
|
|
||||||
if (traqtor.workspace() == null) {
|
|
||||||
result.add(new CommandExecMessage(CommandExecMessageStatus.FAIL, "No workspace initialized"));
|
|
||||||
return false;
|
|
||||||
}
|
|
||||||
return true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class CreateWorkspace extends UnaryCommand<Traqtor> {
|
|
||||||
|
|
||||||
private final Name name;
|
|
||||||
private final String path;
|
|
||||||
|
|
||||||
public CreateWorkspace() {
|
|
||||||
this(Workspace.DEFAULT_WORKSPACE_NAME);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreateWorkspace(Name name) {
|
|
||||||
this(name, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public CreateWorkspace(Name name, String path) {
|
|
||||||
this.name = name;
|
|
||||||
this.path = path;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommandExecResult exec() {
|
|
||||||
if (arg.workspace() != null) {
|
|
||||||
return fail("There is an open workspace - please close this first, before creating new one");
|
|
||||||
}
|
|
||||||
arg.workspace(new Workspace());
|
|
||||||
arg.workspace().name(name);
|
|
||||||
subexec(new API.WorkspaceLoadDataTypeSchema(Name.of("traqtor", "basic")));
|
|
||||||
if (!result.OK()) {
|
|
||||||
arg.workspace(null);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
if (path != null) {
|
|
||||||
subexec(new SaveAsWorkspace(path));
|
|
||||||
if (!result.OK()) {
|
|
||||||
arg.workspace(null);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SaveAsWorkspace extends UnaryCommand<Traqtor> {
|
|
||||||
|
|
||||||
private final String workspacePath;
|
|
||||||
|
|
||||||
public SaveAsWorkspace(String workspacePath) {
|
|
||||||
this.workspacePath = workspacePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommandExecResult exec() {
|
|
||||||
File workspaceDir = new File(workspacePath);
|
|
||||||
if (!workspaceDir.exists()) {
|
|
||||||
if (!workspaceDir.mkdir()) {
|
|
||||||
return fail("Failed to create workspace root directory at " + workspacePath);
|
|
||||||
} else {
|
|
||||||
info("Workspace root directory created at " + workspacePath);
|
|
||||||
}
|
|
||||||
} else {
|
|
||||||
if (workspaceDir.listFiles().length > 0) {
|
|
||||||
return fail("Root directory is not empty, failed to assing " + workspacePath + " as root for workspace");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
File workspaceFile = new File(workspacePath, Workspace.JSON_FILENAME + ".json");
|
|
||||||
if (!workspaceFile.exists()) {
|
|
||||||
try {
|
|
||||||
if (!workspaceFile.createNewFile()) {
|
|
||||||
return fail("Failed to create " + Workspace.JSON_FILENAME + ".json in workspace root directory");
|
|
||||||
}
|
|
||||||
} catch (IOException ex) {
|
|
||||||
return fail("IO erorr while creating " + Workspace.JSON_FILENAME + ".json in workspace root directory");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
String hold = arg.workspace().root();
|
|
||||||
arg.workspace().root(workspacePath);
|
|
||||||
subexec(new SaveWorkspace());
|
|
||||||
if (!result.OK()) {
|
|
||||||
arg.workspace().root(hold);
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class SaveWorkspace extends UnaryCommand<Traqtor> {
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommandExecResult exec() {
|
|
||||||
String workspacePath = arg.workspace().root();
|
|
||||||
if (arg.workspace().root() == null) {
|
|
||||||
return fail("Workspace was not saved before - use \"save as\" command for the first save");
|
|
||||||
}
|
|
||||||
File workspaceFile = new File(workspacePath, Workspace.JSON_FILENAME + ".json");
|
|
||||||
|
|
||||||
if (!workspaceFile.exists()) {
|
|
||||||
return fail("Failed to save, " + Workspace.JSON_FILENAME + ".json does not exist, workspace corrupted?");
|
|
||||||
}
|
|
||||||
|
|
||||||
if (!workspaceFile.canWrite()) {
|
|
||||||
return fail("Can not write " + Workspace.JSON_FILENAME + ".json - permission denied");
|
|
||||||
}
|
|
||||||
|
|
||||||
try {
|
|
||||||
arg.workspace().mapper().writeValue(workspaceFile, arg.workspace());
|
|
||||||
} catch (IOException ex) {
|
|
||||||
System.err.println(ex);
|
|
||||||
return fail("Failed to write " + Workspace.JSON_FILENAME + ".json");
|
|
||||||
}
|
|
||||||
|
|
||||||
//TODO add project save
|
|
||||||
// for (Project project : arg.workspace().projects()) {
|
|
||||||
// subexec(new )
|
|
||||||
// }
|
|
||||||
|
|
||||||
arg.workspace().dirty(false);
|
|
||||||
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class LoadWorkspace extends UnaryCommand<Traqtor> {
|
|
||||||
|
|
||||||
private final String workspacePath;
|
|
||||||
|
|
||||||
public LoadWorkspace(String workspacePath) {
|
|
||||||
this.workspacePath = workspacePath;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommandExecResult exec() {
|
|
||||||
File workspaceFile = new File(workspacePath, Workspace.JSON_FILENAME + ".json");
|
|
||||||
if (!workspaceFile.exists()) {
|
|
||||||
return fail("No " + Workspace.JSON_FILENAME + ".json file found in selected directory, missed?");
|
|
||||||
}
|
|
||||||
|
|
||||||
ObjectMapper mapper = new ObjectMapper();
|
|
||||||
SimpleModule module = new SimpleModule();
|
|
||||||
module.addDeserializer(Workspace.class, new Workspace.WorkspaceDeserializer());
|
|
||||||
mapper.registerModule(module);
|
|
||||||
|
|
||||||
Workspace workspace = null;
|
|
||||||
try {
|
|
||||||
workspace = mapper.readValue(workspaceFile, Workspace.class);
|
|
||||||
} catch (IOException ex) {
|
|
||||||
System.err.println(ex);
|
|
||||||
return fail("Failed to read " + workspaceFile.getAbsolutePath());
|
|
||||||
}
|
|
||||||
workspace.root(workspacePath);
|
|
||||||
HashMap<Name, DataTypeSchema> schemas = workspace.dataTypeSchemas();
|
|
||||||
for (Name name : schemas.keySet()) {
|
|
||||||
if (schemas.get(name) == null) {
|
|
||||||
DataTypeSchema loaded = arg.dataTypeSchemas.get(name);
|
|
||||||
if (loaded == null) {
|
|
||||||
warn("Shema with name " + name.asDotted() + " was not found in system. Preload or give up");
|
|
||||||
} else {
|
|
||||||
schemas.put(name, loaded);
|
|
||||||
info("Shema " + name.asDotted() + " was found and loaded into workspace on load");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
arg.workspace(workspace);
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class WorkspaceLoadDataTypeSchema extends UnaryCommand<Traqtor> {
|
|
||||||
|
|
||||||
private final Name name;
|
|
||||||
|
|
||||||
public WorkspaceLoadDataTypeSchema(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommandExecResult exec() {
|
|
||||||
if (!workspaceExists(result, arg)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
DataTypeSchema schema = arg.dataTypeSchemas.get(this.name);
|
|
||||||
if (schema == null) {
|
|
||||||
return fail("Unable to load data type schema by name " + name.asDotted());
|
|
||||||
}
|
|
||||||
arg.workspace().dataTypeSchemas().put(schema.getName(), schema);
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class WorkspaceCreateUniverseProject extends UnaryCommand<Traqtor> {
|
|
||||||
|
|
||||||
private final Name name;
|
|
||||||
private final Name schema;
|
|
||||||
|
|
||||||
public WorkspaceCreateUniverseProject(Name name, Name schema) {
|
|
||||||
this.name = name;
|
|
||||||
this.schema = schema;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommandExecResult exec() {
|
|
||||||
if (!workspaceExists(result, arg)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Workspace workspace = arg.workspace();
|
|
||||||
DataTypeSchema dataTypeSchema = workspace.dataTypeSchemas().get(schema);
|
|
||||||
if (dataTypeSchema == null) {
|
|
||||||
return fail("Data type schema with name " + schema.asDotted() + " was not found");
|
|
||||||
}
|
|
||||||
if (workspace.projects().containsKey(this.name)) {
|
|
||||||
return fail("Project with name " + this.name + " already exists");
|
|
||||||
}
|
|
||||||
|
|
||||||
Project project = new UniverseProject(name, dataTypeSchema);
|
|
||||||
workspace.projects().put(project.name(), project);
|
|
||||||
workspace.dirty(true);
|
|
||||||
|
|
||||||
CommandExecResult saveResult = arg.execute(new API.SaveWorkspace());
|
|
||||||
if (!saveResult.OK()) {
|
|
||||||
return fail("Failed to save workspace, after project addition");
|
|
||||||
}
|
|
||||||
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static class ProjectSave extends UnaryCommand<Traqtor> {
|
|
||||||
|
|
||||||
private final Name name;
|
|
||||||
private final Name schema;
|
|
||||||
|
|
||||||
public ProjectSave(Name name, Name schema) {
|
|
||||||
this.name = name;
|
|
||||||
this.schema = schema;
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public CommandExecResult exec() {
|
|
||||||
if (!workspaceExists(result, arg)) {
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
Workspace workspace = arg.workspace();
|
|
||||||
DataTypeSchema dataTypeSchema = workspace.dataTypeSchemas().get(schema);
|
|
||||||
if (dataTypeSchema == null) {
|
|
||||||
return fail("Data type schema with name " + schema.asDotted() + " was not found");
|
|
||||||
}
|
|
||||||
if (workspace.projects().containsKey(this.name)) {
|
|
||||||
return fail("Project with name " + this.name + " already exists");
|
|
||||||
}
|
|
||||||
|
|
||||||
Project project = new UniverseProject(name, dataTypeSchema);
|
|
||||||
workspace.projects().put(project.name(), project);
|
|
||||||
workspace.dirty(true);
|
|
||||||
|
|
||||||
CommandExecResult saveResult = arg.execute(new API.SaveWorkspace());
|
|
||||||
if (!saveResult.OK()) {
|
|
||||||
return fail("Failed to save workspace, after project addition");
|
|
||||||
}
|
|
||||||
|
|
||||||
return done();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,63 +0,0 @@
|
|||||||
package link.pagan.traqtor.api;
|
|
||||||
|
|
||||||
import java.util.HashMap;
|
|
||||||
import java.util.Map;
|
|
||||||
import link.pagan.traqtor._api.UnaryCommand;
|
|
||||||
import link.pagan.traqtor._api.Commanded;
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResultStatus;
|
|
||||||
import link.pagan.traqtor.api.workspace.Workspace;
|
|
||||||
import link.pagan.traqtor.schema.basic.data.DataTypeSchemaReferenceImplementation;
|
|
||||||
import link.pagan.traqtor.schema.data.DataTypeSchema;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class Traqtor implements Commanded {
|
|
||||||
|
|
||||||
private Workspace workspace;
|
|
||||||
|
|
||||||
Map<Name, DataTypeSchema> dataTypeSchemas;
|
|
||||||
|
|
||||||
public static Traqtor init() {
|
|
||||||
Traqtor traqtor = new Traqtor();
|
|
||||||
traqtor.registerDataTypeSchema(new DataTypeSchemaReferenceImplementation());
|
|
||||||
return traqtor;
|
|
||||||
}
|
|
||||||
|
|
||||||
private void registerDataTypeSchema(DataTypeSchema schema) {
|
|
||||||
this.dataTypeSchemas.put(schema.getName(), schema);
|
|
||||||
}
|
|
||||||
|
|
||||||
private Traqtor() {
|
|
||||||
this.dataTypeSchemas = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Workspace workspace() {
|
|
||||||
return workspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void workspace(Workspace workspace) {
|
|
||||||
this.workspace = workspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
public CommandExecResult execute(UnaryCommand<Traqtor> command) {
|
|
||||||
CommandExecResult result = new CommandExecResult();
|
|
||||||
command.setResultHolder(result);
|
|
||||||
command.setArg(this);
|
|
||||||
command.exec();
|
|
||||||
if (!UnaryCommand.mute()) {
|
|
||||||
if (UnaryCommand.paranoidLoggingEnabled()) {
|
|
||||||
result.print();
|
|
||||||
} else {
|
|
||||||
if (result.getStatus() != CommandExecResultStatus.DONE) {
|
|
||||||
result.print();
|
|
||||||
}
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return result;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,42 +0,0 @@
|
|||||||
package link.pagan.traqtor.api.project;
|
|
||||||
|
|
||||||
import link.pagan.traqtor._api.Commanded;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public abstract class Project implements Commanded {
|
|
||||||
|
|
||||||
private final ProjectType type;
|
|
||||||
private Name name;
|
|
||||||
private boolean dirty;
|
|
||||||
|
|
||||||
public Project(ProjectType type, Name name) {
|
|
||||||
this.type = type;
|
|
||||||
this.name = name;
|
|
||||||
this.dirty = true;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectType type() {
|
|
||||||
return type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean dirty() {
|
|
||||||
return dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dirty(boolean dirty) {
|
|
||||||
this.dirty = dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,74 +0,0 @@
|
|||||||
package link.pagan.traqtor.api.project;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public enum ProjectType {
|
|
||||||
UNIVERSE("universe"),
|
|
||||||
DATABASE("database"),
|
|
||||||
FRONTEND("frontend"),
|
|
||||||
BACKEND("backend");
|
|
||||||
|
|
||||||
String jsonValue;
|
|
||||||
|
|
||||||
private ProjectType(String jsonValue) {
|
|
||||||
this.jsonValue = jsonValue;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class ProjectTypeSerializer extends StdSerializer<ProjectType> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public ProjectTypeSerializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectTypeSerializer(Class<ProjectType> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(ProjectType value, JsonGenerator gen, SerializerProvider provider) throws IOException {
|
|
||||||
gen.writeString(value.jsonValue);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class ProjectTypeDeserializer extends StdDeserializer<ProjectType> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public ProjectTypeDeserializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ProjectTypeDeserializer(Class<ProjectType> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public ProjectType deserialize(JsonParser parser, DeserializationContext ctxt) throws IOException, JsonProcessingException {
|
|
||||||
JsonNode stringType = parser.getCodec().readTree(parser);
|
|
||||||
String type = stringType.asText();
|
|
||||||
for (ProjectType pt : values()) {
|
|
||||||
if (pt.jsonValue.equals(type)) {
|
|
||||||
return pt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.api.project.backend;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.api.project.Project;
|
|
||||||
import link.pagan.traqtor.api.project.ProjectType;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class BackendProject extends Project {
|
|
||||||
|
|
||||||
public BackendProject(Name name) {
|
|
||||||
super(ProjectType.BACKEND, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.api.project.database;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.api.project.Project;
|
|
||||||
import link.pagan.traqtor.api.project.ProjectType;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class DatabaseProject extends Project {
|
|
||||||
|
|
||||||
public DatabaseProject(Name name) {
|
|
||||||
super(ProjectType.DATABASE, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.api.project.frontend;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.api.project.Project;
|
|
||||||
import link.pagan.traqtor.api.project.ProjectType;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class FrontendProject extends Project {
|
|
||||||
|
|
||||||
public FrontendProject(Name name) {
|
|
||||||
super(ProjectType.FRONTEND, name);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,22 +0,0 @@
|
|||||||
package link.pagan.traqtor.api.project.universe;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.api.project.Project;
|
|
||||||
import link.pagan.traqtor.api.project.ProjectType;
|
|
||||||
import link.pagan.traqtor.schema.data.DataTypeSchema;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class UniverseProject extends Project {
|
|
||||||
|
|
||||||
DataTypeSchema dataTypeSchema;
|
|
||||||
|
|
||||||
public UniverseProject(Name name, DataTypeSchema dataTypeSchema) {
|
|
||||||
super(ProjectType.UNIVERSE, name);
|
|
||||||
this.dataTypeSchema = dataTypeSchema;
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,188 +0,0 @@
|
|||||||
package link.pagan.traqtor.api.workspace;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.core.JsonParser;
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import com.fasterxml.jackson.databind.DeserializationContext;
|
|
||||||
import com.fasterxml.jackson.databind.JsonNode;
|
|
||||||
import com.fasterxml.jackson.databind.ObjectMapper;
|
|
||||||
import com.fasterxml.jackson.databind.SerializationFeature;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.fasterxml.jackson.databind.deser.std.StdDeserializer;
|
|
||||||
import com.fasterxml.jackson.databind.module.SimpleModule;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.HashMap;
|
|
||||||
import link.pagan.traqtor._api.Commanded;
|
|
||||||
import link.pagan.traqtor.api.project.Project;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.AtomBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.LinkBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.LinkType;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.ParticleBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.UniverseBlueprint;
|
|
||||||
import link.pagan.traqtor.schema.data.DataTypeSchema;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class Workspace implements Commanded {
|
|
||||||
|
|
||||||
public static final String JSON_FILENAME = "workspace";
|
|
||||||
public static final Name DEFAULT_WORKSPACE_NAME = Name.of("workspace");
|
|
||||||
|
|
||||||
private final ObjectMapper mapper;
|
|
||||||
|
|
||||||
private boolean dirty;
|
|
||||||
|
|
||||||
private String root;
|
|
||||||
|
|
||||||
private Name name;
|
|
||||||
private HashMap<Name, DataTypeSchema> schemas;
|
|
||||||
private HashMap<Name, Project> projects;
|
|
||||||
|
|
||||||
public Workspace() {
|
|
||||||
this.mapper = new ObjectMapper().enable(SerializationFeature.INDENT_OUTPUT);
|
|
||||||
|
|
||||||
SimpleModule module = new SimpleModule();
|
|
||||||
module.addSerializer(Workspace.class, new Workspace.WorkspaceSerializer());
|
|
||||||
|
|
||||||
module.addSerializer(UniverseBlueprint.class, new UniverseBlueprint.UniverseBlueprintSerializer());
|
|
||||||
module.addSerializer(Name.class, new Name.NameSerializer());
|
|
||||||
module.addDeserializer(Name.class, new Name.NameDeserializer());
|
|
||||||
module.addSerializer(ParticleBlueprint.class, new ParticleBlueprint.ParticleBlueprintSerializer());
|
|
||||||
module.addSerializer(AtomBlueprint.class, new AtomBlueprint.AtomBlueprintSerializer());
|
|
||||||
module.addSerializer(LinkBlueprint.class, new LinkBlueprint.LinkBlueprintSerializer());
|
|
||||||
module.addSerializer(LinkType.class, new LinkType.LinkTypeSerializer());
|
|
||||||
mapper.registerModule(module);
|
|
||||||
this.dirty = true;
|
|
||||||
this.projects = new HashMap<>();
|
|
||||||
this.schemas = new HashMap<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public String root() {
|
|
||||||
return root;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void root(String root) {
|
|
||||||
this.root = root;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ObjectMapper mapper() {
|
|
||||||
return mapper;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean dirty() {
|
|
||||||
return dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public void dirty(boolean dirty) {
|
|
||||||
this.dirty = dirty;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<Name, DataTypeSchema> dataTypeSchemas() {
|
|
||||||
return schemas;
|
|
||||||
}
|
|
||||||
|
|
||||||
public HashMap<Name, Project> projects() {
|
|
||||||
return projects;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class WorkspaceSerializer extends StdSerializer<Workspace> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public WorkspaceSerializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorkspaceSerializer(Class<Workspace> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(Workspace value, JsonGenerator gen, SerializerProvider provider) throws IOException {
|
|
||||||
gen.writeStartObject();
|
|
||||||
gen.writeObjectField("name", value.name);
|
|
||||||
gen.writeBooleanField("pretty", value.mapper.isEnabled(SerializationFeature.INDENT_OUTPUT));
|
|
||||||
gen.writeArrayFieldStart("schemas");
|
|
||||||
ArrayList<Name> schemaNames = new ArrayList<>();
|
|
||||||
for (Name schemaName : value.schemas.keySet()) {
|
|
||||||
schemaNames.add(schemaName);
|
|
||||||
}
|
|
||||||
schemaNames.sort(Name.COMPARATOR);
|
|
||||||
for (Name name : schemaNames) {
|
|
||||||
gen.writeObject(name);
|
|
||||||
}
|
|
||||||
gen.writeEndArray();
|
|
||||||
|
|
||||||
gen.writeArrayFieldStart("projects");
|
|
||||||
ArrayList<Name> projectNames = new ArrayList<>();
|
|
||||||
for (Name projectName : value.projects.keySet()) {
|
|
||||||
projectNames.add(projectName);
|
|
||||||
}
|
|
||||||
projectNames.sort(Name.COMPARATOR);
|
|
||||||
for (Name name : projectNames) {
|
|
||||||
gen.writeObject(name);
|
|
||||||
}
|
|
||||||
gen.writeEndArray();
|
|
||||||
|
|
||||||
gen.writeEndObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class WorkspaceDeserializer extends StdDeserializer<Workspace> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public WorkspaceDeserializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public WorkspaceDeserializer(Class<Workspace> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public Workspace deserialize(JsonParser parser, DeserializationContext context) throws IOException, JsonProcessingException {
|
|
||||||
Workspace workspace = new Workspace();
|
|
||||||
|
|
||||||
JsonNode node = parser.getCodec().readTree(parser);
|
|
||||||
boolean pretty = node.get("pretty").asBoolean(false);
|
|
||||||
|
|
||||||
if (pretty) {
|
|
||||||
workspace.mapper.enable(SerializationFeature.INDENT_OUTPUT);
|
|
||||||
} else {
|
|
||||||
workspace.mapper.disable(SerializationFeature.INDENT_OUTPUT);
|
|
||||||
}
|
|
||||||
|
|
||||||
Name name = workspace.mapper.treeToValue(node.get("name"), Name.class);
|
|
||||||
workspace.name(name);
|
|
||||||
|
|
||||||
for (JsonNode schema : node.get("schemas")) {
|
|
||||||
Name readValue = workspace.mapper.readValue(schema.toString(), Name.class);
|
|
||||||
workspace.schemas.put(readValue, null);
|
|
||||||
}
|
|
||||||
|
|
||||||
for (JsonNode project : node.get("projects")) {
|
|
||||||
workspace.projects.put(workspace.mapper.readValue(project.asText(), Name.class), null);
|
|
||||||
}
|
|
||||||
|
|
||||||
workspace.dirty = false;
|
|
||||||
return workspace;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,29 +0,0 @@
|
|||||||
package link.pagan.traqtor._api;
|
|
||||||
|
|
||||||
import java.io.File;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.nio.file.Files;
|
|
||||||
import java.nio.file.Path;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class TraqtorApiTestUtils {
|
|
||||||
|
|
||||||
public static final String TEST_WORKSPACE_ROOT = new File(new File("").getAbsoluteFile().getParentFile(), "traqtor-demo-workspace").getAbsolutePath();
|
|
||||||
public static final Name TEST_WORKSPACE_NAME = Name.of("traqtor", "demo", "workspace");
|
|
||||||
|
|
||||||
public static final void killTestRoot() throws IOException {
|
|
||||||
File root = new File(TEST_WORKSPACE_ROOT);
|
|
||||||
if (root.exists()) {
|
|
||||||
Files.walk(new File(TEST_WORKSPACE_ROOT).toPath())
|
|
||||||
.sorted(Comparator.reverseOrder())
|
|
||||||
.map(Path::toFile)
|
|
||||||
.forEach(File::delete);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,59 +0,0 @@
|
|||||||
package link.pagan.traqtor.api;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import link.pagan.traqtor._api.TraqtorApiTestUtils;
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
import static link.pagan.traqtor._api.result.CommandExecResultStatus.DONE;
|
|
||||||
import static link.pagan.traqtor._api.result.CommandExecResultStatus.FAIL;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class TraqtorTest {
|
|
||||||
|
|
||||||
CommandExecResult result;
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
public void cleanTestDir() throws IOException {
|
|
||||||
TraqtorApiTestUtils.killTestRoot();
|
|
||||||
// Executor.enableParanoindLoggin();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("New workspace creation")
|
|
||||||
void newWorkspaceSave() {
|
|
||||||
Traqtor traqtor = Traqtor.init();
|
|
||||||
result = traqtor.execute(new API.CreateWorkspace());
|
|
||||||
assertEquals(DONE, result.getStatus());
|
|
||||||
assertEquals(traqtor.workspace().dirty(), true);
|
|
||||||
result = traqtor.execute(new API.SaveWorkspace());
|
|
||||||
assertEquals(FAIL, result.getStatus());
|
|
||||||
assertEquals(traqtor.workspace().dirty(), true);
|
|
||||||
result = traqtor.execute(new API.SaveAsWorkspace(TraqtorApiTestUtils.TEST_WORKSPACE_ROOT));
|
|
||||||
assertEquals(DONE, result.getStatus());
|
|
||||||
assertEquals(traqtor.workspace().dirty(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("Workspace load")
|
|
||||||
void newSaveLoad() {
|
|
||||||
Traqtor traqtor = Traqtor.init();
|
|
||||||
result = traqtor.execute(new API.CreateWorkspace(TraqtorApiTestUtils.TEST_WORKSPACE_NAME, TraqtorApiTestUtils.TEST_WORKSPACE_ROOT));
|
|
||||||
assertEquals(DONE, result.getStatus());
|
|
||||||
assertEquals(traqtor.workspace().dirty(), false);
|
|
||||||
traqtor = Traqtor.init();
|
|
||||||
result = traqtor.execute(new API.LoadWorkspace(TraqtorApiTestUtils.TEST_WORKSPACE_ROOT));
|
|
||||||
assertEquals(DONE, result.getStatus());
|
|
||||||
assertEquals(traqtor.workspace().dirty(), false);
|
|
||||||
assertEquals(traqtor.workspace().dataTypeSchemas().size(), 1);
|
|
||||||
result = traqtor.execute(new API.SaveWorkspace());
|
|
||||||
assertEquals(DONE, result.getStatus());
|
|
||||||
assertEquals(traqtor.workspace().dirty(), false);
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,35 +0,0 @@
|
|||||||
package link.pagan.traqtor.api.workspace;
|
|
||||||
|
|
||||||
import java.io.IOException;
|
|
||||||
import link.pagan.traqtor._api.TraqtorApiTestUtils;
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
import static link.pagan.traqtor._api.result.CommandExecResultStatus.DONE;
|
|
||||||
import link.pagan.traqtor.api.API;
|
|
||||||
import link.pagan.traqtor.api.Traqtor;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import org.junit.jupiter.api.BeforeEach;
|
|
||||||
import org.junit.jupiter.api.DisplayName;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
public class WorkspaceTest {
|
|
||||||
|
|
||||||
CommandExecResult result;
|
|
||||||
|
|
||||||
@BeforeEach
|
|
||||||
public void cleanTestDir() throws IOException {
|
|
||||||
TraqtorApiTestUtils.killTestRoot();
|
|
||||||
// Executor.enableParanoindLoggin();
|
|
||||||
}
|
|
||||||
|
|
||||||
@Test
|
|
||||||
@DisplayName("Create project")
|
|
||||||
void newSaveLoad() {
|
|
||||||
Traqtor traqtor = Traqtor.init();
|
|
||||||
result = traqtor.execute(new API.CreateWorkspace(TraqtorApiTestUtils.TEST_WORKSPACE_NAME, TraqtorApiTestUtils.TEST_WORKSPACE_ROOT));
|
|
||||||
assertEquals(DONE, result.getStatus());
|
|
||||||
assertEquals(traqtor.workspace().dirty(), false);
|
|
||||||
traqtor.execute(new API.WorkspaceCreateUniverseProject(Name.of("universe"), Name.of("traqtor", "basic")));
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,90 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonProcessingException;
|
|
||||||
import link.pagan.traqtor._api.result.CommandExecResult;
|
|
||||||
import static link.pagan.traqtor._api.result.CommandExecResultStatus.DONE;
|
|
||||||
import link.pagan.traqtor.api.API;
|
|
||||||
import link.pagan.traqtor.api.Traqtor;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.LinkType;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.build.LinkBlueprintBuilder;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.build.AtomBlueprintBuilder;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.build.ParticleBlueprintBuilder;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.build.UniverseBlueprintBuilder;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.UniverseBlueprint;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import link.pagan.traqtor.schema.basic.data.DataTypeSchemaReferenceImplementation;
|
|
||||||
import static org.junit.jupiter.api.Assertions.assertEquals;
|
|
||||||
import org.junit.jupiter.api.Test;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class UniverseBlueprintTest {
|
|
||||||
|
|
||||||
@Test
|
|
||||||
void programmaticBuild() throws JsonProcessingException {
|
|
||||||
UniverseBlueprintBuilder builder = new UniverseBlueprintBuilder(new DataTypeSchemaReferenceImplementation());
|
|
||||||
builder
|
|
||||||
.addAtom(new AtomBlueprintBuilder()
|
|
||||||
.name(Name.of("account"))
|
|
||||||
.description("Base user atom")
|
|
||||||
.addParticle(new ParticleBlueprintBuilder()
|
|
||||||
.name(Name.of("nickname"))
|
|
||||||
.description("User nickname, just in case")
|
|
||||||
.type("string")
|
|
||||||
)
|
|
||||||
.addParticle(new ParticleBlueprintBuilder()
|
|
||||||
.name(Name.of("email"))
|
|
||||||
.description("Main auth facility for user")
|
|
||||||
.type("string")
|
|
||||||
)
|
|
||||||
.addParticle(new ParticleBlueprintBuilder()
|
|
||||||
.name(Name.of("phone"))
|
|
||||||
.description("Alternative user authentification facility")
|
|
||||||
.type("string")
|
|
||||||
)
|
|
||||||
.addParticle(new ParticleBlueprintBuilder()
|
|
||||||
.name(Name.of("password"))
|
|
||||||
.description("User password")
|
|
||||||
.type("string")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.addAtom(new AtomBlueprintBuilder()
|
|
||||||
.name(Name.of("account", "details"))
|
|
||||||
.description("User info atom")
|
|
||||||
.addParticle(new ParticleBlueprintBuilder()
|
|
||||||
.name(Name.of("first", "name"))
|
|
||||||
.description("First name of a user")
|
|
||||||
.type("string")
|
|
||||||
)
|
|
||||||
.addParticle(new ParticleBlueprintBuilder()
|
|
||||||
.name(Name.of("last", "name"))
|
|
||||||
.description("Last name of a user")
|
|
||||||
.type("string")
|
|
||||||
)
|
|
||||||
.addParticle(new ParticleBlueprintBuilder()
|
|
||||||
.name(Name.of("middle", "names"))
|
|
||||||
.description("Middle names of a user")
|
|
||||||
.type("string")
|
|
||||||
)
|
|
||||||
)
|
|
||||||
.addLink(new LinkBlueprintBuilder()
|
|
||||||
.from(Name.of("account"))
|
|
||||||
.to(Name.of("account", "details"))
|
|
||||||
.type(LinkType.ONE_TO_ONE)
|
|
||||||
);
|
|
||||||
|
|
||||||
UniverseBlueprint build = builder.build();
|
|
||||||
|
|
||||||
|
|
||||||
Traqtor traqtor = Traqtor.init();
|
|
||||||
CommandExecResult result = traqtor.execute(new API.CreateWorkspace());
|
|
||||||
assertEquals(result.getStatus(), DONE);
|
|
||||||
assertEquals(traqtor.workspace().dirty(), true);
|
|
||||||
String serialized = traqtor.workspace().mapper().writeValueAsString(build);
|
|
||||||
System.out.println(serialized);
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,34 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<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">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>link.pagan</groupId>
|
|
||||||
<artifactId>traqtor</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<groupId>link.pagan</groupId>
|
|
||||||
<artifactId>traqtor-framework</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>TraQtor / Framework </name>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
</properties>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.hibernate.validator</groupId>
|
|
||||||
<artifactId>hibernate-validator</artifactId>
|
|
||||||
<version>6.2.0.Final</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.glassfish</groupId>
|
|
||||||
<artifactId>jakarta.el</artifactId>
|
|
||||||
<version>3.0.3</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>org.apache.cayenne</groupId>
|
|
||||||
<artifactId>cayenne-server</artifactId>
|
|
||||||
<version>4.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
</project>
|
|
||||||
@ -1,13 +0,0 @@
|
|||||||
package link.pagan.traqtor.framework.data;
|
|
||||||
|
|
||||||
import org.apache.cayenne.BaseDataObject;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class DatabaseDataObject extends BaseDataObject {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1448137394405559485L;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.framework.logic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class Registry {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.framework.logic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class Resource {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.framework.logic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class Service {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,31 +0,0 @@
|
|||||||
<?xml version="1.0"?>
|
|
||||||
<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">
|
|
||||||
<modelVersion>4.0.0</modelVersion>
|
|
||||||
<parent>
|
|
||||||
<groupId>link.pagan</groupId>
|
|
||||||
<artifactId>traqtor</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
</parent>
|
|
||||||
<groupId>link.pagan</groupId>
|
|
||||||
<artifactId>traqtor-generator</artifactId>
|
|
||||||
<version>0.0.1-SNAPSHOT</version>
|
|
||||||
<packaging>jar</packaging>
|
|
||||||
<name>TraQtor / Source generator </name>
|
|
||||||
<dependencies>
|
|
||||||
<dependency>
|
|
||||||
<groupId>${project.groupId}</groupId>
|
|
||||||
<artifactId>traqtor-schema</artifactId>
|
|
||||||
<version>${project.version}</version>
|
|
||||||
</dependency>
|
|
||||||
<dependency>
|
|
||||||
<groupId>com.fasterxml.jackson.core</groupId>
|
|
||||||
<artifactId>jackson-databind</artifactId>
|
|
||||||
<version>2.12.1</version>
|
|
||||||
</dependency>
|
|
||||||
</dependencies>
|
|
||||||
<properties>
|
|
||||||
<project.build.sourceEncoding>UTF-8</project.build.sourceEncoding>
|
|
||||||
<maven.compiler.source>11</maven.compiler.source>
|
|
||||||
<maven.compiler.target>11</maven.compiler.target>
|
|
||||||
</properties>
|
|
||||||
</project>
|
|
||||||
@ -1,30 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.generator.blueprint.database.builder.ColumnBlueprintBuilder;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.database.builder.DatabaseBlueprintBuilder;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.database.builder.SchemeBlueprintBuilder;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.database.builder.TableBlueprintBuilder;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class R {
|
|
||||||
|
|
||||||
public static DatabaseBlueprintBuilder database() {
|
|
||||||
return new DatabaseBlueprintBuilder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static SchemeBlueprintBuilder schema() {
|
|
||||||
return new SchemeBlueprintBuilder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static TableBlueprintBuilder table() {
|
|
||||||
return new TableBlueprintBuilder();
|
|
||||||
}
|
|
||||||
|
|
||||||
public static ColumnBlueprintBuilder column() {
|
|
||||||
return new ColumnBlueprintBuilder();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public abstract class ProjectBlueprint {
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
// String name;
|
|
||||||
// Name rootPackage;
|
|
||||||
// String description;
|
|
||||||
|
|
||||||
//
|
|
||||||
// public void assemble() {
|
|
||||||
//
|
|
||||||
// }
|
|
||||||
//
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.backend;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class BackendBlueprint {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,27 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.database;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import link.pagan.traqtor.schema.data.DataType;
|
|
||||||
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class ColumnBlueprint {
|
|
||||||
|
|
||||||
Name name;
|
|
||||||
DataType dataType;
|
|
||||||
|
|
||||||
public ColumnBlueprint(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.database;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class DatabaseBlueprint {
|
|
||||||
|
|
||||||
String name;
|
|
||||||
// private List<SchemeBlueprint> schemas;
|
|
||||||
// private DatabaseAdapter databaseAdapter;
|
|
||||||
|
|
||||||
public DatabaseBlueprint(String name) {
|
|
||||||
this.name = name;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.database;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class SchemeBlueprint {
|
|
||||||
|
|
||||||
String name;
|
|
||||||
ArrayList<TableBlueprint> tables;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.database;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class TableBlueprint {
|
|
||||||
|
|
||||||
String name;
|
|
||||||
ArrayList<ColumnBlueprint> columns;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.database.builder;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.generator.blueprint.database.ColumnBlueprint;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import link.pagan.traqtor.schema.data.DataType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class ColumnBlueprintBuilder {
|
|
||||||
|
|
||||||
private Name name;
|
|
||||||
private boolean pk;
|
|
||||||
private DataType dataType;
|
|
||||||
|
|
||||||
public ColumnBlueprintBuilder() {
|
|
||||||
this.pk = false;
|
|
||||||
}
|
|
||||||
|
|
||||||
public boolean pk() {
|
|
||||||
return this.pk;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColumnBlueprintBuilder pk(boolean pk) {
|
|
||||||
this.pk = pk;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColumnBlueprintBuilder name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DataType dataType() {
|
|
||||||
return dataType;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColumnBlueprintBuilder dataType(DataType dataType) {
|
|
||||||
this.dataType = dataType;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColumnBlueprint build() {
|
|
||||||
return new ColumnBlueprint(name);
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.database.builder;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import link.pagan.traqtor.schema.data.mapping.database.DatabaseAdapter;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class DatabaseBlueprintBuilder {
|
|
||||||
|
|
||||||
private Name name;
|
|
||||||
private DatabaseAdapter adapter;
|
|
||||||
private final List<SchemeBlueprintBuilder> schemas;
|
|
||||||
|
|
||||||
public DatabaseBlueprintBuilder() {
|
|
||||||
this.schemas = new ArrayList<SchemeBlueprintBuilder>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseBlueprintBuilder name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseAdapter adapter() {
|
|
||||||
return adapter;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseBlueprintBuilder adapter(DatabaseAdapter adapter) {
|
|
||||||
this.adapter = adapter;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public DatabaseBlueprintBuilder schemas(SchemeBlueprintBuilder... schemas) {
|
|
||||||
if (schemas != null) {
|
|
||||||
Collections.addAll(this.schemas, schemas);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SchemeBlueprintBuilder scheme(Name name) {
|
|
||||||
for (SchemeBlueprintBuilder sbb : schemas) {
|
|
||||||
if (sbb.name().equals(name)) {
|
|
||||||
return sbb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.database.builder;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class SchemeBlueprintBuilder {
|
|
||||||
|
|
||||||
private Name name;
|
|
||||||
private final List<TableBlueprintBuilder> tables;
|
|
||||||
|
|
||||||
public SchemeBlueprintBuilder() {
|
|
||||||
this.tables = new ArrayList<TableBlueprintBuilder>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SchemeBlueprintBuilder name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public SchemeBlueprintBuilder tables(TableBlueprintBuilder... tables) {
|
|
||||||
if (tables != null) {
|
|
||||||
Collections.addAll(this.tables, tables);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableBlueprintBuilder table(Name name) {
|
|
||||||
for (TableBlueprintBuilder tbb : tables) {
|
|
||||||
if (tbb.name().equals(name)) {
|
|
||||||
return tbb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,46 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.database.builder;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Collections;
|
|
||||||
import java.util.List;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class TableBlueprintBuilder {
|
|
||||||
|
|
||||||
private Name name;
|
|
||||||
private final List<ColumnBlueprintBuilder> columns;
|
|
||||||
|
|
||||||
public TableBlueprintBuilder() {
|
|
||||||
this.columns = new ArrayList<ColumnBlueprintBuilder>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableBlueprintBuilder name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public TableBlueprintBuilder columns(ColumnBlueprintBuilder... columns) {
|
|
||||||
if (columns != null) {
|
|
||||||
Collections.addAll(this.columns, columns);
|
|
||||||
}
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ColumnBlueprintBuilder column(Name name) {
|
|
||||||
for (ColumnBlueprintBuilder cbb : columns) {
|
|
||||||
if (cbb.name().equals(name)) {
|
|
||||||
return cbb;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.frontend;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class FrontendBlueprint {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.mdl.logic;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.mdl.security.permission.PermissionBlueprint;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class EndpointBlueprint {
|
|
||||||
|
|
||||||
ArrayList<PermissionBlueprint> permissions;
|
|
||||||
String name;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,18 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.mdl.logic;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class RegistryBlueprint {
|
|
||||||
|
|
||||||
ArrayList<EndpointBlueprint> endpoints;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,19 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.mdl.logic;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class ResourceBlueprint {
|
|
||||||
|
|
||||||
String name;
|
|
||||||
ArrayList<EndpointBlueprint> endpoints;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.mdl.logic;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class ServiceBlueprint {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,16 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.mdl.security.permission;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class PermissionBlueprint {
|
|
||||||
|
|
||||||
String name;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,20 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.mdl.security.permission;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class PermissionDomainBlueprint {
|
|
||||||
|
|
||||||
String name;
|
|
||||||
ArrayList<PermissionBlueprint> permissions;
|
|
||||||
ArrayList<PermissionDomainBlueprint> subdomains;
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,14 +0,0 @@
|
|||||||
/*
|
|
||||||
* To change this license header, choose License Headers in Project Properties.
|
|
||||||
* To change this template file, choose Tools | Templates
|
|
||||||
* and open the template in the editor.
|
|
||||||
*/
|
|
||||||
package link.pagan.traqtor.generator.blueprint.mdl.security.role;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class RoleBlueprint {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class AtomBlueprint {
|
|
||||||
|
|
||||||
Name name;
|
|
||||||
String description;
|
|
||||||
List<ParticleBlueprint> particles;
|
|
||||||
|
|
||||||
public AtomBlueprint(Name name, String description, List<ParticleBlueprint> particles) {
|
|
||||||
this.name = name;
|
|
||||||
this.description = description;
|
|
||||||
this.particles = particles;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class AtomBlueprintSerializer extends StdSerializer<AtomBlueprint> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public AtomBlueprintSerializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomBlueprintSerializer(Class<AtomBlueprint> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(AtomBlueprint value, JsonGenerator gen, SerializerProvider provider) throws IOException {
|
|
||||||
gen.writeStartObject();
|
|
||||||
gen.writeObjectField("name", value.name);
|
|
||||||
gen.writeStringField("description", value.description);
|
|
||||||
gen.writeArrayFieldStart("particles");
|
|
||||||
for (ParticleBlueprint ab : value.particles) {
|
|
||||||
gen.writeObject(ab);
|
|
||||||
}
|
|
||||||
gen.writeEndArray();
|
|
||||||
gen.writeEndObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,54 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class LinkBlueprint {
|
|
||||||
|
|
||||||
AtomBlueprint from;
|
|
||||||
AtomBlueprint to;
|
|
||||||
LinkType type;
|
|
||||||
|
|
||||||
public LinkBlueprint(AtomBlueprint from, AtomBlueprint to, LinkType type) {
|
|
||||||
this.from = from;
|
|
||||||
this.to = to;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomBlueprint from() {
|
|
||||||
return from;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomBlueprint to() {
|
|
||||||
return to;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class LinkBlueprintSerializer extends StdSerializer<LinkBlueprint> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public LinkBlueprintSerializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkBlueprintSerializer(Class<LinkBlueprint> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(LinkBlueprint value, JsonGenerator gen, SerializerProvider provider) throws IOException {
|
|
||||||
gen.writeStartObject();
|
|
||||||
gen.writeObjectField("name", value.from.name);
|
|
||||||
gen.writeObjectField("to", value.to.name);
|
|
||||||
gen.writeObjectField("type", value.type);
|
|
||||||
gen.writeEndObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,41 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
|
||||||
import java.io.IOException;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public enum LinkType {
|
|
||||||
MANY_TO_MANY,
|
|
||||||
ONE_TO_MANY,
|
|
||||||
ONE_TO_ONE;
|
|
||||||
|
|
||||||
public static final class LinkTypeSerializer extends StdSerializer<LinkType> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public LinkTypeSerializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkTypeSerializer(Class<LinkType> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(LinkType value, JsonGenerator gen, SerializerProvider provider) throws IOException {
|
|
||||||
if (value.equals(MANY_TO_MANY)) {
|
|
||||||
gen.writeString("MANY_TO_MANY");
|
|
||||||
} else if (value.equals(ONE_TO_MANY)) {
|
|
||||||
gen.writeString("ONE_TO_MANY");
|
|
||||||
} else {
|
|
||||||
gen.writeString("ONE_TO_ONE");
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,53 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
|
||||||
import java.io.IOException;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import link.pagan.traqtor.schema.data.DataType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class ParticleBlueprint {
|
|
||||||
|
|
||||||
Name name;
|
|
||||||
String description;
|
|
||||||
DataType type;
|
|
||||||
|
|
||||||
public ParticleBlueprint(Name name, String description, DataType type) {
|
|
||||||
this.name = name;
|
|
||||||
this.description = description;
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class ParticleBlueprintSerializer extends StdSerializer<ParticleBlueprint> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public ParticleBlueprintSerializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ParticleBlueprintSerializer(Class<ParticleBlueprint> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(ParticleBlueprint value, JsonGenerator gen, SerializerProvider provider) throws IOException {
|
|
||||||
gen.writeStartObject();
|
|
||||||
gen.writeObjectField("name", value.name);
|
|
||||||
gen.writeStringField("description", value.description);
|
|
||||||
gen.writeStringField("type", value.type.getName());
|
|
||||||
gen.writeEndObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe;
|
|
||||||
|
|
||||||
import com.fasterxml.jackson.core.JsonGenerator;
|
|
||||||
import com.fasterxml.jackson.databind.SerializerProvider;
|
|
||||||
import com.fasterxml.jackson.databind.ser.std.StdSerializer;
|
|
||||||
import java.io.IOException;
|
|
||||||
import java.util.List;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.ProjectBlueprint;
|
|
||||||
import link.pagan.traqtor.schema.data.DataTypeSchema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class UniverseBlueprint extends ProjectBlueprint {
|
|
||||||
|
|
||||||
List<AtomBlueprint> atoms;
|
|
||||||
List<LinkBlueprint> links;
|
|
||||||
DataTypeSchema dataTypeSchema;
|
|
||||||
|
|
||||||
public UniverseBlueprint(List<AtomBlueprint> atoms, List<LinkBlueprint> links, DataTypeSchema dataTypeSchema) {
|
|
||||||
this.atoms = atoms;
|
|
||||||
this.links = links;
|
|
||||||
this.dataTypeSchema = dataTypeSchema;
|
|
||||||
}
|
|
||||||
|
|
||||||
public static final class UniverseBlueprintSerializer extends StdSerializer<UniverseBlueprint> {
|
|
||||||
|
|
||||||
private static final long serialVersionUID = 1L;
|
|
||||||
|
|
||||||
public UniverseBlueprintSerializer() {
|
|
||||||
this(null);
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniverseBlueprintSerializer(Class<UniverseBlueprint> t) {
|
|
||||||
super(t);
|
|
||||||
}
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public void serialize(UniverseBlueprint value, JsonGenerator gen, SerializerProvider provider) throws IOException {
|
|
||||||
gen.writeStartObject();
|
|
||||||
gen.writeObjectField("schema", value.dataTypeSchema.getName());
|
|
||||||
gen.writeArrayFieldStart("atoms");
|
|
||||||
for (AtomBlueprint ab : value.atoms) {
|
|
||||||
gen.writeObject(ab);
|
|
||||||
}
|
|
||||||
gen.writeEndArray();
|
|
||||||
gen.writeArrayFieldStart("links");
|
|
||||||
for (LinkBlueprint lb : value.links) {
|
|
||||||
gen.writeObject(lb);
|
|
||||||
}
|
|
||||||
gen.writeEndArray();
|
|
||||||
gen.writeEndObject();
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -1,57 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe.build;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.AtomBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.ParticleBlueprint;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class AtomBlueprintBuilder {
|
|
||||||
|
|
||||||
Name name;
|
|
||||||
String description;
|
|
||||||
List<ParticleBlueprintBuilder> particleBuilders;
|
|
||||||
|
|
||||||
public AtomBlueprintBuilder() {
|
|
||||||
this.particleBuilders = new ArrayList<>();
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomBlueprint build(UniverseBlueprintBuilder builder) {
|
|
||||||
List<ParticleBlueprint> particles = new ArrayList<>();
|
|
||||||
for (ParticleBlueprintBuilder pb : particleBuilders) {
|
|
||||||
particles.add(pb.build(builder));
|
|
||||||
}
|
|
||||||
particles.sort(new Comparator<ParticleBlueprint>() {
|
|
||||||
@Override
|
|
||||||
public int compare(ParticleBlueprint a, ParticleBlueprint b) {
|
|
||||||
return a.name().asDotted().compareTo(b.name().asDotted());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return new AtomBlueprint(name, description, particles);
|
|
||||||
}
|
|
||||||
|
|
||||||
public Name name() {
|
|
||||||
return name;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomBlueprintBuilder name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomBlueprintBuilder description(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public AtomBlueprintBuilder addParticle(ParticleBlueprintBuilder particle) {
|
|
||||||
this.particleBuilders.add(particle);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,55 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe.build;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.AtomBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.LinkBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.LinkType;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class LinkBlueprintBuilder {
|
|
||||||
|
|
||||||
Name from;
|
|
||||||
Name to;
|
|
||||||
LinkType type;
|
|
||||||
|
|
||||||
public LinkBlueprint build(UniverseBlueprintBuilder builder, ArrayList<AtomBlueprint> atoms) {
|
|
||||||
AtomBlueprint fromAtom = getAtom(from, atoms);
|
|
||||||
if (fromAtom == null) {
|
|
||||||
throw new RuntimeException("Link from atom can not be null");
|
|
||||||
}
|
|
||||||
AtomBlueprint toAtom = getAtom(to, atoms);
|
|
||||||
if (toAtom == null) {
|
|
||||||
throw new RuntimeException("Link to atom can not be null");
|
|
||||||
}
|
|
||||||
return new LinkBlueprint(fromAtom, toAtom, type);
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkBlueprintBuilder from(Name from) {
|
|
||||||
this.from = from;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkBlueprintBuilder to(Name to) {
|
|
||||||
this.to = to;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public LinkBlueprintBuilder type(LinkType type) {
|
|
||||||
this.type = type;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
private static AtomBlueprint getAtom(Name name, ArrayList<AtomBlueprint> atoms) {
|
|
||||||
for (AtomBlueprint ab : atoms) {
|
|
||||||
if (ab.name().equals(name)) {
|
|
||||||
return ab;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,40 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe.build;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.ParticleBlueprint;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import link.pagan.traqtor.schema.data.DataType;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class ParticleBlueprintBuilder {
|
|
||||||
|
|
||||||
Name name;
|
|
||||||
String description;
|
|
||||||
String type;
|
|
||||||
|
|
||||||
public ParticleBlueprint build(UniverseBlueprintBuilder builder) {
|
|
||||||
DataType dataType = builder.getType(type);
|
|
||||||
if (dataType == null) {
|
|
||||||
throw new RuntimeException("Particle type was not found on build");
|
|
||||||
}
|
|
||||||
return new ParticleBlueprint(name, description, dataType);
|
|
||||||
}
|
|
||||||
|
|
||||||
public ParticleBlueprintBuilder name(Name name) {
|
|
||||||
this.name = name;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ParticleBlueprintBuilder description(String description) {
|
|
||||||
this.description = description;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public ParticleBlueprintBuilder type(String type) {
|
|
||||||
this.type = type;
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,73 +0,0 @@
|
|||||||
package link.pagan.traqtor.generator.blueprint.universe.build;
|
|
||||||
|
|
||||||
import java.util.ArrayList;
|
|
||||||
import java.util.Comparator;
|
|
||||||
import java.util.List;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.UniverseBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.AtomBlueprint;
|
|
||||||
import link.pagan.traqtor.generator.blueprint.universe.LinkBlueprint;
|
|
||||||
import link.pagan.traqtor.schema.data.DataType;
|
|
||||||
import link.pagan.traqtor.schema.data.DataTypeSchema;
|
|
||||||
|
|
||||||
/**
|
|
||||||
*
|
|
||||||
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
|
||||||
*/
|
|
||||||
public class UniverseBlueprintBuilder {
|
|
||||||
|
|
||||||
List<AtomBlueprintBuilder> atomBuilders;
|
|
||||||
List<LinkBlueprintBuilder> linkBuilder;
|
|
||||||
DataTypeSchema dataTypeSchema;
|
|
||||||
|
|
||||||
public UniverseBlueprintBuilder(DataTypeSchema dataTypeSchema) {
|
|
||||||
this.atomBuilders = new ArrayList<>();
|
|
||||||
this.linkBuilder = new ArrayList<>();
|
|
||||||
this.dataTypeSchema = dataTypeSchema;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniverseBlueprintBuilder addAtom(AtomBlueprintBuilder atom) {
|
|
||||||
this.atomBuilders.add(atom);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniverseBlueprintBuilder addLink(LinkBlueprintBuilder link) {
|
|
||||||
this.linkBuilder.add(link);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniverseBlueprint build() {
|
|
||||||
ArrayList<AtomBlueprint> atoms = new ArrayList<>();
|
|
||||||
for (AtomBlueprintBuilder ab : atomBuilders) {
|
|
||||||
atoms.add(ab.build(this));
|
|
||||||
}
|
|
||||||
atoms.sort(new Comparator<AtomBlueprint>() {
|
|
||||||
@Override
|
|
||||||
public int compare(AtomBlueprint a, AtomBlueprint b) {
|
|
||||||
return a.name().asDotted().compareTo(b.name().asDotted());
|
|
||||||
}
|
|
||||||
});
|
|
||||||
|
|
||||||
ArrayList<LinkBlueprint> links = new ArrayList<>();
|
|
||||||
for (LinkBlueprintBuilder lb : linkBuilder) {
|
|
||||||
links.add(lb.build(this, atoms));
|
|
||||||
}
|
|
||||||
links.sort(new Comparator<LinkBlueprint>() {
|
|
||||||
@Override
|
|
||||||
public int compare(LinkBlueprint a, LinkBlueprint b) {
|
|
||||||
return (a.from().name().asDotted() + "->" + a.to().name().asDotted()).compareTo(
|
|
||||||
(b.from().name().asDotted() + "->" + b.to().name().asDotted()));
|
|
||||||
}
|
|
||||||
});
|
|
||||||
return new UniverseBlueprint(atoms, links, dataTypeSchema);
|
|
||||||
}
|
|
||||||
|
|
||||||
DataType getType(String type) {
|
|
||||||
for (DataType dt : this.dataTypeSchema.getDataTypes()) {
|
|
||||||
if (dt.getName().equals(type)) {
|
|
||||||
return dt;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
return null;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
Some files were not shown because too many files have changed in this diff Show More
Loading…
Reference in New Issue