Skip to content

Commit

Permalink
added assembly plugin to pom / updated ShowTableData tool
Browse files Browse the repository at this point in the history
  • Loading branch information
olehmberg committed Jun 23, 2017
1 parent 46dc45a commit 4b3d3d3
Show file tree
Hide file tree
Showing 2 changed files with 42 additions and 1 deletion.
16 changes: 16 additions & 0 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,22 @@
<target>1.8</target>
</configuration>
</plugin>
<plugin>
<artifactId>maven-assembly-plugin</artifactId>
<configuration>
<descriptorRefs>
<descriptorRef>jar-with-dependencies</descriptorRef>
</descriptorRefs>
</configuration>
<executions>
<execution>
<phase>package</phase>
<goals>
<goal>single</goal>
</goals>
</execution>
</executions>
</plugin>
</plugins>
</build>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
import java.io.File;
import java.io.IOException;
import java.io.OutputStreamWriter;
import java.util.Collection;
import java.util.HashSet;
import java.util.Set;

Expand Down Expand Up @@ -69,6 +70,9 @@ public class ShowTableData extends Executable {
@Parameter(names = "-csv")
private boolean createCSV = false;

@Parameter(names = "-dep")
private boolean showDependencyInfo = false;

public static void main(String[] args) throws IOException {
ShowTableData s = new ShowTableData();

Expand Down Expand Up @@ -161,7 +165,28 @@ public void run() throws IOException {
System.out.println(String.format("* # Rows: %d", t.getRows().size()));
System.out.println(String.format("* Created from %d original tables", getOriginalTables(t).size()));
System.out.println(String.format("* Entity-Label Column: %s", t.getSubjectColumn()==null ? "?" : t.getSubjectColumn().getHeader()));


if(showDependencyInfo) {

if(t.getSchema().getFunctionalDependencies()!=null && t.getSchema().getFunctionalDependencies().size()>0) {
System.out.println("*** Functional Dependencies ***");
for(Collection<TableColumn> det : t.getSchema().getFunctionalDependencies().keySet()) {
Collection<TableColumn> dep = t.getSchema().getFunctionalDependencies().get(det);
System.out.println(
String.format(
"{%s}->{%s}",
StringUtils.join(Q.project(det, new TableColumn.ColumnHeaderProjection()), ","),
StringUtils.join(Q.project(dep, new TableColumn.ColumnHeaderProjection()), ",")));
}
}
if(t.getSchema().getCandidateKeys()!=null && t.getSchema().getCandidateKeys().size()>0) {
System.out.println("*** Candidate Keys ***");
for(Collection<TableColumn> candidateKey : t.getSchema().getCandidateKeys()) {
System.out.println(
String.format("{%s}", StringUtils.join(Q.project(candidateKey, new TableColumn.ColumnHeaderProjection()), ",")));
}
}
}

if(showData) {
System.out.println(t.getSchema().format(columnWidth));
Expand Down

0 comments on commit 4b3d3d3

Please sign in to comment.