remove obsolete subprojects

(cherry picked from commit e219932b17bf2b9776141828b3212ed210ffa251)
This commit is contained in:
2026-01-25 20:26:10 +01:00
parent 44fac3f471
commit a196f25526
587 changed files with 0 additions and 31031 deletions
-2
View File
@@ -1,2 +0,0 @@
# Kontor Java
-87
View File
@@ -1,87 +0,0 @@
plugins {
id 'application'
id 'jacoco'
id "org.sonarqube" version "3.3"
}
repositories {
mavenLocal()
mavenCentral()
}
dependencies {
implementation 'ch.qos.logback:logback-core:1.1.2'
implementation 'ch.qos.logback:logback-classic:1.1.2'
implementation 'org.mongodb.morphia:morphia:1.1.0'
//compile 'org.mongodb:mongodb-driver:3.2.2'
implementation 'org.hibernate:hibernate-core:4.3.8.Final'
implementation 'org.hibernate:hibernate-entitymanager:4.3.8.Final'
implementation 'org.hsqldb:hsqldb:2.3.0'
implementation 'ch.qos.logback:logback-core:1.1.2'
implementation 'ch.qos.logback:logback-classic:1.1.2'
testImplementation("org.junit.jupiter:junit-jupiter:5.8.2")
}
def MAIN_CLASS_NAME = 'com.ibtp.kontor.KontorApp'
application {
mainClassName = MAIN_CLASS_NAME
}
jar {
manifest {
attributes('Implementation-Title': 'Kontor Application', 'Implementation-Version': version, 'Main-Class': MAIN_CLASS_NAME)
}
}
tasks.named('test') {
useJUnitPlatform()
}
jacocoTestReport {
reports {
xml.enabled true
}
}
test.finalizedBy jacocoTestReport
sonarqube {
properties {
property "sonar.projectKey", "kontor_kontor-java_AX-dd-w3rXuu6JVRvr_g"
property "sonar.host.url", "https://sonar.thpeetz.de"
property "sonar.login", "d39622f640a91f501b1e8a73d7d78c4fc412fc98"
property "sonar.qualitygate.wait", true
property "sonar.sourceEncoding", "UTF-8"
}
}
tasks.named('sonarqube').configure {
dependsOn test
}
//tasks.withType(Checkstyle) {
// ignoreFailures = true
// showViolations = false
// configFile = rootProject.file("config/checkstyle/checkstyle.xml")
// reports {
// xml.enabled true
// }
//}
//tasks.withType(FindBugs) {
// ignoreFailures = true
// reports {
// xml.enabled true
// }
//}
//pmd {
// ignoreFailures = true
//}
//build.dependsOn(['jacocoTestReport'])
wrapper {
gradleVersion = "6.3"
}
-63
View File
@@ -1,63 +0,0 @@
<Comics>
<Publisher name="Marvel" id="1"/>
<Publisher name="Aspen" id="2"/>
<Publisher name="DC" id="3"/>
<Publisher name="Dynamite Entertainment" id="4"/>
<Publisher name="WildStorm" id="5"/>
<Publisher name="Bongo" id="6"/>
<Publisher name="Image" id="7"/>
<Publisher name="Dark Horse Comics" id="8"/>
<Publisher name="Cliffhanger" id="9"/>
<Artist name="Turner, Michael" id="1"/>
<Artist name="Whedon, Joss" id="4"/>
<Artist name="Land, Greg" id="3"/>
<Artist name="Bendis, Brian Michael" id="2"/>
<Comic title="X-Men" id="1" publisher_id="1" current_order="true" completed="false"/>
<Comic title="Red Sonja" id="3" publisher_id="4" current_order="true" completed="false"/>
<Comic title="X-23" id="2" publisher_id="1" current_order="false" completed="false"/>
<Comic title="Simpsons Comics" id="4" publisher_id="6" current_order="true" completed="false"/>
<Comic title="Futurama Comics" id="5" publisher_id="6" current_order="true" completed="false"/>
<Comic title="Bomb Queen III: The Good, The Bad and The Lovely" id="7" publisher_id="7" current_order="false" completed="true"/>
<Comic title="Bomb Queen IV: Suicide Bomber" id="8" publisher_id="7" current_order="true" completed="false"/>
<Comic title="Gen13" id="9" publisher_id="5" current_order="true" completed="false"/>
<Comic title="Bomb Queen II: Queen of Hearts" id="6" publisher_id="7" current_order="false" completed="true"/>
<Comic title="Iron &amp; The Maiden" id="10" publisher_id="2" current_order="true" completed="false"/>
<Comic title="Fathom" id="11" publisher_id="2" current_order="false" completed="false"/>
<Comic title="Soulfire" id="12" publisher_id="2" current_order="false" completed="false"/>
<Comic title="Star Wars: Rebellion" id="13" publisher_id="8" current_order="false" completed="false"/>
<Comic title="Star Wars: Knights of the Old Republic" id="14" publisher_id="8" current_order="false" completed="false"/>
<Comic title="Star Wars: Legacy" id="15" publisher_id="8" current_order="false" completed="false"/>
<Comic title="Star Wars: Dark Times" id="16" publisher_id="8" current_order="false" completed="false"/>
<Comic title="Samurai: Heaven and Earth" id="17" publisher_id="8" current_order="false" completed="false"/>
<Comic title="Battle Pope" id="18" publisher_id="7" current_order="true" completed="false"/>
<Comic title="Danger Girl" id="19" publisher_id="9" current_order="false" completed="true"/>
<Comic title="Marville" id="20" publisher_id="1" current_order="false" completed="true"/>
<StoryArc title="Test" id="1" comic_id="1"/>
<Issue number="0" id="3" comic_id="3" cover_id="3" gelesen="true"/>
<Issue number="1" id="2" comic_id="2" cover_id="1" gelesen="false"/>
<Issue number="1" id="6" comic_id="6" gelesen="false"/>
<Issue number="1" id="4" comic_id="3" gelesen="true"/>
<Issue number="2" id="5" comic_id="3" gelesen="true"/>
<Issue number="2" id="7" comic_id="6" gelesen="false"/>
<Issue number="3" id="8" comic_id="6" gelesen="false"/>
<Issue number="4" id="9" comic_id="6" gelesen="false"/>
<Issue number="1" id="10" comic_id="18" gelesen="false"/>
<Issue number="2" id="11" comic_id="18" gelesen="false"/>
<Issue number="3" id="12" comic_id="18" gelesen="false"/>
<Issue number="4" id="13" comic_id="18" gelesen="false"/>
<Issue number="5" id="14" comic_id="18" gelesen="false"/>
<Issue number="6" id="15" comic_id="18" gelesen="false"/>
<Issue number="7" id="16" comic_id="18" gelesen="false"/>
<Issue number="8" id="17" comic_id="18" gelesen="false"/>
<Issue number="9" id="18" comic_id="18" gelesen="false"/>
<Issue number="10" id="19" comic_id="18" gelesen="false"/>
<Issue number="11" id="20" comic_id="18" gelesen="false"/>
<Issue number="12" id="21" comic_id="18" gelesen="false"/>
<Issue number="1" id="22" comic_id="20" gelesen="false"/>
<Issue number="2" id="23" comic_id="20" gelesen="false"/>
<Issue number="3" id="24" comic_id="20" gelesen="false"/>
<Issue number="4" id="25" comic_id="20" gelesen="false"/>
<Issue number="5" id="26" comic_id="20" gelesen="false"/>
<Issue number="6" id="27" comic_id="20" gelesen="false"/>
<Issue number="7" id="28" comic_id="20" gelesen="false"/>
</Comics>
-192
View File
@@ -1,192 +0,0 @@
<?xml version="1.0"?>
<!DOCTYPE module PUBLIC
"-//Puppy Crawl//DTD Check Configuration 1.2//EN"
"http://www.puppycrawl.com/dtds/configuration_1_2.dtd">
<!--
Checkstyle configuration that checks the sun coding conventions from:
- the Java Language Specification at
http://java.sun.com/docs/books/jls/second_edition/html/index.html
- the Sun Code Conventions at http://java.sun.com/docs/codeconv/
- the Javadoc guidelines at
http://java.sun.com/j2se/javadoc/writingdoccomments/index.html
- the JDK Api documentation http://java.sun.com/j2se/docs/api/index.html
- some best practices
Checkstyle is very configurable. Be sure to read the documentation at
http://checkstyle.sf.net (or in your downloaded distribution).
Most Checks are configurable, be sure to consult the documentation.
To completely disable a check, just comment it out or delete it from the file.
Finally, it is worth reading the documentation.
-->
<module name="Checker">
<!--
If you set the basedir property below, then all reported file
names will be relative to the specified directory. See
http://checkstyle.sourceforge.net/5.x/config.html#Checker
<property name="basedir" value="${basedir}"/>
-->
<!-- Checks that each Java package has a Javadoc file used for commenting. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html#JavadocPackage -->
<module name="JavadocPackage">
<property name="allowLegacy" value="true"/>
</module>
<!-- Checks whether files end with a new line. -->
<!-- See http://checkstyle.sf.net/config_misc.html#NewlineAtEndOfFile -->
<module name="NewlineAtEndOfFile"/>
<!-- Checks that property files contain the same keys. -->
<!-- See http://checkstyle.sf.net/config_misc.html#Translation -->
<module name="Translation"/>
<module name="FileLength"/>
<!-- Following interprets the header file as regular expressions. -->
<!-- <module name="RegexpHeader"/> -->
<module name="FileTabCharacter">
<property name="eachLine" value="true"/>
</module>
<module name="RegexpSingleline">
<!-- \s matches whitespace character, $ matches end of line. -->
<property name="format" value="\s+$"/>
<property name="message" value="Line has trailing spaces."/>
</module>
<module name="TreeWalker">
<!--<property name="cacheFile" value="${checkstyle.cache.file}"/>-->
<property name="cacheFile" value="build/checkstyle-cachefile"/>
<!-- Checks for Javadoc comments. -->
<!-- See http://checkstyle.sf.net/config_javadoc.html -->
<module name="JavadocMethod"/>
<module name="JavadocType"/>
<module name="JavadocVariable"/>
<module name="JavadocStyle"/>
<!-- Checks for Naming Conventions. -->
<!-- See http://checkstyle.sf.net/config_naming.html -->
<module name="ConstantName"/>
<module name="LocalFinalVariableName"/>
<module name="LocalVariableName"/>
<module name="MemberName"/>
<module name="MethodName"/>
<module name="PackageName"/>
<module name="ParameterName"/>
<module name="StaticVariableName"/>
<module name="TypeName"/>
<!-- Checks for Headers -->
<!-- See http://checkstyle.sf.net/config_header.html -->
<!-- <module name="Header"> -->
<!-- The follow property value demonstrates the ability -->
<!-- to have access to ANT properties. In this case it uses -->
<!-- the ${basedir} property to allow Checkstyle to be run -->
<!-- from any directory within a project. See property -->
<!-- expansion, -->
<!-- http://checkstyle.sf.net/config.html#properties -->
<!-- <property -->
<!-- name="headerFile" -->
<!-- value="${basedir}/java.header"/> -->
<!-- </module> -->
<!-- Checks for imports -->
<!-- See http://checkstyle.sf.net/config_import.html -->
<module name="AvoidStarImport"/>
<module name="IllegalImport"/> <!-- defaults to sun.* packages -->
<module name="RedundantImport"/>
<module name="UnusedImports"/>
<!-- Checks for Size Violations. -->
<!-- See http://checkstyle.sf.net/config_sizes.html -->
<module name="LineLength">
<property name="max" value="120"/>
</module>
<module name="MethodLength"/>
<module name="ParameterNumber"/>
<!-- Checks for whitespace -->
<!-- See http://checkstyle.sf.net/config_whitespace.html -->
<module name="EmptyForIteratorPad"/>
<module name="MethodParamPad"/>
<module name="NoWhitespaceAfter"/>
<module name="NoWhitespaceBefore"/>
<module name="OperatorWrap"/>
<module name="ParenPad"/>
<module name="TypecastParenPad"/>
<module name="WhitespaceAfter"/>
<module name="WhitespaceAround"/>
<!-- Modifier Checks -->
<!-- See http://checkstyle.sf.net/config_modifiers.html -->
<module name="ModifierOrder"/>
<module name="RedundantModifier"/>
<!-- Checks for blocks. You know, those {}'s -->
<!-- See http://checkstyle.sf.net/config_blocks.html -->
<module name="AvoidNestedBlocks"/>
<module name="EmptyBlock"/>
<module name="LeftCurly"/>
<module name="NeedBraces"/>
<module name="RightCurly"/>
<!-- Checks for common coding problems -->
<!-- See http://checkstyle.sf.net/config_coding.html -->
<module name="AvoidInlineConditionals"/>
<module name="EmptyStatement"/>
<module name="EqualsHashCode"/>
<module name="HiddenField">
<property name="ignoreConstructorParameter" value="true"/>
<property name="ignoreSetter" value="true"/>
</module>
<module name="IllegalInstantiation"/>
<module name="InnerAssignment"/>
<module name="MagicNumber"/>
<module name="MissingSwitchDefault"/>
<module name="RedundantThrows"/>
<module name="SimplifyBooleanExpression"/>
<module name="SimplifyBooleanReturn"/>
<!-- Checks for class design -->
<!-- See http://checkstyle.sf.net/config_design.html -->
<module name="DesignForExtension"/>
<module name="FinalClass"/>
<module name="HideUtilityClassConstructor"/>
<module name="InterfaceIsType"/>
<module name="VisibilityModifier"/>
<!-- Miscellaneous other checks. -->
<!-- See http://checkstyle.sf.net/config_misc.html -->
<module name="ArrayTypeStyle"/>
<module name="FinalParameters"/>
<module name="TodoComment"/>
<module name="UpperEll"/>
</module>
</module>
-179
View File
@@ -1,179 +0,0 @@
<xsl:stylesheet xmlns:xsl="http://www.w3.org/1999/XSL/Transform" version="1.0">
<xsl:output method="html" indent="yes"/>
<xsl:decimal-format decimal-separator="." grouping-separator="," />
<!-- Checkstyle XML Style Sheet by Stephane Bailliez <sbailliez@apache.org> -->
<!-- Part of the Checkstyle distribution found at http://checkstyle.sourceforge.net -->
<!-- Usage (generates checkstyle_report.html): -->
<!-- <checkstyle failonviolation="false" config="${check.config}"> -->
<!-- <fileset dir="${src.dir}" includes="**/*.java"/> -->
<!-- <formatter type="xml" toFile="${doc.dir}/checkstyle_report.xml"/> -->
<!-- </checkstyle> -->
<!-- <style basedir="${doc.dir}" destdir="${doc.dir}" -->
<!-- includes="checkstyle_report.xml" -->
<!-- style="${doc.dir}/checkstyle-noframes.xsl"/> -->
<xsl:template match="checkstyle">
<html>
<head>
<style type="text/css">
.bannercell {
border: 0px;
padding: 0px;
}
body {
margin-left: 10;
margin-right: 10;
font:normal 80% arial,helvetica,sanserif;
background-color:#FFFFFF;
color:#000000;
}
.a td {
background: #efefef;
}
.b td {
background: #fff;
}
th, td {
text-align: left;
vertical-align: top;
}
th {
font-weight:bold;
background: #ccc;
color: black;
}
table, th, td {
font-size:100%;
border: none
}
table.log tr td, tr th {
}
h2 {
font-weight:bold;
font-size:140%;
margin-bottom: 5;
}
h3 {
font-size:100%;
font-weight:bold;
background: #525D76;
color: white;
text-decoration: none;
padding: 5px;
margin-right: 2px;
margin-left: 2px;
margin-bottom: 0;
}
</style>
</head>
<body>
<a name="top"></a>
<!-- jakarta logo -->
<table border="0" cellpadding="0" cellspacing="0" width="100%">
<tr>
<td class="bannercell" rowspan="2">
<!--a href="http://jakarta.apache.org/">
<img src="http://jakarta.apache.org/images/jakarta-logo.gif" alt="http://jakarta.apache.org" align="left" border="0"/>
</a-->
</td>
<td class="text-align:right"><h2>CheckStyle Audit</h2></td>
</tr>
<tr>
<td class="text-align:right">Designed for use with <a href='http://checkstyle.sourceforge.net/'>CheckStyle</a> and <a href='http://jakarta.apache.org'>Ant</a>.</td>
</tr>
</table>
<hr size="1"/>
<!-- Summary part -->
<xsl:apply-templates select="." mode="summary"/>
<hr size="1" width="100%" align="left"/>
<!-- Package List part -->
<xsl:apply-templates select="." mode="filelist"/>
<hr size="1" width="100%" align="left"/>
<!-- For each package create its part -->
<xsl:for-each select="file">
<xsl:sort select="@name"/>
<xsl:apply-templates select="."/>
<p/>
<p/>
</xsl:for-each>
<hr size="1" width="100%" align="left"/>
</body>
</html>
</xsl:template>
<xsl:template match="checkstyle" mode="filelist">
<h3>Files</h3>
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
<tr>
<th>Name</th>
<th>Errors</th>
</tr>
<xsl:for-each select="file">
<xsl:sort select="@name"/>
<xsl:variable name="errorCount" select="count(error)"/>
<tr>
<xsl:call-template name="alternated-row"/>
<td><a href="#f-{@name}"><xsl:value-of select="@name"/></a></td>
<td><xsl:value-of select="$errorCount"/></td>
</tr>
</xsl:for-each>
</table>
</xsl:template>
<xsl:template match="file">
<a name="f-{@name}"></a>
<h3>File <xsl:value-of select="@name"/></h3>
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
<tr>
<th>Error Description</th>
<th>Line</th>
</tr>
<xsl:for-each select="error">
<tr>
<xsl:call-template name="alternated-row"/>
<td><xsl:value-of select="@message"/></td>
<td><xsl:value-of select="@line"/></td>
</tr>
</xsl:for-each>
</table>
<a href="#top">Back to top</a>
</xsl:template>
<xsl:template match="checkstyle" mode="summary">
<h3>Summary</h3>
<xsl:variable name="fileCount" select="count(file)"/>
<xsl:variable name="errorCount" select="count(file/error)"/>
<table class="log" border="0" cellpadding="5" cellspacing="2" width="100%">
<tr>
<th>Files</th>
<th>Errors</th>
</tr>
<tr>
<xsl:call-template name="alternated-row"/>
<td><xsl:value-of select="$fileCount"/></td>
<td><xsl:value-of select="$errorCount"/></td>
</tr>
</table>
</xsl:template>
<xsl:template name="alternated-row">
<xsl:attribute name="class">
<xsl:if test="position() mod 2 = 1">a</xsl:if>
<xsl:if test="position() mod 2 = 0">b</xsl:if>
</xsl:attribute>
</xsl:template>
</xsl:stylesheet>
-15
View File
@@ -1,15 +0,0 @@
<FindBugsFilter>
<Match>
<Bug category="PERFORMANCE" />
</Match>
<!-- All bugs in test classes, except for JUnit-specific bugs -->
<Match>
<Class name="~.*\.*Test" />
<Not>
<Bug code="IJU" />
</Not>
</Match>
</FindBugsFilter>
-2
View File
@@ -1,2 +0,0 @@
description = 'Application kontor-java'
version = '1.0.0-SNAPSHOT'
Binary file not shown.
-5
View File
@@ -1,5 +0,0 @@
distributionBase=GRADLE_USER_HOME
distributionPath=wrapper/dists
distributionUrl=https\://services.gradle.org/distributions/gradle-6.3-bin.zip
zipStoreBase=GRADLE_USER_HOME
zipStorePath=wrapper/dists
-185
View File
@@ -1,185 +0,0 @@
#!/usr/bin/env sh
#
# Copyright 2015 the original author or authors.
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# https://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.
#
##############################################################################
##
## Gradle start up script for UN*X
##
##############################################################################
# Attempt to set APP_HOME
# Resolve links: $0 may be a link
PRG="$0"
# Need this for relative symlinks.
while [ -h "$PRG" ] ; do
ls=`ls -ld "$PRG"`
link=`expr "$ls" : '.*-> \(.*\)$'`
if expr "$link" : '/.*' > /dev/null; then
PRG="$link"
else
PRG=`dirname "$PRG"`"/$link"
fi
done
SAVED="`pwd`"
cd "`dirname \"$PRG\"`/" >/dev/null
APP_HOME="`pwd -P`"
cd "$SAVED" >/dev/null
APP_NAME="Gradle"
APP_BASE_NAME=`basename "$0"`
# Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
DEFAULT_JVM_OPTS='"-Xmx64m" "-Xms64m"'
# Use the maximum available, or set MAX_FD != -1 to use that value.
MAX_FD="maximum"
warn () {
echo "$*"
}
die () {
echo
echo "$*"
echo
exit 1
}
# OS specific support (must be 'true' or 'false').
cygwin=false
msys=false
darwin=false
nonstop=false
case "`uname`" in
CYGWIN* )
cygwin=true
;;
Darwin* )
darwin=true
;;
MINGW* )
msys=true
;;
NONSTOP* )
nonstop=true
;;
esac
CLASSPATH=$APP_HOME/gradle/wrapper/gradle-wrapper.jar
# Determine the Java command to use to start the JVM.
if [ -n "$JAVA_HOME" ] ; then
if [ -x "$JAVA_HOME/jre/sh/java" ] ; then
# IBM's JDK on AIX uses strange locations for the executables
JAVACMD="$JAVA_HOME/jre/sh/java"
else
JAVACMD="$JAVA_HOME/bin/java"
fi
if [ ! -x "$JAVACMD" ] ; then
die "ERROR: JAVA_HOME is set to an invalid directory: $JAVA_HOME
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
else
JAVACMD="java"
which java >/dev/null 2>&1 || die "ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
Please set the JAVA_HOME variable in your environment to match the
location of your Java installation."
fi
# Increase the maximum file descriptors if we can.
if [ "$cygwin" = "false" -a "$darwin" = "false" -a "$nonstop" = "false" ] ; then
MAX_FD_LIMIT=`ulimit -H -n`
if [ $? -eq 0 ] ; then
if [ "$MAX_FD" = "maximum" -o "$MAX_FD" = "max" ] ; then
MAX_FD="$MAX_FD_LIMIT"
fi
ulimit -n $MAX_FD
if [ $? -ne 0 ] ; then
warn "Could not set maximum file descriptor limit: $MAX_FD"
fi
else
warn "Could not query maximum file descriptor limit: $MAX_FD_LIMIT"
fi
fi
# For Darwin, add options to specify how the application appears in the dock
if $darwin; then
GRADLE_OPTS="$GRADLE_OPTS \"-Xdock:name=$APP_NAME\" \"-Xdock:icon=$APP_HOME/media/gradle.icns\""
fi
# For Cygwin or MSYS, switch paths to Windows format before running java
if [ "$cygwin" = "true" -o "$msys" = "true" ] ; then
APP_HOME=`cygpath --path --mixed "$APP_HOME"`
CLASSPATH=`cygpath --path --mixed "$CLASSPATH"`
JAVACMD=`cygpath --unix "$JAVACMD"`
# We build the pattern for arguments to be converted via cygpath
ROOTDIRSRAW=`find -L / -maxdepth 1 -mindepth 1 -type d 2>/dev/null`
SEP=""
for dir in $ROOTDIRSRAW ; do
ROOTDIRS="$ROOTDIRS$SEP$dir"
SEP="|"
done
OURCYGPATTERN="(^($ROOTDIRS))"
# Add a user-defined pattern to the cygpath arguments
if [ "$GRADLE_CYGPATTERN" != "" ] ; then
OURCYGPATTERN="$OURCYGPATTERN|($GRADLE_CYGPATTERN)"
fi
# Now convert the arguments - kludge to limit ourselves to /bin/sh
i=0
for arg in "$@" ; do
CHECK=`echo "$arg"|egrep -c "$OURCYGPATTERN" -`
CHECK2=`echo "$arg"|egrep -c "^-"` ### Determine if an option
if [ $CHECK -ne 0 ] && [ $CHECK2 -eq 0 ] ; then ### Added a condition
eval `echo args$i`=`cygpath --path --ignore --mixed "$arg"`
else
eval `echo args$i`="\"$arg\""
fi
i=`expr $i + 1`
done
case $i in
0) set -- ;;
1) set -- "$args0" ;;
2) set -- "$args0" "$args1" ;;
3) set -- "$args0" "$args1" "$args2" ;;
4) set -- "$args0" "$args1" "$args2" "$args3" ;;
5) set -- "$args0" "$args1" "$args2" "$args3" "$args4" ;;
6) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" ;;
7) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" ;;
8) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" ;;
9) set -- "$args0" "$args1" "$args2" "$args3" "$args4" "$args5" "$args6" "$args7" "$args8" ;;
esac
fi
# Escape application args
save () {
for i do printf %s\\n "$i" | sed "s/'/'\\\\''/g;1s/^/'/;\$s/\$/' \\\\/" ; done
echo " "
}
APP_ARGS=`save "$@"`
# Collect all arguments for the java command, following the shell quoting and substitution rules
eval set -- $DEFAULT_JVM_OPTS $JAVA_OPTS $GRADLE_OPTS "\"-Dorg.gradle.appname=$APP_BASE_NAME\"" -classpath "\"$CLASSPATH\"" org.gradle.wrapper.GradleWrapperMain "$APP_ARGS"
exec "$JAVACMD" "$@"
-89
View File
@@ -1,89 +0,0 @@
@rem
@rem Copyright 2015 the original author or authors.
@rem
@rem Licensed under the Apache License, Version 2.0 (the "License");
@rem you may not use this file except in compliance with the License.
@rem You may obtain a copy of the License at
@rem
@rem https://www.apache.org/licenses/LICENSE-2.0
@rem
@rem Unless required by applicable law or agreed to in writing, software
@rem distributed under the License is distributed on an "AS IS" BASIS,
@rem WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
@rem See the License for the specific language governing permissions and
@rem limitations under the License.
@rem
@if "%DEBUG%" == "" @echo off
@rem ##########################################################################
@rem
@rem Gradle startup script for Windows
@rem
@rem ##########################################################################
@rem Set local scope for the variables with windows NT shell
if "%OS%"=="Windows_NT" setlocal
set DIRNAME=%~dp0
if "%DIRNAME%" == "" set DIRNAME=.
set APP_BASE_NAME=%~n0
set APP_HOME=%DIRNAME%
@rem Resolve any "." and ".." in APP_HOME to make it shorter.
for %%i in ("%APP_HOME%") do set APP_HOME=%%~fi
@rem Add default JVM options here. You can also use JAVA_OPTS and GRADLE_OPTS to pass JVM options to this script.
set DEFAULT_JVM_OPTS="-Xmx64m" "-Xms64m"
@rem Find java.exe
if defined JAVA_HOME goto findJavaFromJavaHome
set JAVA_EXE=java.exe
%JAVA_EXE% -version >NUL 2>&1
if "%ERRORLEVEL%" == "0" goto execute
echo.
echo ERROR: JAVA_HOME is not set and no 'java' command could be found in your PATH.
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:findJavaFromJavaHome
set JAVA_HOME=%JAVA_HOME:"=%
set JAVA_EXE=%JAVA_HOME%/bin/java.exe
if exist "%JAVA_EXE%" goto execute
echo.
echo ERROR: JAVA_HOME is set to an invalid directory: %JAVA_HOME%
echo.
echo Please set the JAVA_HOME variable in your environment to match the
echo location of your Java installation.
goto fail
:execute
@rem Setup the command line
set CLASSPATH=%APP_HOME%\gradle\wrapper\gradle-wrapper.jar
@rem Execute Gradle
"%JAVA_EXE%" %DEFAULT_JVM_OPTS% %JAVA_OPTS% %GRADLE_OPTS% "-Dorg.gradle.appname=%APP_BASE_NAME%" -classpath "%CLASSPATH%" org.gradle.wrapper.GradleWrapperMain %*
:end
@rem End local scope for the variables with windows NT shell
if "%ERRORLEVEL%"=="0" goto mainEnd
:fail
rem Set variable GRADLE_EXIT_CONSOLE if you need the _script_ return code instead of
rem the _cmd.exe /c_ return code!
if not "" == "%GRADLE_EXIT_CONSOLE%" exit 1
exit /b 1
:mainEnd
if "%OS%"=="Windows_NT" endlocal
:omega
-1
View File
@@ -1 +0,0 @@
rootProject.name='kontor-java'
@@ -1,46 +0,0 @@
package com.ibtp.kontor;
import com.mongodb.MongoClient;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;
import java.util.HashMap;
/**
* Created by thomas on 01.03.16.
*/
public class Database {
private static Database instance = null;
private HashMap<String, Datastore> dbMap;
private Morphia morphia;
private Database() {
dbMap = new HashMap<String, Datastore>();
initMorphia();
}
private final void initMorphia() {
morphia = new Morphia();
morphia.mapPackage("com.ibtp.kontor.comics.entity");
}
public void registerDatastore(String databaseName) {
if (!dbMap.containsKey(databaseName)) {
Datastore store = morphia.createDatastore(new MongoClient("127.0.0.1"), databaseName);
dbMap.put(databaseName, store);
}
}
public Datastore getDatastore(String databaseName) {
return dbMap.get(databaseName);
}
public static Database init() {
if (instance == null) {
instance = new Database();
}
return instance;
}
}
@@ -1,51 +0,0 @@
package com.ibtp.kontor;
import com.ibtp.kontor.comics.entity.Artist;
import com.ibtp.kontor.comics.entity.Comic;
import com.ibtp.kontor.comics.entity.Publisher;
import com.mongodb.MongoClient;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.Morphia;
import org.mongodb.morphia.query.Query;
import java.util.Iterator;
import java.util.List;
/**
* Created by thomas on 29.02.16.
*/
public class DumpComics {
public static void main(String[] args) {
final Database database = Database.init();
database.registerDatastore("kontor");
database.registerDatastore("comics");
Datastore kontor = database.getDatastore("kontor");
Datastore comics = database.getDatastore("comics");
final Query<Artist> query = kontor.createQuery(Artist.class);
final List<Artist> artists = query.asList();
System.out.println(artists);
for (Artist artist: artists) {
String artistName = artist.getName();
System.out.println("Artist(" + artist.getId() + ": " + artistName + ")");
if (comics.createQuery(Artist.class).field("name").equal(artistName).asList().isEmpty()) {
Artist comicsArtist = new Artist(artistName);
comics.save(comicsArtist);
}
}
final List<Publisher> publishers = kontor.createQuery(Publisher.class).asList();
for (Publisher publisher: publishers) {
String publisherName = publisher.getName();
System.out.println("Publisher(" + publisher.getId() + ": " + publisherName + ")");
if (comics.createQuery(Publisher.class).field("name").equal(publisherName).asList().isEmpty()) {
Publisher comicsPublisher = new Publisher(publisherName);
comics.save(comicsPublisher);
}
}
final List<Comic> comicList = comics.createQuery(Comic.class).asList();
System.out.println(comicList);
for (Comic comic: comicList ) {
System.out.println(comic);
}
}
}
@@ -1,23 +0,0 @@
package com.ibtp.kontor;
/**
* Created by TPEETZ on 10.02.2015.
*/
public class KontorApp {
private KontorGUI mainframe;
public KontorApp() {
mainframe = new KontorGUI(this);
mainframe.setVisible(true);
}
public void exitApplication() {
System.exit(0);
}
public static void main(String[] args) {
new KontorApp();
}
}
@@ -1,69 +0,0 @@
package com.ibtp.kontor;
import com.ibtp.kontor.comics.view.ComicsMenu;
import com.ibtp.kontor.library.view.LibraryMenu;
import com.ibtp.kontor.tradingcards.view.TradingCardsMenu;
import javax.swing.*;
import java.awt.event.ActionEvent;
import java.awt.event.ActionListener;
/**
* Created by TPEETZ on 11.02.2015.
*/
public class KontorGUI extends javax.swing.JFrame {
KontorApp application;
JMenuBar menuBar;
JMenu menuFile;
JMenuItem menuFileExit;
JMenuItem menuFileStart = new JMenuItem();
JMenu menuHelp;
JMenuItem menuHelpAbout;
public KontorGUI(KontorApp kontorApp) {
application = kontorApp;
initComponents();
}
private void initComponents() {
setDefaultCloseOperation(WindowConstants.EXIT_ON_CLOSE);
GroupLayout layout = new GroupLayout(getContentPane());
getContentPane().setLayout(layout);
layout.setHorizontalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 400, Short.MAX_VALUE)
);
layout.setVerticalGroup(
layout.createParallelGroup(GroupLayout.Alignment.LEADING).addGap(0, 300, Short.MAX_VALUE)
);
pack();
setTitle("Kontor Application");
createMainMenu();
//createToolBar();
}
private void createMainMenu() {
menuBar = new JMenuBar();
menuFile = new JMenu("File");
menuFileExit = new JMenuItem("Exit");
menuHelp = new JMenu("Help");
menuHelpAbout = new JMenuItem("About");
setJMenuBar(menuBar);
menuBar.add(menuFile);
menuFile.add(menuFileExit);
menuBar.add(new ComicsMenu());
menuBar.add(new LibraryMenu());
menuBar.add(new TradingCardsMenu());
menuBar.add(menuHelp);
menuHelp.add(menuHelpAbout);
menuFileExit.addActionListener(new ActionListener() {
@Override
public void actionPerformed(ActionEvent e) {
application.exitApplication();
}
});
}
}
@@ -1,26 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.ArtistEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 16.01.2015.
*/
interface ArtistDao {
public ArtistEntity getById(Long id);
public Collection<ArtistEntity> findByIds(List<Long> ids);
public Collection<ArtistEntity> findByName(String name);
public Collection<ArtistEntity> findAll();
public ArtistEntity addArtist(String name);
public ArtistEntity store(ArtistEntity entity);
public void delete(ArtistEntity entity);
}
@@ -1,68 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.ArtistEntity;
import com.ibtp.kontor.dal.BaseImpl;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 16.01.2015.
*/
public class ArtistImpl extends BaseImpl implements ArtistDao {
public ArtistImpl() {}
@Override
public ArtistEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Artist.findById");
query.setParameter("id", id);
return (ArtistEntity)query.getSingleResult();
}
@Override
public Collection<ArtistEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<ArtistEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Artist.findAll");
return query.getResultList();
}
@Override
public Collection<ArtistEntity> findByName(String name) {
Query query = getEntityManager().createNamedQuery("Artist.findByName");
query.setParameter("name", name);
return query.getResultList();
}
@Override
public ArtistEntity addArtist(String name) {
ArtistEntity artist = new ArtistEntity(name);
artist = store(artist);
return artist;
}
@Override
public ArtistEntity store(ArtistEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(ArtistEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,26 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.ComicEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by thomas on 17.01.15.
*/
interface ComicDao {
public ComicEntity getById(Long id);
public Collection<ComicEntity> findByIds(List<Long> ids);
public Collection<ComicEntity> findByTitle(String title);
public Collection<ComicEntity> findAll();
public ComicEntity addComic(String title);
public ComicEntity store(ComicEntity entity);
public void delete(ComicEntity entity);
}
@@ -1,65 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.ComicEntity;
import com.ibtp.kontor.dal.BaseImpl;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class ComicImpl extends BaseImpl implements ComicDao {
@Override
public ComicEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Comic.findById");
query.setParameter("id", id);
return (ComicEntity)query.getSingleResult();
}
@Override
public Collection<ComicEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<ComicEntity> findByTitle(String title) {
Query query = getEntityManager().createNamedQuery("Comic.findByTitle");
query.setParameter("title", title);
return query.getResultList();
}
@Override
public Collection<ComicEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Comic.findAll");
return query.getResultList();
}
@Override
public ComicEntity addComic(String title) {
ComicEntity comicEntity = new ComicEntity();
comicEntity.setTitle(title);
store(comicEntity);
return comicEntity;
}
@Override
public ComicEntity store(ComicEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(ComicEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,23 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.IssueEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 19.01.2015.
*/
interface IssueDao {
public IssueEntity getById(Long id);
public Collection<IssueEntity> findByIds(List<Long> ids);
public Collection<IssueEntity> findByNumber(String number);
public Collection<IssueEntity> findAll();
public IssueEntity store(IssueEntity entity);
public void delete(IssueEntity entity);
}
@@ -1,57 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.IssueEntity;
import com.ibtp.kontor.dal.BaseImpl;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class IssueImpl extends BaseImpl implements IssueDao {
@Override
public IssueEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Issue.findById");
query.setParameter("id", id);
return (IssueEntity)query.getSingleResult();
}
@Override
public Collection<IssueEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<IssueEntity> findByNumber(String number) {
Query query = getEntityManager().createNamedQuery("Issue.findByNumber");
query.setParameter("number", number);
return query.getResultList();
}
@Override
public Collection<IssueEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Issue.findAll");
return query.getResultList();
}
@Override
public IssueEntity store(IssueEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(IssueEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,26 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.PublisherEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by thomas on 17.01.15.
*/
interface PublisherDao {
public PublisherEntity getById(Long id);
public Collection<PublisherEntity> findByIds(List<Long> ids);
public Collection<PublisherEntity> findByName(String name);
public Collection<PublisherEntity> findAll();
public PublisherEntity addPublisher(String name);
public PublisherEntity store(PublisherEntity entity);
public void delete(PublisherEntity entity);
}
@@ -1,62 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.PublisherEntity;
import com.ibtp.kontor.dal.BaseImpl;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 20.01.2015.
*/
public class PublisherImpl extends BaseImpl implements PublisherDao {
@Override
public PublisherEntity getById(Long id) {
return null;
}
@Override
public Collection<PublisherEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<PublisherEntity> findByName(String name) {
Query query = getEntityManager().createNamedQuery("Publisher.findByName");
query.setParameter("name", name);
return query.getResultList();
}
@Override
public Collection<PublisherEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Publisher.findAll");
return query.getResultList();
}
@Override
public PublisherEntity addPublisher(String name) {
PublisherEntity publisher = new PublisherEntity(name);
store(publisher);
return publisher;
}
@Override
public PublisherEntity store(PublisherEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(PublisherEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,24 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.StoryArcEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 19.01.2015.
*/
interface StoryArcDao {
public StoryArcEntity getById(Long id);
public Collection<StoryArcEntity> findByIds(List<Long> ids);
public Collection<StoryArcEntity> findByTitle(String title);
public Collection<StoryArcEntity> findAll();
public StoryArcEntity store(StoryArcEntity entity);
public void delete(StoryArcEntity entity);
}
@@ -1,55 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.StoryArcEntity;
import com.ibtp.kontor.dal.BaseImpl;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class StoryArcImpl extends BaseImpl implements StoryArcDao {
@Override
public StoryArcEntity getById(Long id) {
return null;
}
@Override
public Collection<StoryArcEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<StoryArcEntity> findByTitle(String title) {
Query query = getEntityManager().createNamedQuery("StoryArc.findByTitle");
query.setParameter("title", title);
return query.getResultList();
}
@Override
public Collection<StoryArcEntity> findAll() {
Query query = getEntityManager().createNamedQuery("StoryArc.findAll");
return query.getResultList();
}
@Override
public StoryArcEntity store(StoryArcEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(StoryArcEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,24 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.VolumeEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 19.01.2015.
*/
interface VolumeDao {
public VolumeEntity getById(Long id);
public Collection<VolumeEntity> findByIds(List<Long> ids);
public Collection<VolumeEntity> findByTitle(String title);
public Collection<VolumeEntity> findAll();
public VolumeEntity store(VolumeEntity entity);
public void delete(VolumeEntity entity);
}
@@ -1,57 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.VolumeEntity;
import com.ibtp.kontor.dal.BaseImpl;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class VolumeImpl extends BaseImpl implements VolumeDao {
@Override
public VolumeEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Volume.findById");
query.setParameter("id", id);
return (VolumeEntity)query.getSingleResult();
}
@Override
public Collection<VolumeEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<VolumeEntity> findByTitle(String title) {
Query query = getEntityManager().createNamedQuery("Volume.findByTitle");
query.setParameter("title", title);
return query.getResultList();
}
@Override
public Collection<VolumeEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Volume.findAll");
return query.getResultList();
}
@Override
public VolumeEntity store(VolumeEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(VolumeEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,46 +0,0 @@
package com.ibtp.kontor.comics.entity;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
/**
* Created by thomas on 29.02.16.
*/
@Entity("artist")
public class Artist {
public Artist() {}
public Artist(String name) {
setName(name);
}
@Id
private ObjectId id;
@Property
private String name;
public ObjectId getId() {
return id;
}
public void setId(ObjectId id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
}
@@ -1,72 +0,0 @@
package com.ibtp.kontor.comics.entity;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
/**
* Created by TPEETZ on 16.01.2015.
*/
@NamedQueries({
@NamedQuery(name="Artist.findAll", query="SELECT a from ArtistEntity as a"),
@NamedQuery(name="Artist.findByName", query="SELECT a from ArtistEntity as a WHERE a.name = :name")
})
@Entity
@Table(name="ARTIST")
public class ArtistEntity {
private Long id;
private String name;
private Collection<IssueEntity> writtenIssues = new ArrayList<IssueEntity>();
private Collection<IssueEntity> inkedIssues = new ArrayList<IssueEntity>();
private Collection<IssueEntity> penciledIssues = new ArrayList<IssueEntity>();
public ArtistEntity(String name) {
setName(name);
}
public ArtistEntity() {}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
String getName() { return name; }
void setName(String name) { this.name = name; }
public void setWrittenIssues(Collection<IssueEntity> writtenIssues) { this.writtenIssues = writtenIssues; }
@OneToMany(mappedBy="writer", cascade=CascadeType.REMOVE)
public Collection<IssueEntity> getWrittenIssues() {
return writtenIssues;
}
public void setInkedIssues(Collection<IssueEntity> inkedIssues) { this.inkedIssues = inkedIssues; }
@OneToMany(mappedBy="inker", cascade=CascadeType.REMOVE)
public Collection<IssueEntity> getInkedIssues() {
return inkedIssues;
}
public void setPenciledIssues(Collection<IssueEntity> penciledIssues) { this.penciledIssues = penciledIssues; }
@OneToMany(mappedBy="penciler", cascade=CascadeType.REMOVE)
public Collection<IssueEntity> getPenciledIssues() {
return penciledIssues;
}
@Override
public String toString() {
return "Artist[" + "id=" + getId() + ",name=" + getName() + "]";
}
}
@@ -1,98 +0,0 @@
package com.ibtp.kontor.comics.entity;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import java.util.ArrayList;
import java.util.List;
/**
* Created by thomas on 01.03.16.
*/
@Entity("comic")
public class Comic {
@Id
private ObjectId id;
@Property
private String title;
@Property
private ObjectId publisher;
@Property
private Boolean current_order;
@Property
private Boolean completed;
@Property
private List<Issue> issues = new ArrayList<Issue>();
@Property
private List<StoryArc> stories = new ArrayList<StoryArc>();
public ObjectId getId() {
return id;
}
public void setId(ObjectId id) {
this.id = id;
}
public String getTitle() {
return title;
}
public void setTitle(String title) {
this.title = title;
}
public ObjectId getPublisher() {
return publisher;
}
public void setPublisher(ObjectId publisher) {
this.publisher = publisher;
}
public Boolean getCurrent_order() {
return current_order;
}
public void setCurrent_order(Boolean current_order) {
this.current_order = current_order;
}
public Boolean getCompleted() {
return completed;
}
public void setCompleted(Boolean completed) {
this.completed = completed;
}
public List<Issue> getIssues() {
return issues;
}
public void setIssues(List<Issue> issues) {
this.issues = issues;
}
public List<StoryArc> getStories() {
return stories;
}
public void setStories(List<StoryArc> stories) {
this.stories = stories;
}
@Override
public String toString() {
return title + " - " + Publisher.getById(publisher);
}
}
@@ -1,81 +0,0 @@
package com.ibtp.kontor.comics.entity;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
/**
* Created by thomas on 17.01.15.
*/
@NamedQueries({
@NamedQuery(name="Comic.findAll", query="SELECT c from ComicEntity as c"),
@NamedQuery(name="Comic.findByTitle", query="SELECT c from ComicEntity as c WHERE c.title = :title")
})
@Entity
@Table(name = "COMIC")
public class ComicEntity {
private Long id;
private String title;
private Boolean completed;
private Boolean currentOrder;
private Collection<IssueEntity> issues = new ArrayList<IssueEntity>();
private Collection<StoryArcEntity> storyArc = new ArrayList<StoryArcEntity>();
private Collection<VolumeEntity> volumes = new ArrayList<VolumeEntity>();
private PublisherEntity publisher;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
@Column
public Boolean getCompleted() { return completed; }
public Boolean isCompleted() { return completed; }
public void setCompleted(Boolean completed) { this.completed = completed; }
@Column
public Boolean getCurrentOrder() { return currentOrder; }
public Boolean isCurrentOrder() { return currentOrder; }
public void setCurrentOrder(Boolean currentOrder) { this.currentOrder = currentOrder; }
public void setIssues(Collection<IssueEntity> issues) { this.issues = issues; }
@OneToMany(mappedBy="comic", cascade=CascadeType.REMOVE)
public Collection<IssueEntity> getIssues() { return issues; }
public void setStoryArc(Collection<StoryArcEntity> storyArc) { this.storyArc = storyArc; }
@OneToMany(mappedBy="comic", cascade=CascadeType.REMOVE)
public Collection<StoryArcEntity> getStoryArc() { return storyArc; }
public void setVolumes(Collection<VolumeEntity> volumes) { this.volumes = volumes; }
@OneToMany(mappedBy="comic", cascade=CascadeType.REMOVE)
public Collection<VolumeEntity> getVolumes() { return volumes; }
@ManyToOne
public PublisherEntity getPublisher() { return publisher; }
public void setPublisher(PublisherEntity publisher) {
this.publisher = publisher;
}
}
@@ -1,66 +0,0 @@
package com.ibtp.kontor.comics.entity;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
/**
* Created by thomas on 01.03.16.
*/
public class Issue {
@Id
private ObjectId id;
@Property
private String number;
//@Reference
private Comic comic;
@Property
private Boolean is_read;
@Property
private Boolean is_stock;
public ObjectId getId() {
return id;
}
public void setId(ObjectId id) {
this.id = id;
}
public String getNumber() {
return number;
}
public void setNumber(String number) {
this.number = number;
}
public Comic getComic() {
return comic;
}
public void setComic(Comic comic) {
this.comic = comic;
}
public Boolean getIs_read() {
return is_read;
}
public void setIs_read(Boolean is_read) {
this.is_read = is_read;
}
public Boolean getIs_stock() {
return is_stock;
}
public void setIs_stock(Boolean is_stock) {
this.is_stock = is_stock;
}
}
@@ -1,75 +0,0 @@
package com.ibtp.kontor.comics.entity;
import javax.persistence.*;
/**
* Created by thomas on 18.01.15.
*/
@NamedQueries({
@NamedQuery(name="Issue.findAll", query="SELECT i from IssueEntity as i"),
@NamedQuery(name="Issue.findByNumber", query="SELECT i from IssueEntity as i WHERE i.number = :number")
})
@Entity
@Table(name = "ISSUE")
public class IssueEntity {
private Long id;
private String number;
private Boolean completed;
private ComicEntity comic;
private ArtistEntity writer;
private ArtistEntity inker;
private ArtistEntity penciler;
private StoryArcEntity storyArc;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getNumber() { return number; }
public void setNumber(String number) { this.number = number; }
@Column
public Boolean getCompleted() { return completed; }
public Boolean isCompleted() { return completed; }
public void setCompleted(Boolean completed) { this.completed = completed; }
public void setComic(ComicEntity comic) { this.comic = comic; }
@ManyToOne
public ComicEntity getComic() { return comic; }
public void setWriter(ArtistEntity writer) { this.writer = writer; }
@ManyToOne
public ArtistEntity getWriter() { return writer; }
public void setInker(ArtistEntity inker) { this.inker = inker; }
@ManyToOne
public ArtistEntity getInker() { return inker; }
public void setPenciler(ArtistEntity penciler) { this.penciler = penciler; }
@ManyToOne
public ArtistEntity getPenciler() { return penciler; }
public void setStoryArc(StoryArcEntity storyArc) { this.storyArc = storyArc; }
@ManyToOne
public StoryArcEntity getStoryArc() { return storyArc; }
}
@@ -1,60 +0,0 @@
package com.ibtp.kontor.comics.entity;
import com.ibtp.kontor.Database;
import org.bson.types.ObjectId;
import org.mongodb.morphia.Datastore;
import org.mongodb.morphia.annotations.Entity;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import java.util.List;
/**
* Created by thomas on 01.03.16.
*/
@Entity("publisher")
public class Publisher {
public Publisher() {}
public Publisher(String name) {
setName(name);
}
@Id
private ObjectId id;
@Property
private String name;
public ObjectId getId() {
return id;
}
public void setId(ObjectId id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Override
public String toString() {
return name;
}
public static Publisher getById(ObjectId publisherId) {
Datastore store = Database.init().getDatastore("comics");
List<Publisher> results = store.createQuery(Publisher.class).field("id").equal(publisherId).asList();
if (results.size() > 0) {
return results.get(0);
} else {
return null;
}
}
}
@@ -1,47 +0,0 @@
package com.ibtp.kontor.comics.entity;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
/**
* Created by thomas on 17.01.15.
*/
@NamedQueries({
@NamedQuery(name="Publisher.findAll", query="SELECT p from PublisherEntity as p"),
@NamedQuery(name="Publisher.findByName", query="SELECT p from PublisherEntity as p WHERE p.name = :name")
})
@Entity
@Table(name = "PUBLISHER")
public class PublisherEntity {
private Long id;
private String name;
private Collection<ComicEntity> comic = new ArrayList<ComicEntity>();
public PublisherEntity() {}
public PublisherEntity(String name) {
setName(name);
}
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() { return name; }
void setName(String name) { this.name = name; }
public void setComic(Collection<ComicEntity> comic) { this.comic = comic; }
@OneToMany(mappedBy="publisher", cascade=CascadeType.REMOVE)
public Collection<ComicEntity> getComic() { return comic; }
}
@@ -1,59 +0,0 @@
package com.ibtp.kontor.comics.entity;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import org.mongodb.morphia.annotations.Reference;
import java.util.ArrayList;
import java.util.List;
/**
* Created by thomas on 01.03.16.
*/
public class StoryArc {
@Id
private ObjectId id;
@Property
private String name;
@Reference
private Comic comic;
@Reference
private List<Issue> issues = new ArrayList<Issue>();
public ObjectId getId() {
return id;
}
public void setId(ObjectId id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Comic getComic() {
return comic;
}
public void setComic(Comic comic) {
this.comic = comic;
}
public List<Issue> getIssues() {
return issues;
}
public void setIssues(List<Issue> issues) {
this.issues = issues;
}
}
@@ -1,48 +0,0 @@
package com.ibtp.kontor.comics.entity;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
/**
* Created by thomas on 17.01.15.
*/
@NamedQueries({
@NamedQuery(name="StoryArc.findAll", query="SELECT s from StoryArcEntity as s"),
@NamedQuery(name="StoryArc.findByTitle", query="SELECT s from StoryArcEntity as s WHERE s.title = :title")
})
@Entity
@Table(name = "STORYARC")
public class StoryArcEntity {
private Long id;
private String title;
private Collection<IssueEntity> issues = new ArrayList<IssueEntity>();
private ComicEntity comic;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
public void setIssues(Collection<IssueEntity> issues) { this.issues = issues; }
@OneToMany(mappedBy="storyArc", cascade=CascadeType.REMOVE)
public Collection<IssueEntity> getIssues() { return issues; }
public void setComic(ComicEntity comic) { this.comic = comic; }
@ManyToOne
public ComicEntity getComic() { return comic; }
}
@@ -1,56 +0,0 @@
package com.ibtp.kontor.comics.entity;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Reference;
/**
* Created by thomas on 01.03.16.
*/
public class TradePaperback {
@Id
private ObjectId id;
@Reference
private Comic comic;
@Reference
private String issue_start;
@Reference
private String issue_end;
public ObjectId getId() {
return id;
}
public void setId(ObjectId id) {
this.id = id;
}
public Comic getComic() {
return comic;
}
public void setComic(Comic comic) {
this.comic = comic;
}
public String getIssue_start() {
return issue_start;
}
public void setIssue_start(String issue_start) {
this.issue_start = issue_start;
}
public String getIssue_end() {
return issue_end;
}
public void setIssue_end(String issue_end) {
this.issue_end = issue_end;
}
}
@@ -1,70 +0,0 @@
package com.ibtp.kontor.comics.entity;
import org.bson.types.ObjectId;
import org.mongodb.morphia.annotations.Id;
import org.mongodb.morphia.annotations.Property;
import org.mongodb.morphia.annotations.Reference;
import java.util.ArrayList;
import java.util.List;
/**
* Created by thomas on 01.03.16.
*/
public class Volume {
public Volume() {}
public Volume(String name) {
setName(name);
}
@Id
private ObjectId id;
@Property
private String name;
@Reference
private Comic comic;
@Reference
private List<Issue> issues = new ArrayList<Issue>();
public ObjectId getId() {
return id;
}
public void setId(ObjectId id) {
this.id = id;
}
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
public Comic getComic() {
return comic;
}
public void setComic(Comic comic) {
this.comic = comic;
}
public List<Issue> getIssues() {
return issues;
}
public void setIssues(List<Issue> issues) {
this.issues = issues;
}
@Override
public String toString() {
return name;
}
}
@@ -1,40 +0,0 @@
package com.ibtp.kontor.comics.entity;
import javax.persistence.*;
/**
* Created by TPEETZ on 19.01.2015.
*/
@NamedQueries({
@NamedQuery(name="Volume.findAll", query="SELECT v from VolumeEntity as v"),
@NamedQuery(name="Volume.findByTitle", query="SELECT v from VolumeEntity as v WHERE v.title = :title")
})
@Entity
@Table(name = "VOLUME")
public class VolumeEntity {
private Long id;
private String title;
private ComicEntity comic;
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
@ManyToOne
public ComicEntity getComic() { return comic; }
public void setComic(ComicEntity comic) { this.comic = comic; }
}
@@ -1,13 +0,0 @@
package com.ibtp.kontor.comics.view;
import javax.swing.*;
/**
* Created by tpeetz on 12.02.2015.
*/
public class ComicsMenu extends JMenu {
public ComicsMenu() {
super("Comics");
}
}
@@ -1,21 +0,0 @@
package com.ibtp.kontor.dal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.EntityManager;
/**
* Created by TPEETZ on 16.01.2015.
*/
public class BaseImpl {
protected BaseImpl() {
Logger logger = LoggerFactory.getLogger(this.getClass().getName());
logger.info("BaseImpl started");
}
protected EntityManager getEntityManager() {
return DatabaseManager.getDatabase().getEntityManager();
}
}
@@ -1,11 +0,0 @@
package com.ibtp.kontor.dal;
import javax.persistence.EntityManager;
/**
* Created by TPEETZ on 21.01.2015.
*/
public interface Database {
public EntityManager getEntityManager();
}
@@ -1,23 +0,0 @@
package com.ibtp.kontor.dal;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
/**
* Created by TPEETZ on 22.01.2015.
*/
public class DatabaseManager {
private static Database database;
private static Logger logger = LoggerFactory.getLogger(DatabaseManager.class.getName());
public static Database getDatabase() {
logger.info("return " + database.toString());
return database;
}
public static void setDatabase(Database database) {
logger.info("set " + database.toString());
DatabaseManager.database = database;
}
}
@@ -1,104 +0,0 @@
package com.ibtp.kontor.dal;
import org.hibernate.jpa.HibernatePersistenceProvider;
import org.hsqldb.Server;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import javax.persistence.EntityManager;
import javax.persistence.EntityManagerFactory;
import javax.persistence.Persistence;
import javax.persistence.spi.PersistenceProvider;
import javax.persistence.spi.PersistenceProviderResolver;
import javax.persistence.spi.PersistenceProviderResolverHolder;
import java.io.PrintWriter;
import java.util.Arrays;
import java.util.List;
/**
* Created by TPEETZ on 19.01.2015.
*/
public class LocalDatabase implements Database {
private static Server server;
private static EntityManagerFactory factory;
private static EntityManager em;
private static Logger logger = LoggerFactory.getLogger(LocalDatabase.class.getName());
private LocalDatabase() {
logger.info("LocalDatabase started");
}
private static void assureDatabaseRunning() {
if (LocalDatabase.server == null) {
LocalDatabase.startDatabase();
}
}
private static void startDatabase() {
Logger logger = LoggerFactory.getLogger(LocalDatabase.class.getName());
logger.info("startDatabase as kontor in hsqldb_databases/kontor");
LocalDatabase.server = new Server();
LocalDatabase.server.setAddress("localhost");
LocalDatabase.server.setDatabaseName(0, "kontor");
LocalDatabase.server.setDatabasePath(0, "file:hsqldb_databases/kontor");
LocalDatabase.server.setPort(2345);
LocalDatabase.server.setTrace(true);
LocalDatabase.server.setLogWriter(new PrintWriter(System.out));
LocalDatabase.server.start();
}
private static void stopDatabase() {
server.shutdown();
}
private static EntityManagerFactory getFactory() {
if (LocalDatabase.factory == null) {
LocalDatabase.assureDatabaseRunning();
PersistenceProviderResolverHolder.setPersistenceProviderResolver(new PersistenceProviderResolver() {
private final List<PersistenceProvider> providers_ = Arrays.asList((PersistenceProvider) new HibernatePersistenceProvider());
@Override
public void clearCachedProviders() {
// Auto-generated method stub
}
@Override
public List<PersistenceProvider> getPersistenceProviders() {
return providers_;
}
});
LocalDatabase.factory = Persistence.createEntityManagerFactory("com.ibtp.kontor");
logger.info("EntityManagerFactory(com.ibtp.kontor) created");
}
return LocalDatabase.factory;
}
private static EntityManager getSingleEntityManager() {
return LocalDatabase.em;
}
private static void setSingleEntityManager(EntityManager manager) {
LocalDatabase.em = manager;
}
@Override
public EntityManager getEntityManager() {
if (getSingleEntityManager() == null) {
setSingleEntityManager(getFactory().createEntityManager());
logger.info("EntityManager created");
}
return getSingleEntityManager();
}
@Override
public String toString() {
String serverMessage;
if (LocalDatabase.server == null) {
serverMessage = "server:null";
} else {
serverMessage = LocalDatabase.server.toString();
}
return LocalDatabase.class.getName() + " " + serverMessage;
}
}
@@ -1,23 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.library.entity.ArticleEntity;
import java.util.List;
/**
* Created by tpeetz on 23.01.2015.
*/
interface ArticleDao {
public ArticleEntity getById(Long id);
public List<ArticleEntity> findByIds(List<Long> ids);
public List<ArticleEntity> findAll();
public List<ArticleEntity> findByTitle(String title);
public ArticleEntity store(ArticleEntity entity);
public void delete(ArticleEntity entity);
}
@@ -1,64 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.library.entity.ArticleEntity;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;
/**
* Created by tpeetz on 23.01.2015.
*/
public class ArticleImpl extends BaseImpl implements ArticleDao {
@Override
public ArticleEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Article.findById");
query.setParameter("id", id);
return (ArticleEntity)query.getSingleResult();
}
@Override
public List<ArticleEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public List<ArticleEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Article.findAll");
//noinspection unchecked
return query.getResultList();
}
@Override
public List<ArticleEntity> findByTitle(String title) {
Query query = getEntityManager().createNamedQuery("Article.findByTitle");
query.setParameter("title", title);
//noinspection unchecked
return query.getResultList();
}
public ArticleEntity addArticle(String title) {
ArticleEntity entity = new ArticleEntity(title);
store(entity);
return entity;
}
@Override
public ArticleEntity store(ArticleEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(ArticleEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,25 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.library.entity.AuthorEntity;
import java.util.List;
/**
* Created by tpeetz on 23.01.2015.
*/
interface AuthorDao {
public AuthorEntity getById(Long id);
public List<AuthorEntity> findByIds(List<Long> ids);
public List<AuthorEntity> findByName(String name);
public List<AuthorEntity> findAll();
public AuthorEntity addAuthor(String name);
public AuthorEntity store(AuthorEntity entity);
public void delete(AuthorEntity entity);
}
@@ -1,65 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.library.entity.AuthorEntity;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.List;
/**
* Created by thomas on 23.01.15.
*/
public class AuthorImpl extends BaseImpl implements AuthorDao {
public AuthorImpl() {}
@Override
public AuthorEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Author.findById");
query.setParameter("id", id);
return (AuthorEntity)query.getSingleResult();
}
@Override
public List<AuthorEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public List<AuthorEntity> findByName(String name) {
Query query = getEntityManager().createNamedQuery("Author.findByName");
query.setParameter("name", name);
return query.getResultList();
}
@Override
public List<AuthorEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Author.findAll");
return query.getResultList();
}
@Override
public AuthorEntity addAuthor(String name) {
AuthorEntity author = new AuthorEntity(name);
store(author);
return author;
}
@Override
public AuthorEntity store(AuthorEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(AuthorEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,22 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.library.entity.BookEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by tpeetz on 23.01.2015.
*/
interface BookDao {
public BookEntity getById(Long id);
public Collection<BookEntity> findByIds(List<Long> ids);
public Collection<BookEntity> findByName(String name);
public BookEntity store(BookEntity entity);
public void delete(BookEntity entity);
}
@@ -1,38 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.library.entity.BookEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
public class BookImpl extends BaseImpl implements BookDao {
@Override
public BookEntity getById(Long id) {
return null;
}
@Override
public Collection<BookEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<BookEntity> findByName(String name) {
return null;
}
@Override
public BookEntity store(BookEntity entity) {
return null;
}
@Override
public void delete(BookEntity entity) {
}
}
@@ -1,22 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.library.entity.FileEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by tpeetz on 23.01.2015.
*/
interface FileDao {
public FileEntity getById(Long id);
public Collection<FileEntity> findByIds(List<Long> ids);
public Collection<FileEntity> findByName(String name);
public FileEntity store(FileEntity entity);
public void delete(FileEntity entity);
}
@@ -1,38 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.library.entity.FileEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
public class FileImpl extends BaseImpl implements FileDao {
@Override
public FileEntity getById(Long id) {
return null;
}
@Override
public Collection<FileEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<FileEntity> findByName(String name) {
return null;
}
@Override
public FileEntity store(FileEntity entity) {
return null;
}
@Override
public void delete(FileEntity entity) {
}
}
@@ -1,22 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.library.entity.TitleEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by tpeetz on 23.01.2015.
*/
interface TitleDao {
public TitleEntity getById(Long id);
public Collection<TitleEntity> findByIds(List<Long> ids);
public Collection<TitleEntity> findByName(String name);
public TitleEntity store(TitleEntity entity);
public void delete(TitleEntity entity);
}
@@ -1,38 +0,0 @@
package com.ibtp.kontor.library.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.library.entity.TitleEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
public class TitleImpl extends BaseImpl implements TitleDao {
@Override
public TitleEntity getById(Long id) {
return null;
}
@Override
public Collection<TitleEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<TitleEntity> findByName(String name) {
return null;
}
@Override
public TitleEntity store(TitleEntity entity) {
return null;
}
@Override
public void delete(TitleEntity entity) {
}
}
@@ -1,56 +0,0 @@
package com.ibtp.kontor.library.entity;
import javax.persistence.*;
/**
* Created by TPEETZ on 23.01.2015.
*/
@NamedQueries({
@NamedQuery(name="Article.findAll", query="SELECT a from ArticleEntity as a"),
@NamedQuery(name="Article.findByTitle", query="SELECT a from ArticleEntity as a WHERE a.title = :title")
})
@Entity
@Table(name = "ARTICLE")
public class ArticleEntity {
private Long id;
private String title;
private AuthorEntity author;
public ArticleEntity() {}
public ArticleEntity(String title) {
setTitle(title);
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
public void setId(Long id) {
this.id = id;
}
@Column
public String getTitle() {
return title;
}
void setTitle(String title) {
this.title = title;
}
@ManyToOne
public AuthorEntity getAuthor() {
return author;
}
public void setAuthor(AuthorEntity author) {
this.author = author;
}
}
@@ -1,62 +0,0 @@
package com.ibtp.kontor.library.entity;
import javax.persistence.*;
import java.util.ArrayList;
import java.util.Collection;
/**
* Created by TPEETZ on 23.01.2015.
*/
@NamedQueries({
@NamedQuery(name="Author.findAll", query="SELECT a from AuthorEntity as a"),
@NamedQuery(name="Author.findById", query="SELECT a from AuthorEntity as a WHERE a.id = :id"),
@NamedQuery(name="Author.findByName", query="SELECT a from AuthorEntity as a WHERE a.name = :name")
})
@Entity
@Table(name="AUTHOR")
public class AuthorEntity {
private Long id;
private String name;
private Collection<BookEntity> books = new ArrayList<BookEntity>();
private Collection<ArticleEntity> articles = new ArrayList<ArticleEntity>();
public AuthorEntity() {}
public AuthorEntity(String name) {
setName(name);
}
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() { return name; }
void setName(String name) { this.name = name; }
@OneToMany(mappedBy="author", cascade=CascadeType.REMOVE)
public Collection<BookEntity> getBooks() {
return books;
}
public void setBooks(Collection<BookEntity> books) {
this.books = books;
}
@OneToMany(mappedBy="author", cascade=CascadeType.REMOVE)
public Collection<ArticleEntity> getArticles() {
return articles;
}
public void setArticles(Collection<ArticleEntity> articles) {
this.articles = articles;
}
}
@@ -1,96 +0,0 @@
package com.ibtp.kontor.library.entity;
import javax.persistence.*;
/**
* Created by TPEETZ on 23.01.2015.
*/
@Entity
@Table(name = "BOOK")
public class BookEntity {
private Long id;
private String title;
private AuthorEntity author;
private String publisher;
private String isbn;
private Long page;
private String edition;
public BookEntity() {}
public BookEntity(String title) {
setTitle(title);
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
/* unused */
public void setId(Long id) {
this.id = id;
}
@Column
public String getTitle() {
return title;
}
void setTitle(String title) {
this.title = title;
}
@ManyToOne
public AuthorEntity getAuthor() {
return author;
}
public void setAuthor(AuthorEntity author) {
this.author = author;
}
@Column
public String getIsbn() {
return isbn;
}
public void setIsbn(String isbn) {
this.isbn = isbn;
}
@Column
public Long getPage() {
return page;
}
public void setPage(Long page) {
this.page = page;
}
@Column
public String getEdition() {
return edition;
}
public void setEdition(String edition) {
this.edition = edition;
}
@Column
public String getPublisher() {
return publisher;
}
public void setPublisher(String publisher) {
this.publisher = publisher;
}
}
@@ -1,41 +0,0 @@
package com.ibtp.kontor.library.entity;
import javax.persistence.*;
/**
* Created by TPEETZ on 23.01.2015.
*/
@Entity
@Table(name = "FILE")
public class FileEntity {
private Long id;
private String title;
public FileEntity() {}
public FileEntity(String title) {
setTitle(title);
}
@Id
@GeneratedValue(strategy = GenerationType.AUTO)
public Long getId() {
return id;
}
/* unused */
public void setId(Long id) {
this.id = id;
}
@Column
public String getTitle() {
return title;
}
void setTitle(String title) {
this.title = title;
}
}
@@ -1,27 +0,0 @@
package com.ibtp.kontor.library.entity;
import javax.persistence.*;
/**
* Created by TPEETZ on 23.01.2015.
*/
@Entity
@Table(name = "TITLE")
public class TitleEntity {
private Long id;
private String title;
@Id
@GeneratedValue(strategy= GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getTitle() { return title; }
public void setTitle(String title) { this.title = title; }
}
@@ -1,13 +0,0 @@
package com.ibtp.kontor.library.view;
import javax.swing.*;
/**
* Created by tpeetz on 12.02.2015.
*/
public class LibraryMenu extends JMenu {
public LibraryMenu() {
super("Library");
}
}
@@ -1,22 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.BaseSetEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
interface BaseSetDao {
public BaseSetEntity getById(Long id);
public Collection<BaseSetEntity> findByIds(List<Long> ids);
public Collection<BaseSetEntity> findByName(String name);
public BaseSetEntity store(BaseSetEntity entity);
public void delete(BaseSetEntity entity);
}
@@ -1,51 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.BaseSetEntity;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
public class BaseSetImpl extends BaseImpl implements BaseSetDao {
@Override
public BaseSetEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("BaseSet.findById");
query.setParameter("id", id);
return (BaseSetEntity)query.getSingleResult();
}
@Override
public Collection<BaseSetEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<BaseSetEntity> findByName(String name) {
Query query = getEntityManager().createNamedQuery("BaseSet.findByName");
query.setParameter("name", name);
return query.getResultList();
}
@Override
public BaseSetEntity store(BaseSetEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(BaseSetEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,22 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.InsertEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
interface InsertDao {
public InsertEntity getById(Long id);
public Collection<InsertEntity> findByIds(List<Long> ids);
public Collection<InsertEntity> findByName(String name);
public InsertEntity store(InsertEntity entity);
public void delete(InsertEntity entity);
}
@@ -1,38 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.InsertEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by tpeetz on 27.01.2015.
*/
public class InsertImpl extends BaseImpl implements InsertDao {
@Override
public InsertEntity getById(Long id) {
return null;
}
@Override
public Collection<InsertEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<InsertEntity> findByName(String name) {
return null;
}
@Override
public InsertEntity store(InsertEntity entity) {
return null;
}
@Override
public void delete(InsertEntity entity) {
}
}
@@ -1,29 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.BaseSetEntity;
import com.ibtp.kontor.tradingcards.entity.ManufacturerEntity;
import java.util.Collection;
import java.util.List;
/**
*
* @author tpeetz
*/
interface ManufacturerDao {
public ManufacturerEntity getById(Long id);
public Collection<ManufacturerEntity> findByIds(List<Long> ids);
public Collection<ManufacturerEntity> findByName(String name);
public ManufacturerEntity assignBaseSet(ManufacturerEntity manufacturer, BaseSetEntity baseSet);
public ManufacturerEntity addManufacturer(String name);
public ManufacturerEntity store(ManufacturerEntity entity);
public void delete(ManufacturerEntity entity);
}
@@ -1,65 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.BaseSetEntity;
import com.ibtp.kontor.tradingcards.entity.ManufacturerEntity;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
/**
*
* @author tpeetz
*/
public class ManufacturerImpl extends BaseImpl implements ManufacturerDao {
@Override
public ManufacturerEntity getById(Long id) {
Query q = getEntityManager().createNamedQuery("Manufacturer.findById");
q.setParameter("id", id);
return (ManufacturerEntity)q.getSingleResult();
}
@Override
public List<ManufacturerEntity> findByIds(List<Long> ids) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@SuppressWarnings("unchecked")
@Override
public List<ManufacturerEntity> findByName(String name) {
Query q = getEntityManager().createNamedQuery("Manufacturer.findByName");
q.setParameter("name", name);
return q.getResultList();
}
@Override
public ManufacturerEntity assignBaseSet(ManufacturerEntity comic, BaseSetEntity baseSet) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public ManufacturerEntity addManufacturer(String name) {
ManufacturerEntity manufacturer = new ManufacturerEntity(name);
store(manufacturer);
return manufacturer;
}
@Override
public ManufacturerEntity store(ManufacturerEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(ManufacturerEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,22 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.ParallelSetEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
interface ParallelSetDao {
public ParallelSetEntity getById(Long id);
public Collection<ParallelSetEntity> findByIds(List<Long> ids);
public Collection<ParallelSetEntity> findByName(String name);
public ParallelSetEntity store(ParallelSetEntity entity);
public void delete(ParallelSetEntity entity);
}
@@ -1,38 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.ParallelSetEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by tpeetz on 27.01.2015.
*/
public class ParallelSetImpl extends BaseImpl implements ParallelSetDao {
@Override
public ParallelSetEntity getById(Long id) {
return null;
}
@Override
public Collection<ParallelSetEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<ParallelSetEntity> findByName(String name) {
return null;
}
@Override
public ParallelSetEntity store(ParallelSetEntity entity) {
return null;
}
@Override
public void delete(ParallelSetEntity entity) {
}
}
@@ -1,24 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.PlayerEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
interface PlayerDao {
public PlayerEntity getById(Long id);
public Collection<PlayerEntity> findByIds(List<Long> ids);
public Collection<PlayerEntity> findByName(String name);
public PlayerEntity addPlayer(String name);
public PlayerEntity store(PlayerEntity entity);
public void delete(PlayerEntity entity);
}
@@ -1,43 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.PlayerEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by tpeetz on 27.01.2015.
*/
public class PlayerImpl extends BaseImpl implements PlayerDao {
@Override
public PlayerEntity getById(Long id) {
return null;
}
@Override
public Collection<PlayerEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<PlayerEntity> findByName(String name) {
return null;
}
@Override
public PlayerEntity addPlayer(String name) {
return null;
}
@Override
public PlayerEntity store(PlayerEntity entity) {
return null;
}
@Override
public void delete(PlayerEntity entity) {
}
}
@@ -1,26 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.PositionEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
interface PositionDao {
public PositionEntity getById(Long id);
public Collection<PositionEntity> findByIds(List<Long> ids);
public Collection<PositionEntity> findByName(String name);
public Collection<PositionEntity> findAll();
public PositionEntity addPosition(String name);
public PositionEntity store(PositionEntity entity);
public void delete(PositionEntity entity);
}
@@ -1,65 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.PositionEntity;
import java.util.Collection;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
/**
* Created by tpeetz on 27.01.2015.
*/
public class PositionImpl extends BaseImpl implements PositionDao {
@Override
public PositionEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Position.findById");
query.setParameter("id", id);
return (PositionEntity)query.getSingleResult();
}
@Override
public Collection<PositionEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<PositionEntity> findByName(String name) {
Query query = getEntityManager().createNamedQuery("Position.findByName");
query.setParameter("name", name);
return query.getResultList();
}
@Override
public Collection<PositionEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Position.findAll");
return query.getResultList();
}
@Override
public PositionEntity addPosition(String name) {
PositionEntity position = new PositionEntity(name);
store(position);
return position;
}
@Override
public PositionEntity store(PositionEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(PositionEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,22 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.SportCardEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 27.01.2015.
*/
interface SportCardDao {
public SportCardEntity getById(Long id);
public Collection<SportCardEntity> findByIds(List<Long> ids);
public Collection<SportCardEntity> findByName(String name);
public SportCardEntity store(SportCardEntity entity);
public void delete(SportCardEntity entity);
}
@@ -1,38 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.SportCardEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by tpeetz on 27.01.2015.
*/
public class SportCardImpl extends BaseImpl implements SportCardDao {
@Override
public SportCardEntity getById(Long id) {
return null;
}
@Override
public Collection<SportCardEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<SportCardEntity> findByName(String name) {
return null;
}
@Override
public SportCardEntity store(SportCardEntity entity) {
return null;
}
@Override
public void delete(SportCardEntity entity) {
}
}
@@ -1,26 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.SportEntity;
import java.util.Collection;
import java.util.List;
/**
*
* @author tpeetz
*/
interface SportDao {
public SportEntity getById(Long id);
public Collection<SportEntity> findByIds(List<Long> ids);
public Collection<SportEntity> findByName(String name);
public Collection<SportEntity> findAll();
public SportEntity addSport(String name);
public SportEntity store(SportEntity entity);
public void delete(SportEntity entity);
}
@@ -1,64 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.SportEntity;
import java.util.Collection;
import java.util.List;
import javax.persistence.EntityManager;
import javax.persistence.Query;
/**
*
* @author tpeetz
*/
public class SportImpl extends BaseImpl implements SportDao {
@Override
public SportEntity getById(Long id) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@Override
public List<SportEntity> findByIds(List<Long> ids) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
@SuppressWarnings("unchecked")
@Override
public List<SportEntity> findByName(String name) {
Query query = getEntityManager().createNamedQuery("Sport.findByName");
query.setParameter("name", name);
return query.getResultList();
}
@Override
public Collection<SportEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Sport.findAll");
return query.getResultList();
}
@Override
public SportEntity addSport(String name) {
SportEntity sport = new SportEntity(name);
store(sport);
return sport;
}
@Override
public SportEntity store(SportEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(SportEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,26 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.tradingcards.entity.SportEntity;
import com.ibtp.kontor.tradingcards.entity.TeamEntity;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 19.01.2015.
*/
interface TeamDao {
public TeamEntity getById(Long id);
public Collection<TeamEntity> findByIds(List<Long> ids);
public Collection<TeamEntity> findByName(String name);
public Collection<TeamEntity> findAll();
public TeamEntity addTeam(String name, SportEntity sport);
public TeamEntity store(TeamEntity entity);
public void delete(TeamEntity entity);
}
@@ -1,66 +0,0 @@
package com.ibtp.kontor.tradingcards.dal;
import com.ibtp.kontor.dal.BaseImpl;
import com.ibtp.kontor.tradingcards.entity.SportEntity;
import com.ibtp.kontor.tradingcards.entity.TeamEntity;
import javax.persistence.EntityManager;
import javax.persistence.Query;
import java.util.Collection;
import java.util.List;
/**
* Created by TPEETZ on 19.01.2015.
*/
public class TeamImpl extends BaseImpl implements TeamDao {
@Override
public TeamEntity getById(Long id) {
Query query = getEntityManager().createNamedQuery("Team.findById");
query.setParameter("id", id);
return (TeamEntity)query.getSingleResult();
}
@Override
public Collection<TeamEntity> findByIds(List<Long> ids) {
return null;
}
@Override
public Collection<TeamEntity> findByName(String name) {
Query query = getEntityManager().createNamedQuery("Team.findByName");
query.setParameter("name", name);
return query.getResultList();
}
@Override
public Collection<TeamEntity> findAll() {
Query query = getEntityManager().createNamedQuery("Team.findAll");
return query.getResultList();
}
@Override
public TeamEntity addTeam(String name, SportEntity sport) {
TeamEntity team = new TeamEntity(name);
team.setSport(sport);
store(team);
return team;
}
@Override
public TeamEntity store(TeamEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.persist(entity);
em.getTransaction().commit();
return entity;
}
@Override
public void delete(TeamEntity entity) {
EntityManager em = getEntityManager();
em.getTransaction().begin();
em.remove(entity);
em.getTransaction().commit();
}
}
@@ -1,67 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="BASESET")
public class BaseSetEntity {
private Long id;
private String name;
private ManufacturerEntity manufacturer;
private Collection<ParallelSetEntity> parallelSets = new ArrayList<ParallelSetEntity>();
private Collection<InsertEntity> inserts = new ArrayList<InsertEntity>();
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ManyToOne
public ManufacturerEntity getManufacturer() {
return manufacturer;
}
public void setManufacturer(ManufacturerEntity manufacturer) {
this.manufacturer = manufacturer;
}
@OneToMany(mappedBy="baseSet", cascade=CascadeType.REMOVE)
public Collection<ParallelSetEntity> getParallelSets() {
return parallelSets;
}
public void setParallelSets(Collection<ParallelSetEntity> parallelSets) {
this.parallelSets = parallelSets;
}
@OneToMany(mappedBy="baseSet", cascade=CascadeType.REMOVE)
public Collection<InsertEntity> getInserts() {
return inserts;
}
public void setInserts(Collection<InsertEntity> inserts) {
this.inserts = inserts;
}
}
@@ -1,74 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="InsertSet.findAll", query="SELECT i from InsertEntity as i"),
@NamedQuery(name="InsertSet.findById", query="SELECT i from InsertEntity as i WHERE i.id = :id"),
@NamedQuery(name="InsertSet.findByName", query="SELECT i from InsertEntity as i WHERE i.name = :name")
})
@Entity
@Table(name="INSERTSET")
public class InsertEntity {
private Long id;
private String name;
private ManufacturerEntity manufacturer;
private BaseSetEntity baseSet;
private Collection<SportCardEntity> sportCard = new ArrayList<SportCardEntity>();
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@ManyToOne
public ManufacturerEntity getManufacturer() {
return manufacturer;
}
public void setManufacturer(ManufacturerEntity manufacturer) {
this.manufacturer = manufacturer;
}
@ManyToOne
public BaseSetEntity getBaseSet() {
return baseSet;
}
public void setBaseSet(BaseSetEntity baseSet) {
this.baseSet = baseSet;
}
@OneToMany(mappedBy="insert", cascade=CascadeType.REMOVE)
public Collection<SportCardEntity> getSportCard() {
return sportCard;
}
public void setSportCard(Collection<SportCardEntity> sportCard) {
this.sportCard = sportCard;
}
}
@@ -1,78 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="Manufacturer.findAll", query="SELECT m from ManufacturerEntity as m"),
@NamedQuery(name="Manufacturer.findByName", query="SELECT m from ManufacturerEntity as m WHERE m.name = :name")
})
@Entity
@Table(name="MANUFACTURER")
public class ManufacturerEntity {
private Long id;
private String name;
private Collection<BaseSetEntity> baseSets = new ArrayList<BaseSetEntity>();
private Collection<ParallelSetEntity> parallelSets = new ArrayList<ParallelSetEntity>();
private Collection<InsertEntity> inserts = new ArrayList<InsertEntity>();
public ManufacturerEntity(String name) {
setName(name);
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() {
return name;
}
void setName(String name) {
this.name = name;
}
@OneToMany(mappedBy="manufacturer", cascade=CascadeType.REMOVE)
public Collection<BaseSetEntity> getBaseSets() {
return baseSets;
}
public void setBaseSets(Collection<BaseSetEntity> baseSets) {
this.baseSets = baseSets;
}
@OneToMany(mappedBy="manufacturer", cascade=CascadeType.REMOVE)
public Collection<ParallelSetEntity> getParallelSets() {
return parallelSets;
}
public void setParallelSets(Collection<ParallelSetEntity> parallelSets) {
this.parallelSets = parallelSets;
}
@OneToMany(mappedBy="manufacturer", cascade=CascadeType.REMOVE)
public Collection<InsertEntity> getInserts() {
return inserts;
}
public void setInserts(Collection<InsertEntity> inserts) {
this.inserts = inserts;
}
}
@@ -1,53 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.Table;
@Entity
@Table(name="PARALLELSET")
public class ParallelSetEntity {
private Long id;
private String name;
private ManufacturerEntity manufacturer;
private BaseSetEntity baseSet;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() {
return name;
}
@ManyToOne
public ManufacturerEntity getManufacturer() {
return manufacturer;
}
public void setManufacturer(ManufacturerEntity manufacturer) {
this.manufacturer = manufacturer;
}
public void setName(String name) {
this.name = name;
}
@ManyToOne
public BaseSetEntity getBaseSet() {
return baseSet;
}
public void setBaseSet(BaseSetEntity baseSet) {
this.baseSet = baseSet;
}
}
@@ -1,46 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@Entity
@Table(name="PLAYER")
public class PlayerEntity {
private Long id;
private TeamEntity team;
private Collection<SportCardEntity> cards = new ArrayList<SportCardEntity>();
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@ManyToOne
public TeamEntity getTeam() {
return team;
}
public void setTeam(TeamEntity team) {
this.team = team;
}
@OneToMany(mappedBy="player", cascade=CascadeType.REMOVE)
public Collection<SportCardEntity> getCards() {
return cards;
}
public void setCards(Collection<SportCardEntity> cards) {
this.cards = cards;
}
}
@@ -1,66 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQuery;
import javax.persistence.NamedQueries;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="Position.findAll", query="SELECT p from PositionEntity as p"),
@NamedQuery(name="Position.findByName", query="SELECT p from PositionEntity as p WHERE p.name = :name")
})
@Entity
@Table(name="POSITION")
public class PositionEntity {
private Long id;
private String name;
private String shortName;
private SportEntity sport;
public PositionEntity() {}
public PositionEntity(String name) {
setName(name);
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
@ManyToOne
public SportEntity getSport() {
return sport;
}
public void setSport(SportEntity sport) {
this.sport = sport;
}
}
@@ -1,68 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="SportCard.findAll", query="SELECT s from SportCardEntity as s")
})
@Entity
@Table(name = "SPORTCARD")
public class SportCardEntity {
private Long id;
private PlayerEntity player;
private BaseSetEntity baseSet;
private ParallelSetEntity parallelSet;
private InsertEntity insert;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@ManyToOne
public PlayerEntity getPlayer() {
return player;
}
public void setPlayer(PlayerEntity player) {
this.player = player;
}
@ManyToOne
public BaseSetEntity getBaseSet() {
return baseSet;
}
public void setBaseSet(BaseSetEntity baseSet) {
this.baseSet = baseSet;
}
@ManyToOne
public ParallelSetEntity getParallelSet() {
return parallelSet;
}
public void setParallelSet(ParallelSetEntity parallelSet) {
this.parallelSet = parallelSet;
}
@ManyToOne
public InsertEntity getInsert() {
return insert;
}
public void setInsert(InsertEntity insert) {
this.insert = insert;
}
}
@@ -1,75 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="Sport.findAll", query="SELECT s from SportEntity as s"),
@NamedQuery(name="Sport.findByName", query="SELECT s from SportEntity as s WHERE s.name = :name")
})
@Entity
@Table(name="SPORT")
public class SportEntity {
private Long id;
private String name;
private Collection<TeamEntity> teams = new ArrayList<TeamEntity>();
private Collection<PositionEntity> positions = new ArrayList<PositionEntity>();
public SportEntity() {}
public SportEntity(String name) {
setName(name);
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
String getName() {
return name;
}
void setName(String name) {
this.name = name;
}
@OneToMany(mappedBy="sport", cascade=CascadeType.REMOVE)
public Collection<TeamEntity> getTeams() {
return teams;
}
public void setTeams(Collection<TeamEntity> teams) {
this.teams = teams;
}
@OneToMany(mappedBy="sport", cascade=CascadeType.REMOVE)
public Collection<PositionEntity> getPositions() {
return positions;
}
public void setPositions(Collection<PositionEntity> positions) {
this.positions = positions;
}
@Override
public String toString() {
return "Sport[" + "id=" + getId() + ",name=" + getName() + "]";
}
}
@@ -1,48 +0,0 @@
package com.ibtp.kontor.tradingcards.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="Team.findAll", query="SELECT t from TeamEntity as t"),
@NamedQuery(name="Team.findByName", query="SELECT t from TeamEntity as t WHERE t.name = :name")
})
@Entity
@Table(name="TEAM")
public class TeamEntity {
private Long id;
private String name;
private SportEntity sport;
public TeamEntity() {}
public TeamEntity(String name) {
setName(name);
}
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() { return name; }
void setName(String name) { this.name = name; }
@ManyToOne
public SportEntity getSport() { return sport; }
public void setSport(SportEntity sport) { this.sport = sport; }
}
@@ -1,13 +0,0 @@
package com.ibtp.kontor.tradingcards.view;
import javax.swing.*;
/**
* Created by TPEETZ on 13.02.2015.
*/
public class TradingCardsMenu extends JMenu {
public TradingCardsMenu() {
super("TradingCards");
}
}
@@ -1,39 +0,0 @@
<persistence xmlns="http://java.sun.com/xml/ns/persistence"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_2_0.xsd"
version="2.0">
<persistence-unit name="com.ibtp.kontor" >
<provider>org.hibernate.jpa.HibernatePersistenceProvider</provider>
<class>com.ibtp.kontor.comics.entity.ArtistEntity</class>
<class>com.ibtp.kontor.comics.entity.ComicEntity</class>
<class>com.ibtp.kontor.comics.entity.IssueEntity</class>
<class>com.ibtp.kontor.comics.entity.StoryArcEntity</class>
<class>com.ibtp.kontor.comics.entity.VolumeEntity</class>
<class>com.ibtp.kontor.comics.entity.PublisherEntity</class>
<class>com.ibtp.kontor.library.entity.AuthorEntity</class>
<class>com.ibtp.kontor.library.entity.ArticleEntity</class>
<class>com.ibtp.kontor.library.entity.BookEntity</class>
<class>com.ibtp.kontor.library.entity.FileEntity</class>
<class>com.ibtp.kontor.library.entity.TitleEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.SportEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.TeamEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.PositionEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.PlayerEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.ManufacturerEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.BaseSetEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.InsertEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.ParallelSetEntity</class>
<class>com.ibtp.kontor.tradingcards.entity.SportCardEntity</class>
<properties>
<property name="javax.persistence.jdbc.driver" value="org.hsqldb.jdbcDriver"/>
<property name="javax.persistence.jdbc.user" value="sa"/>
<property name="javax.persistence.jdbc.password" value=""/>
<property name="javax.persistence.jdbc.url" value="jdbc:hsqldb:hsql://localhost:2345/kontor;shutdown=true;hsqldb.write_delay=false"/>
<property name="hibernate.dialect" value="org.hibernate.dialect.HSQLDialect"/>
<property name="hibernate.show_sql" value="true"/>
<property name="hibernate.max_fetch_depth" value="3"/>
<property name="hibernate.hbm2ddl.auto" value="update"/>
<property name="hsqldb.write_delay" value="false"/>
</properties>
</persistence-unit>
</persistence>
-40
View File
@@ -1,40 +0,0 @@
<?xml version="1.0" encoding="UTF-8"?>
<configuration>
<appender name="STDOUT" class="ch.qos.logback.core.ConsoleAppender">
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} %-5level %logger{36} - %msg%n
</Pattern>
</encoder>
</appender>
<appender name="FILE"
class="ch.qos.logback.core.rolling.RollingFileAppender">
<file>c:/kontor.log</file>
<encoder class="ch.qos.logback.classic.encoder.PatternLayoutEncoder">
<Pattern>%d{yyyy-MM-dd_HH:mm:ss.SSS} [%thread] %-5level %logger{36} - %msg%n
</Pattern>
</encoder>
<rollingPolicy class="ch.qos.logback.core.rolling.FixedWindowRollingPolicy">
<FileNamePattern>c:/kontor.%i.log.zip</FileNamePattern>
<MinIndex>1</MinIndex>
<MaxIndex>10</MaxIndex>
</rollingPolicy>
<triggeringPolicy
class="ch.qos.logback.core.rolling.SizeBasedTriggeringPolicy">
<MaxFileSize>2MB</MaxFileSize>
</triggeringPolicy>
</appender>
<logger name="org.hibernate.type" level="ALL" />
<logger name="org.hibernate" level="DEBUG" />
<root level="INFO">
<appender-ref ref="FILE" />
<appender-ref ref="STDOUT" />
</root>
</configuration>
@@ -1,43 +0,0 @@
package com.ibtp.kontor.comics;
import com.ibtp.kontor.comics.dal.PublisherImpl;
import com.ibtp.kontor.comics.entity.PublisherEntity;
import com.ibtp.kontor.dal.DatabaseManager;
import com.ibtp.kontor.util.LocalTestDatabase;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collection;
/**
* Created by TPEETZ on 27.01.2015.
*/
public class CollectionTest {
@BeforeAll
public static void setUp() {
DatabaseManager.setDatabase(new LocalTestDatabase());
}
@AfterAll
public static void cleanup() {
PublisherImpl publisherImpl = new PublisherImpl();
Collection<PublisherEntity> publisherEntities = publisherImpl.findAll();
for (PublisherEntity publisherEntity : publisherEntities) {
publisherImpl.delete(publisherEntity);
}
}
@Test
public void testAddPublishers() {
String publisherName = "Bongo Comics";
PublisherImpl publisherImpl = new PublisherImpl();
publisherImpl.addPublisher(publisherName);
publisherImpl.addPublisher("Marvel");
Collection<PublisherEntity> publisherList = publisherImpl.findAll();
assertEquals(2, publisherList.size());
}
}
@@ -1,65 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.ArtistEntity;
import com.ibtp.kontor.dal.*;
import com.ibtp.kontor.util.LocalTestDatabase;
import org.junit.jupiter.api.AfterAll;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import static org.junit.jupiter.api.Assertions.assertTrue;
import java.util.Collection;
public class ArtistImplTest {
@BeforeAll
public static void setUp() {
DatabaseManager.setDatabase(new LocalTestDatabase());
tearDown();
}
@AfterAll
public static void tearDown() {
ArtistImpl artistImpl = new ArtistImpl();
Collection<ArtistEntity> artistList = artistImpl.findAll();
for (ArtistEntity artistEntity : artistList) {
artistImpl.delete(artistEntity);
}
}
@Test
public void testArtistAddAndDelete() {
String artistName = "testArtistAddAndDelete";
ArtistImpl artistImpl = new ArtistImpl();
artistImpl.addArtist(artistName);
Collection<ArtistEntity> resultList = artistImpl.findByName(artistName);
assertNotNull(resultList);
assertTrue(resultList.size() > 0);
ArtistEntity artist = (ArtistEntity)(resultList.toArray()[0]);
artistImpl.delete(artist);
resultList = artistImpl.findByName(artistName);
assertNotNull(resultList);
assertEquals(0, resultList.size());
}
@Test
public void testArtistFindAll() {
ArtistImpl artistImpl = new ArtistImpl();
Collection<ArtistEntity> artistList = artistImpl.findAll();
assertNotNull(artistList);
assertEquals(0, artistList.size());
artistImpl.addArtist("testArtistFindAll1");
artistImpl.addArtist("testArtistFindAll2");
artistImpl.addArtist("testArtistFindAll3");
artistList = artistImpl.findAll();
assertNotNull(artistList);
assertEquals(3, artistList.size());
for (ArtistEntity artistEntity : artistList) {
artistImpl.delete(artistEntity);
}
}
}
@@ -1,57 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.ComicEntity;
import com.ibtp.kontor.dal.DatabaseManager;
import com.ibtp.kontor.util.LocalTestDatabase;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Collection;
import java.util.Iterator;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class ComicImplTest {
@BeforeAll
public static void setUp() {
DatabaseManager.setDatabase(new LocalTestDatabase());
}
@Test
public void testComicAddAndDelete() {
String comicTitle = "Comic1";
ComicImpl comicImpl = new ComicImpl();
comicImpl.addComic(comicTitle);
Collection<ComicEntity> comicList = comicImpl.findByTitle(comicTitle);
assertNotNull(comicList);
assertEquals(1, comicList.size());
comicImpl.delete((ComicEntity) comicList.toArray()[0]);
comicList = comicImpl.findByTitle(comicTitle);
assertNotNull(comicList);
assertEquals(0, comicList.size());
}
@Test
public void testComicFindAll() {
ComicImpl comicImpl = new ComicImpl();
comicImpl.addComic("Comic1");
comicImpl.addComic("Comic2");
comicImpl.addComic("Comic3");
Collection<ComicEntity> comicList = comicImpl.findAll();
assertNotNull(comicList);
assertEquals(3, comicList.size());
for (Iterator<ComicEntity> iterator = comicList.iterator(); iterator.hasNext(); ) {
ComicEntity next = iterator.next();
comicImpl.delete(next);
}
comicList = comicImpl.findAll();
assertNotNull(comicList);
assertEquals(0, comicList.size());
}
}
@@ -1,64 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.IssueEntity;
import com.ibtp.kontor.dal.DatabaseManager;
import com.ibtp.kontor.util.LocalTestDatabase;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Collection;
import java.util.Iterator;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class IssueImplTest {
@BeforeAll
public static void setUp() {
DatabaseManager.setDatabase(new LocalTestDatabase());
}
@Test
public void testIssueAddAndDelete() {
String issueNumber = "42";
IssueImpl issueImpl = new IssueImpl();
IssueEntity issue = new IssueEntity();
issue.setNumber(issueNumber);
issueImpl.store(issue);
Collection<IssueEntity> issueList = issueImpl.findByNumber(issueNumber);
assertNotNull(issueList);
assertEquals(1, issueList.size());
issueImpl.delete(issue);
issueList = issueImpl.findByNumber(issueNumber);
assertNotNull(issueList);
assertEquals(0, issueList.size());
}
@Test
public void testIssueFindAll() {
IssueImpl issueImpl = new IssueImpl();
IssueEntity issue1 = new IssueEntity();
issue1.setNumber("issue1");
IssueEntity issue2 = new IssueEntity();
issue1.setNumber("issue2");
IssueEntity issue3 = new IssueEntity();
issue1.setNumber("issue3");
issueImpl.store(issue1);
issueImpl.store(issue2);
issueImpl.store(issue3);
Collection<IssueEntity> issueList = issueImpl.findAll();
assertNotNull(issueList);
assertEquals(3, issueList.size());
for (IssueEntity issueEntity : issueList) {
issueImpl.delete(issueEntity);
}
issueList = issueImpl.findAll();
assertNotNull(issueList);
assertEquals(0, issueList.size());
}
}
@@ -1,56 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.PublisherEntity;
import com.ibtp.kontor.dal.DatabaseManager;
import com.ibtp.kontor.util.LocalTestDatabase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import java.util.Collection;
import java.util.Iterator;
/**
* Created by TPEETZ on 20.01.2015.
*/
public class PublisherImplTest {
@BeforeAll
public static void setUp() {
DatabaseManager.setDatabase(new LocalTestDatabase());
}
@AfterEach
public void cleanUp() {
PublisherImpl publisherImpl = new PublisherImpl();
Collection<PublisherEntity> publisherList = publisherImpl.findAll();
for (PublisherEntity publisherEntity : publisherList) {
publisherImpl.delete(publisherEntity);
}
}
@Test
public void testPublisherAddAndDelete() {
String publisherName = "testPublisherAddAndDelete";
PublisherImpl publisherImpl = new PublisherImpl();
PublisherEntity publisher = publisherImpl.addPublisher(publisherName);
Collection<PublisherEntity> publisherList = publisherImpl.findByName(publisherName);
assertEquals(1, publisherList.size());
publisherImpl.delete(publisher);
publisherList = publisherImpl.findByName(publisherName);
assertEquals(0, publisherList.size());
}
@Test
public void testPublisherFindAll() {
PublisherImpl publisherImpl = new PublisherImpl();
publisherImpl.addPublisher("testDeletePublisher1");
publisherImpl.addPublisher("testDeletePublisher2");
publisherImpl.addPublisher("testDeletePublisher3");
Collection<PublisherEntity> publisherList = publisherImpl.findAll();
assertEquals(3, publisherList.size());
}
}
@@ -1,63 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.StoryArcEntity;
import com.ibtp.kontor.dal.DatabaseManager;
import com.ibtp.kontor.util.LocalTestDatabase;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Collection;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class StoryArcImplTest {
@BeforeAll
public static void setUp() {
DatabaseManager.setDatabase(new LocalTestDatabase());
StoryArcImpl storyArcImpl = new StoryArcImpl();
Collection<StoryArcEntity> storyArcEntityCollection = storyArcImpl.findAll();
for (StoryArcEntity storyArcEntity : storyArcEntityCollection) {
storyArcImpl.delete(storyArcEntity);
}
}
@Test
public void testStoryArcAddAndDelete() {
String storyArcTtitle = "testStoryArcAddAndDelete";
StoryArcImpl storyArcImpl = new StoryArcImpl();
StoryArcEntity storyArc = new StoryArcEntity();
storyArc.setTitle(storyArcTtitle);
storyArcImpl.store(storyArc);
Collection<StoryArcEntity> storyArcEntityCollection = storyArcImpl.findByTitle(storyArcTtitle);
assertNotNull(storyArcEntityCollection);
assertEquals(1, storyArcEntityCollection.size());
storyArcImpl.delete(storyArc);
storyArcEntityCollection = storyArcImpl.findByTitle(storyArcTtitle);
assertNotNull(storyArcEntityCollection);
assertEquals(0, storyArcEntityCollection.size());
}
@Test
public void testStoryArcFindAll() {
StoryArcImpl storyArcImpl = new StoryArcImpl();
StoryArcEntity storyArc;
storyArc = new StoryArcEntity();
storyArc.setTitle("testStoryArcFindAll1");
storyArcImpl.store(storyArc);
storyArc = new StoryArcEntity();
storyArc.setTitle("testStoryArcFindAll2");
storyArcImpl.store(storyArc);
storyArc = new StoryArcEntity();
storyArc.setTitle("testStoryArcFindAll3");
storyArcImpl.store(storyArc);
Collection<StoryArcEntity> storyArcEntityCollection = storyArcImpl.findAll();
assertNotNull(storyArcEntityCollection);
assertEquals(3, storyArcEntityCollection.size());
}
}
@@ -1,72 +0,0 @@
package com.ibtp.kontor.comics.dal;
import com.ibtp.kontor.comics.entity.VolumeEntity;
import com.ibtp.kontor.dal.DatabaseManager;
import com.ibtp.kontor.util.LocalTestDatabase;
import org.junit.jupiter.api.AfterEach;
import org.junit.jupiter.api.BeforeAll;
import org.junit.jupiter.api.Test;
import static org.junit.jupiter.api.Assertions.assertEquals;
import static org.junit.jupiter.api.Assertions.assertNotNull;
import java.util.Collection;
import java.util.Iterator;
/**
* Created by TPEETZ on 28.01.2015.
*/
public class VolumeImplTest {
@BeforeAll
public static void setUp() {
DatabaseManager.setDatabase(new LocalTestDatabase());
}
@AfterEach
public void cleanUp() {
VolumeImpl volumeImpl = new VolumeImpl();
Collection<VolumeEntity> volumeList = volumeImpl.findAll();
for (VolumeEntity volumeEntity : volumeList) {
volumeImpl.delete(volumeEntity);
}
}
@Test
public void testVolumeAddAndDelete() {
String volumeTitle = "testVolumeAddAndDelete";
VolumeImpl volumeImpl = new VolumeImpl();
VolumeEntity volume = new VolumeEntity();
volume.setTitle(volumeTitle);
VolumeEntity volumeEntity = volumeImpl.store(volume);
assertNotNull(volumeEntity);
assertEquals(volumeTitle, volumeEntity.getTitle());
Collection<VolumeEntity> volumeList = volumeImpl.findByTitle(volumeTitle);
assertNotNull(volumeList);
assertEquals(1, volumeList.size());
VolumeEntity result = (VolumeEntity)volumeList.toArray()[0];
assertEquals(volume, result);
volumeImpl.delete(result);
volumeList = volumeImpl.findByTitle(volumeTitle);
assertEquals(0, volumeList.size());
}
@Test
public void testVolumeFindAll() {
VolumeImpl volumeImpl = new VolumeImpl();
VolumeEntity volume;
volume = new VolumeEntity();
volume.setTitle("testVolumeFindAll1");
volumeImpl.store(volume);
volume = new VolumeEntity();
volume.setTitle("testVolumeFindAll2");
volumeImpl.store(volume);
volume = new VolumeEntity();
volume.setTitle("testVolumeFindAll3");
volumeImpl.store(volume);
Collection<VolumeEntity> volumeList = volumeImpl.findAll();
assertNotNull(volumeList);
assertEquals(3, volumeList.size());
}
}
@@ -1,63 +0,0 @@
package com.ibtp.kontor.dal;
import static org.junit.jupiter.api.Assertions.fail;
import java.lang.reflect.Method;
import org.junit.jupiter.api.Test;
/**
* Created by TPEETZ on 10.02.2015.
*/
public class DataAccessLayerTest {
public void findTests(String packageName, String entityName) {
String testClassName = packageName + entityName + "ImplTest";
Class testClass;
try {
testClass = Class.forName(testClassName);
Method addAndDelete = testClass.getMethod("test" + entityName + "AddAndDelete");
Method findAll = testClass.getMethod("test" + entityName + "FindAll");
} catch (ClassNotFoundException e) {
fail("Class " + testClassName + " missing");
} catch (NoSuchMethodException e) {
fail("Test method for class " + testClassName + " missing");
}
}
@Test
public void testFindComicTests() {
/*
* Find all Tests
*/
String[] testClasses = new String[]{"Artist", "Comic", "Issue", "Publisher", "StoryArc", "Volume"};
for (int i = 0; i < testClasses.length; i++) {
String testEntity = testClasses[i];
findTests("com.ibtp.kontor.comics.dal.", testEntity);
}
}
@Test
public void testFindLibraryTests() {
/*
* Find all Tests
*/
String[] testClasses = new String[]{"Article", "Author", "Book", "File", "Title"};
for (int i = 0; i < testClasses.length; i++) {
String testEntity = testClasses[i];
findTests("com.ibtp.kontor.library.dal.", testEntity);
}
}
@Test
public void testFindTradingCardsTests() {
/*
* Find all Tests
*/
String[] testClasses = new String[]{"BaseSet", "Insert", "Manufacturer", "ParallelSet", "Player", "Position", "SportCard", "Sport", "Team"};
for (int i = 0; i < testClasses.length; i++) {
String testEntity = testClasses[i];
findTests("com.ibtp.kontor.tradingcards.dal." , testEntity);
}
}
}

Some files were not shown because too many files have changed in this diff Show More