Skip to content

Commit

Permalink
[meta]完善模块功能
Browse files Browse the repository at this point in the history
  • Loading branch information
datageartech committed Mar 13, 2020
1 parent b8e10f7 commit f85e1e7
Show file tree
Hide file tree
Showing 24 changed files with 2,048 additions and 1 deletion.
52 changes: 52 additions & 0 deletions datagear-meta/pom.xml
Original file line number Diff line number Diff line change
@@ -0,0 +1,52 @@
<?xml version="1.0"?>
<project
xsi:schemaLocation="http://maven.apache.org/POM/4.0.0 http://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>
<parent>
<groupId>org.datagear</groupId>
<artifactId>datagear</artifactId>
<version>1.7.0</version>
</parent>

<artifactId>datagear-meta</artifactId>
<name>datagear-meta</name>

<dependencies>
<dependency>
<groupId>org.datagear</groupId>
<artifactId>datagear-util</artifactId>
<version>${project.version}</version>
</dependency>
<dependency>
<groupId>org.datagear</groupId>
<artifactId>datagear-connection</artifactId>
<version>${project.version}</version>
</dependency>
</dependencies>

<build>
<plugins>
<plugin>
<groupId>org.apache.maven.plugins</groupId>
<artifactId>maven-antrun-plugin</artifactId>
<version>${maven-antrun-plugin.version}</version>
<executions>
<!-- 拷贝LICENSE文件 -->
<execution>
<id>copyLICENSE</id>
<phase>prepare-package</phase>
<goals>
<goal>run</goal>
</goals>
<configuration>
<tasks>
<copy file="../LICENSE" todir="${project.build.outputDirectory}" />
</tasks>
</configuration>
</execution>
</executions>
</plugin>
</plugins>
</build>
</project>
68 changes: 68 additions & 0 deletions datagear-meta/src/main/java/org/datagear/meta/AbstractKey.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/

package org.datagear.meta;

import java.io.Serializable;
import java.util.Arrays;

/**
* 表键。
*
* @author [email protected]
*
*/
public abstract class AbstractKey implements Serializable
{
private static final long serialVersionUID = 1L;

/** 列名 */
private String[] columnNames;

/** 键名 */
private String keyName;

public AbstractKey()
{
super();
}

public AbstractKey(String[] columnNames)
{
super();
this.columnNames = columnNames;
}

public String[] getColumnNames()
{
return columnNames;
}

public void setColumnNames(String[] columnNames)
{
this.columnNames = columnNames;
}

public boolean hasKeyName()
{
return (this.keyName != null && !this.keyName.isEmpty());
}

public String getKeyName()
{
return keyName;
}

public void setKeyName(String keyName)
{
this.keyName = keyName;
}

@Override
public String toString()
{
return getClass().getSimpleName() + " [columnNames=" + Arrays.toString(columnNames) + ", keyName=" + keyName
+ "]";
}
}
75 changes: 75 additions & 0 deletions datagear-meta/src/main/java/org/datagear/meta/AbstractTable.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,75 @@
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/

package org.datagear.meta;

import java.io.Serializable;

/**
* 抽象表元信息。
*
* @author [email protected]
*
*/
public class AbstractTable implements Serializable
{
private static final long serialVersionUID = 1L;

/** 名称 */
private String name;

/** 类型 */
private TableType type;

/** 描述 */
private String comment;

public AbstractTable()
{
super();
}

public AbstractTable(String name, TableType type)
{
super();
this.name = name;
this.type = type;
}

public String getName()
{
return name;
}

public void setName(String name)
{
this.name = name;
}

public TableType getType()
{
return type;
}

public void setType(TableType type)
{
this.type = type;
}

public String getComment()
{
return comment;
}

public void setComment(String comment)
{
this.comment = comment;
}

@Override
public String toString()
{
return getClass().getSimpleName() + " [name=" + name + ", type=" + type + ", comment=" + comment + "]";
}
}
190 changes: 190 additions & 0 deletions datagear-meta/src/main/java/org/datagear/meta/Column.java
Original file line number Diff line number Diff line change
@@ -0,0 +1,190 @@
/*
* Copyright 2018 datagear.tech. All Rights Reserved.
*/

package org.datagear.meta;

import java.io.Serializable;

/**
* 列。
*
* @author [email protected]
*
*/
public class Column implements Serializable
{
private static final long serialVersionUID = 1L;

/** 名称 */
private String name;

/** JDBC类型,对应java.sql.Types中的值 */
private int type;

/** 数据源依赖的类型名称,参考"TYPE_NAME"说明 */
private String typeName;

/** 列大小,字符串长度或者数值总长度 */
private int size = 0;

/** 小数部分的位数,如果不是小数,值为0 */
private int decimalDigits = 0;

/** 是否允许为null */
private boolean nullable = false;

/** 描述 */
private String comment;

/** 默认值 */
private String defaultValue = null;

/** 是否自增长 */
private boolean autoincrement = false;

/** 可搜索类型 */
private SearchableType searchableType;

public Column()
{
super();
}

public Column(String name, int type)
{
super();
this.name = name;
this.type = type;
}

public String getName()
{
return name;
}

public void setName(String name)
{
this.name = name;
}

public int getType()
{
return type;
}

public void setType(int type)
{
this.type = type;
}

public boolean hasTypeName()
{
return (this.typeName != null && !this.typeName.isEmpty());
}

public String getTypeName()
{
return typeName;
}

public void setTypeName(String typeName)
{
this.typeName = typeName;
}

public int getSize()
{
return size;
}

public void setSize(int size)
{
this.size = size;
}

public int getDecimalDigits()
{
return decimalDigits;
}

public void setDecimalDigits(int decimalDigits)
{
this.decimalDigits = decimalDigits;
}

public boolean isNullable()
{
return nullable;
}

public void setNullable(boolean nullable)
{
this.nullable = nullable;
}

public boolean hasComment()
{
return (this.comment != null && !this.comment.isEmpty());
}

public String getComment()
{
return comment;
}

public void setComment(String comment)
{
this.comment = comment;
}

public boolean hasDefaultValue()
{
return (this.defaultValue != null && !this.defaultValue.isEmpty());
}

public String getDefaultValue()
{
return defaultValue;
}

public void setDefaultValue(String defaultValue)
{
this.defaultValue = defaultValue;
}

public boolean isAutoincrement()
{
return autoincrement;
}

public void setAutoincrement(boolean autoincrement)
{
this.autoincrement = autoincrement;
}

public boolean hasSearchableType()
{
return (this.searchableType != null);
}

public SearchableType getSearchableType()
{
return searchableType;
}

public void setSearchableType(SearchableType searchableType)
{
this.searchableType = searchableType;
}

@Override
public String toString()
{
return getClass().getSimpleName() + " [name=" + name + ", type=" + type + ", typeName=" + typeName + ", size="
+ size
+ ", decimalDigits=" + decimalDigits + ", nullable=" + nullable + ", comment=" + comment
+ ", defaultValue=" + defaultValue + ", autoincrement=" + autoincrement + ", searchableType="
+ searchableType + "]";
}
}
Loading

0 comments on commit f85e1e7

Please sign in to comment.