forked from 2pm.tech/traqtor
EndToEnd for unicerse build no-conflict
parent
dd9a274f0a
commit
1fe9ac5999
@ -1,29 +0,0 @@
|
|||||||
package link.pagan.traqtor.project;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.project.universe.schema.DatatypeSchema;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
import link.pagan.traqtor.project.universe.Link;
|
|
||||||
import link.pagan.traqtor.project.universe.Element;
|
|
||||||
|
|
||||||
public class UniverseProject extends Project {
|
|
||||||
|
|
||||||
|
|
||||||
@Override
|
|
||||||
public UniverseProject name(Name name){
|
|
||||||
super.name(name);
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniverseProject importSchema (DatatypeSchema schema) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniverseProject addElement (Element element) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public UniverseProject addLink(Link link) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -0,0 +1,24 @@
|
|||||||
|
package link.pagan.traqtor.project.database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class Database {
|
||||||
|
|
||||||
|
public static DatabaseProject project() {
|
||||||
|
return new DatabaseProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DatabaseSchema schema() {
|
||||||
|
return new DatabaseSchema();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DatabaseTable table() {
|
||||||
|
return new DatabaseTable();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static DatabaseColumn column() {
|
||||||
|
return new DatabaseColumn();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,14 @@
|
|||||||
|
/*
|
||||||
|
* 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.project.database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class DatabaseColumn {
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,15 @@
|
|||||||
|
/*
|
||||||
|
* 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.project.database;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class DatabaseTable {
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,18 +0,0 @@
|
|||||||
package link.pagan.traqtor.project.universe;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
public class Element {
|
|
||||||
|
|
||||||
public Element name(Name name){
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Element addParticle(Particle<?> particle) {
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
package link.pagan.traqtor.project.universe;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
public class Link {
|
|
||||||
|
|
||||||
public Link from(Element element) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Link to(Element element) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Link fromName(Name name) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Link toName(Name name) {
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,25 +0,0 @@
|
|||||||
package link.pagan.traqtor.project.universe;
|
|
||||||
|
|
||||||
import link.pagan.traqtor.project.universe.schema.DataType;
|
|
||||||
import link.pagan.traqtor.util.Name;
|
|
||||||
|
|
||||||
public class Particle<T extends DataType> {
|
|
||||||
|
|
||||||
final DataType type;
|
|
||||||
Name name;
|
|
||||||
String description;
|
|
||||||
|
|
||||||
public Particle(DataType type) {
|
|
||||||
this.type = type;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Particle<T> name(Name name) {
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
|
|
||||||
public Particle<T> description(String description) {
|
|
||||||
|
|
||||||
return this;
|
|
||||||
}
|
|
||||||
}
|
|
||||||
@ -0,0 +1,40 @@
|
|||||||
|
package link.pagan.traqtor.project.universe;
|
||||||
|
|
||||||
|
import link.pagan.traqtor.project.universe.element.Atom;
|
||||||
|
import link.pagan.traqtor.project.universe.element.Element;
|
||||||
|
import link.pagan.traqtor.project.universe.element.Isotope;
|
||||||
|
import link.pagan.traqtor.project.universe.link.Link;
|
||||||
|
import link.pagan.traqtor.project.universe.link.ManyToManyLink;
|
||||||
|
import link.pagan.traqtor.project.universe.link.OneToManyLink;
|
||||||
|
import link.pagan.traqtor.project.universe.link.OneToOneLink;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class Universe {
|
||||||
|
|
||||||
|
public static UniverseProject project() {
|
||||||
|
return new UniverseProject();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Atom atom() {
|
||||||
|
return Element.atom();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Isotope isotope() {
|
||||||
|
return Element.isotope();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OneToOneLink linkOneToOne() {
|
||||||
|
return Link.oneToOne();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OneToManyLink linkOneToMany() {
|
||||||
|
return Link.oneToMany();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ManyToManyLink linkManyToMany() {
|
||||||
|
return Link.manyToMany();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,32 @@
|
|||||||
|
package link.pagan.traqtor.project.universe;
|
||||||
|
|
||||||
|
import link.pagan.traqtor.project.Project;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.DatatypeSchema;
|
||||||
|
import link.pagan.traqtor.util.Name;
|
||||||
|
import link.pagan.traqtor.project.universe.link.Link;
|
||||||
|
import link.pagan.traqtor.project.universe.element.Element;
|
||||||
|
|
||||||
|
public class UniverseProject extends Project {
|
||||||
|
|
||||||
|
UniverseProject() {
|
||||||
|
}
|
||||||
|
|
||||||
|
@Override
|
||||||
|
public UniverseProject name(Name name){
|
||||||
|
super.name(name);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UniverseProject schemas (DatatypeSchema... schemas) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UniverseProject elements (Element... element) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public UniverseProject links(Link... link) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,5 +0,0 @@
|
|||||||
package link.pagan.traqtor.project.universe;
|
|
||||||
|
|
||||||
public class UniverseSchema {
|
|
||||||
|
|
||||||
}
|
|
||||||
@ -1,21 +1,24 @@
|
|||||||
package link.pagan.traqtor.project.universe.element;
|
package link.pagan.traqtor.project.universe.element;
|
||||||
|
|
||||||
import link.pagan.traqtor.project.universe.Element;
|
import java.util.List;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.DataType;
|
||||||
import link.pagan.traqtor.util.Name;
|
import link.pagan.traqtor.util.Name;
|
||||||
import link.pagan.traqtor.project.universe.Particle;
|
|
||||||
|
|
||||||
public class Atom extends Element {
|
public class Atom extends Element {
|
||||||
|
|
||||||
|
Atom() {
|
||||||
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Atom name(Name name){
|
public Atom name(Name name) {
|
||||||
super.name(name);
|
super.name(name);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
@Override
|
@Override
|
||||||
public Atom addParticle(Particle<?> particle) {
|
public Atom particles(List<Particle<? extends DataType>> particles) {
|
||||||
super.addParticle(particle);
|
super.particles(particles);
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,33 @@
|
|||||||
|
package link.pagan.traqtor.project.universe.element;
|
||||||
|
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.DataType;
|
||||||
|
import link.pagan.traqtor.util.Name;
|
||||||
|
|
||||||
|
public class Element {
|
||||||
|
|
||||||
|
public Element name(Name name){
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public final Element particles(Particle<? extends DataType>... particles) {
|
||||||
|
return particles(Arrays.asList(particles));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Element particles(List<Particle<? extends DataType>> particles) {
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Atom atom () {
|
||||||
|
return new Atom();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static Isotope isotope () {
|
||||||
|
return new Isotope();
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,45 @@
|
|||||||
|
package link.pagan.traqtor.project.universe.element;
|
||||||
|
|
||||||
|
import java.util.ArrayList;
|
||||||
|
import java.util.Arrays;
|
||||||
|
import java.util.List;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.Constraint;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.DataType;
|
||||||
|
import link.pagan.traqtor.util.Name;
|
||||||
|
|
||||||
|
public class Particle<T extends DataType> {
|
||||||
|
|
||||||
|
final DataType type;
|
||||||
|
Name name;
|
||||||
|
String description;
|
||||||
|
final List<Constraint<? super T>> constraints;
|
||||||
|
|
||||||
|
public Particle(DataType type) {
|
||||||
|
this.type = type;
|
||||||
|
this.constraints = new ArrayList<>();
|
||||||
|
}
|
||||||
|
|
||||||
|
@SafeVarargs
|
||||||
|
public final Particle<T> constraints (Constraint<? super T>... args) {
|
||||||
|
return constraints(Arrays.asList(args));
|
||||||
|
}
|
||||||
|
|
||||||
|
public Particle<T> constraints (List<Constraint<? super T>> args) {
|
||||||
|
this.constraints.addAll(args);
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Particle<T> name(Name name) {
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Particle<T> description(String description) {
|
||||||
|
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Particle<T> optional() {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -0,0 +1,37 @@
|
|||||||
|
package link.pagan.traqtor.project.universe.link;
|
||||||
|
|
||||||
|
import link.pagan.traqtor.project.universe.element.Element;
|
||||||
|
import link.pagan.traqtor.util.Name;
|
||||||
|
|
||||||
|
public abstract class Link {
|
||||||
|
|
||||||
|
public Link from(Element element) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Link to(Element element) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Link fromName(Name name) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Link toName(Name name) {
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OneToOneLink oneToOne () {
|
||||||
|
return new OneToOneLink();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static OneToManyLink oneToMany () {
|
||||||
|
return new OneToManyLink();
|
||||||
|
}
|
||||||
|
|
||||||
|
public static ManyToManyLink manyToMany () {
|
||||||
|
return new ManyToManyLink();
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
@ -1,24 +1,29 @@
|
|||||||
package link.pagan.traqtor.project.universe.schema;
|
package link.pagan.traqtor.project.universe.schema;
|
||||||
|
|
||||||
import link.pagan.traqtor.project.universe.Particle;
|
import java.util.List;
|
||||||
|
import link.pagan.traqtor.project.universe.element.Particle;
|
||||||
|
|
||||||
public abstract class DataType {
|
public abstract class DataType {
|
||||||
|
|
||||||
private String name;
|
final List<Constraint<? extends DataType>> typeConstraints;
|
||||||
|
|
||||||
protected DataType (){
|
public DataType(List<Constraint<? extends DataType>> typeConstraints) {
|
||||||
|
this.typeConstraints = typeConstraints;
|
||||||
}
|
}
|
||||||
|
|
||||||
public DataType(String name) {
|
private String name;
|
||||||
this.name = name;
|
|
||||||
}
|
// protected DataType (){
|
||||||
|
// }
|
||||||
|
|
||||||
|
// public DataType(String name) {
|
||||||
|
// this.name = name;
|
||||||
|
// }
|
||||||
|
|
||||||
public String getName() {
|
public String getName() {
|
||||||
return name;
|
return name;
|
||||||
}
|
}
|
||||||
|
|
||||||
// public abstract DataType type();
|
|
||||||
|
|
||||||
public abstract Particle<? extends DataType> particle();
|
public abstract Particle<? extends DataType> particle();
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,18 @@
|
|||||||
|
package link.pagan.traqtor.project.universe.schema.impl.data.literal.constraints;
|
||||||
|
|
||||||
|
import link.pagan.traqtor.project.universe.schema.Constraint;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.impl.data.literal.StringDataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class LiteralMaxConstraint extends Constraint<StringDataType> {
|
||||||
|
|
||||||
|
long max;
|
||||||
|
|
||||||
|
public LiteralMaxConstraint(long max) {
|
||||||
|
this.max = max;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package link.pagan.traqtor.project.universe.schema.impl.data.literal.constraints;
|
||||||
|
|
||||||
|
import link.pagan.traqtor.project.universe.schema.Constraint;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.impl.data.literal.StringDataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class LiteralMinConstraint extends Constraint<StringDataType> {
|
||||||
|
|
||||||
|
long min;
|
||||||
|
|
||||||
|
public LiteralMinConstraint(long min) {
|
||||||
|
this.min = min;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,18 @@
|
|||||||
|
package link.pagan.traqtor.project.universe.schema.impl.data.literal.constraints;
|
||||||
|
|
||||||
|
import link.pagan.traqtor.project.universe.schema.Constraint;
|
||||||
|
import link.pagan.traqtor.project.universe.schema.impl.data.literal.StringDataType;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class LiteralRegExpConstraint extends Constraint<StringDataType> {
|
||||||
|
|
||||||
|
String regExp;
|
||||||
|
|
||||||
|
public LiteralRegExpConstraint(String regExp) {
|
||||||
|
this.regExp = regExp;
|
||||||
|
}
|
||||||
|
|
||||||
|
}
|
||||||
@ -0,0 +1,20 @@
|
|||||||
|
package link.pagan.traqtor.util;
|
||||||
|
|
||||||
|
/**
|
||||||
|
*
|
||||||
|
* @author Edward M. Kagan {@literal <}kaganem{@literal @}2pm.tech{@literal >}
|
||||||
|
*/
|
||||||
|
public class RegExpHelper {
|
||||||
|
|
||||||
|
public static final String URL = "^(https?|ftp|file)://[-a-zA-Z0-9+&@#/%?=~_|!:,.;]*[-a-zA-Z0-9+&@#/%=~_|]";
|
||||||
|
public static final String EMAIL = "(?:[a-z0-9!#$%&'*+/=?^_`{|}~-]+(?:\\.[a-z0-9!#$%&'*+/=?^_`{|}~-]+)*|\"(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21\\x23-\\x5b\\x5d-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])*\")@(?:(?:[a-z0-9](?:[a-z0-9-]*[a-z0-9])?\\.)+[a-z0-9](?:[a-z0-9-]*[a-z0-9])?|\\[(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?|[a-z0-9-]*[a-z0-9]:(?:[\\x01-\\x08\\x0b\\x0c\\x0e-\\x1f\\x21-\\x5a\\x53-\\x7f]|\\\\[\\x01-\\x09\\x0b\\x0c\\x0e-\\x7f])+)\\])";
|
||||||
|
public static final String IP = "(?:(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)\\\\.){3}(?:25[0-5]|2[0-4][0-9]|[01]?[0-9][0-9]?)";
|
||||||
|
public static final String PHONE = "\\+(9[976]\\d|8[987530]\\d|6[987]\\d|5[90]\\d|42\\d|3[875]\\d|2[98654321]\\d|9[8543210]|8[6421]|6[6543210]|5[87654321]|4[987654310]|3[9643210]|2[70]|7|1)\\d{1,14}$";
|
||||||
|
public static final String PHONE_RU = "^((\\+7|7|8)+([0-9]){10})$";
|
||||||
|
public static final String PHONE_US = "1?\\W*([2-9][0-8][0-9])\\W*([2-9][0-9]{2})\\W*([0-9]{4})(\\se?x?t?(\\d*))?";
|
||||||
|
public static final String PHONE_DE = "/^([\\+][0-9]{1,3}[ \\.\\-])?([\\(]{1}[0-9]{1,6}[\\)])?([0-9 \\.\\-\\/]{3,20})((x|ext|extension)[ ]?[0-9]{1,4})?$/";
|
||||||
|
public static final String PHONE_UK = "^(?:(?:\\(?(?:0(?:0|11)\\)?[\\s-]?\\(?|\\+)44\\)?[\\s-]?(?:\\(?0\\)?[\\s-]?)?)|(?:\\(?0))(?:(?:\\d{5}\\)?[\\s-]?\\d{4,5})|(?:\\d{4}\\)?[\\s-]?(?:\\d{5}|\\d{3}[\\s-]?\\d{3}))|(?:\\d{3}\\)?[\\s-]?\\d{3}[\\s-]?\\d{3,4})|(?:\\d{2}\\)?[\\s-]?\\d{4}[\\s-]?\\d{4}))(?:[\\s-]?(?:x|ext\\.?|\\#)\\d{3,4})?$";
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
}
|
||||||
Loading…
Reference in New Issue