remove obsolete kontor.py
This commit is contained in:
@@ -0,0 +1,5 @@
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Implementation-Title': 'Comics', 'Implementation-Version': version
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,192 @@
|
||||
<?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>
|
||||
@@ -0,0 +1,179 @@
|
||||
<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>
|
||||
|
||||
|
||||
@@ -0,0 +1,15 @@
|
||||
<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>
|
||||
@@ -0,0 +1,19 @@
|
||||
package com.peetz.comics.dal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.peetz.comics.entity.ArtistEntity;
|
||||
|
||||
@Local
|
||||
public interface ArtistDao {
|
||||
|
||||
public ArtistEntity getById(Long id);
|
||||
|
||||
public List<ArtistEntity> findByIds(List<Long> ids);
|
||||
|
||||
public ArtistEntity store(ArtistEntity entity);
|
||||
|
||||
public void delete(ArtistEntity entity);
|
||||
}
|
||||
@@ -0,0 +1,45 @@
|
||||
package com.peetz.comics.dal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.TransactionAttribute;
|
||||
import javax.ejb.TransactionAttributeType;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import com.peetz.comics.entity.ArtistEntity;
|
||||
|
||||
@Stateless(name = "ArtistDao")
|
||||
@TransactionAttribute(TransactionAttributeType.REQUIRED)
|
||||
public class ArtistImpl implements ArtistDao {
|
||||
|
||||
@PersistenceContext(unitName = "kontor")
|
||||
private EntityManager em;
|
||||
|
||||
@Override
|
||||
public ArtistEntity getById(Long id) {
|
||||
Query q = em.createNamedQuery("");
|
||||
q.setParameter("id", id);
|
||||
ArtistEntity entity = (ArtistEntity)q.getSingleResult();
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ArtistEntity> findByIds(List<Long> ids) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ArtistEntity store(ArtistEntity entity) {
|
||||
em.persist(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(ArtistEntity entity) {
|
||||
em.remove(entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
package com.peetz.comics.dal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.peetz.comics.entity.ComicEntity;
|
||||
import com.peetz.comics.entity.PublisherEntity;
|
||||
|
||||
@Local
|
||||
public interface ComicDao {
|
||||
public ComicEntity getById(Long id);
|
||||
|
||||
public List<ComicEntity> findByIds(List<Long> ids);
|
||||
|
||||
public List<ComicEntity> findByTitle(String title);
|
||||
|
||||
public ComicEntity assignPublisher(ComicEntity comic, PublisherEntity publisher);
|
||||
|
||||
public ComicEntity store(ComicEntity entity);
|
||||
|
||||
public void delete(ComicEntity entity);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
package com.peetz.comics.dal;
|
||||
|
||||
import java.util.List;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.TransactionAttribute;
|
||||
import javax.ejb.TransactionAttributeType;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
|
||||
import com.peetz.comics.entity.ComicEntity;
|
||||
import com.peetz.comics.entity.PublisherEntity;
|
||||
|
||||
@Stateless(name = "ComicDao")
|
||||
@TransactionAttribute(TransactionAttributeType.REQUIRED)
|
||||
public class ComicImpl implements ComicDao {
|
||||
|
||||
@PersistenceContext(unitName = "kontor")
|
||||
private EntityManager em;
|
||||
|
||||
@Override
|
||||
public ComicEntity getById(Long id) {
|
||||
Query q = em.createNamedQuery("Comic.findById");
|
||||
q.setParameter("id", id);
|
||||
ComicEntity entity = (ComicEntity)q.getSingleResult();
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComicEntity> findByIds(List<Long> ids) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public List<ComicEntity> findByTitle(String title) {
|
||||
Query q = em.createNamedQuery("Comic.findByTitle");
|
||||
q.setParameter("title", title);
|
||||
@SuppressWarnings("unchecked")
|
||||
List<ComicEntity> resultList = q.getResultList();
|
||||
return resultList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComicEntity assignPublisher(ComicEntity comic,
|
||||
PublisherEntity publisher) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComicEntity store(ComicEntity entity) {
|
||||
em.persist(entity);
|
||||
return entity;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void delete(ComicEntity entity) {
|
||||
em.remove(entity);
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
package com.peetz.comics.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="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>();
|
||||
|
||||
@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; }
|
||||
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,90 @@
|
||||
package com.peetz.comics.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="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>();
|
||||
|
||||
public 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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,80 @@
|
||||
package com.peetz.comics.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="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; }
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
package com.peetz.comics.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="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>();
|
||||
|
||||
@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; }
|
||||
|
||||
public void setComic(Collection<ComicEntity> comic) { this.comic = comic; }
|
||||
|
||||
@OneToMany(mappedBy="publisher", cascade=CascadeType.REMOVE)
|
||||
public Collection<ComicEntity> getComic() { return comic; }
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
package com.peetz.comics.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="StoryArc.findAll", query="SELECT a from StoryArcEntity as a"),
|
||||
@NamedQuery(name="StoryArc.findByArtist", query="SELECT a from StoryArcEntity as a WHERE a.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; }
|
||||
}
|
||||
@@ -0,0 +1,37 @@
|
||||
package com.peetz.comics.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="VOLUME")
|
||||
public class VolumeEntity {
|
||||
|
||||
private Long id;
|
||||
|
||||
private String title;
|
||||
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,34 @@
|
||||
package com.peetz.comics.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ejb.Local;
|
||||
|
||||
import com.peetz.comics.entity.ArtistEntity;
|
||||
import com.peetz.comics.entity.ComicEntity;
|
||||
import com.peetz.comics.entity.IssueEntity;
|
||||
import com.peetz.comics.entity.PublisherEntity;
|
||||
import com.peetz.comics.entity.StoryArcEntity;
|
||||
|
||||
@Local
|
||||
public interface ComicService {
|
||||
public Collection<ComicEntity> getAllComics();
|
||||
|
||||
public Collection<PublisherEntity> getAllPublisher();
|
||||
|
||||
public Collection<ArtistEntity> getAllArtists();
|
||||
|
||||
public Collection<IssueEntity> getAllIssuesForComic(ComicEntity comic);
|
||||
|
||||
public Collection<StoryArcEntity> getAllStoryArcs();
|
||||
|
||||
public void addStoryArc(String title);
|
||||
|
||||
public void addPublisher(String name);
|
||||
|
||||
public ComicEntity addComic(String title);
|
||||
|
||||
public PublisherEntity getPublisherById(String nodeValue);
|
||||
|
||||
public void assignPublisher(ComicEntity comic, PublisherEntity publisher);
|
||||
}
|
||||
@@ -0,0 +1,92 @@
|
||||
package com.peetz.comics.service;
|
||||
|
||||
import java.util.Collection;
|
||||
|
||||
import javax.ejb.Stateless;
|
||||
import javax.ejb.TransactionAttribute;
|
||||
import javax.ejb.TransactionAttributeType;
|
||||
|
||||
import com.peetz.comics.entity.ArtistEntity;
|
||||
import com.peetz.comics.entity.ComicEntity;
|
||||
import com.peetz.comics.entity.IssueEntity;
|
||||
import com.peetz.comics.entity.PublisherEntity;
|
||||
import com.peetz.comics.entity.StoryArcEntity;
|
||||
import java.util.ArrayList;
|
||||
import javax.persistence.EntityManager;
|
||||
import javax.persistence.PersistenceContext;
|
||||
import javax.persistence.Query;
|
||||
|
||||
@Stateless(name="ComicService")
|
||||
@TransactionAttribute(TransactionAttributeType.REQUIRED)
|
||||
public class ComicServiceImpl implements ComicService {
|
||||
|
||||
@PersistenceContext(unitName = "kontor")
|
||||
private EntityManager em;
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Collection<ComicEntity> getAllComics() {
|
||||
Query query = em.createNamedQuery("Comic.findAll");
|
||||
ArrayList<ComicEntity> comicList = new ArrayList<ComicEntity>(query.getResultList());
|
||||
return comicList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PublisherEntity> getAllPublisher() {
|
||||
Query query = em.createNamedQuery("Publisher.findAll");
|
||||
@SuppressWarnings("unchecked")
|
||||
ArrayList<PublisherEntity> publisherList = new ArrayList<PublisherEntity>(query.getResultList());
|
||||
return publisherList;
|
||||
}
|
||||
|
||||
@SuppressWarnings("unchecked")
|
||||
@Override
|
||||
public Collection<ArtistEntity> getAllArtists() {
|
||||
Query query = em.createNamedQuery("Artist.findAll");
|
||||
ArrayList<ArtistEntity> artistList = new ArrayList<ArtistEntity>(query.getResultList());
|
||||
return artistList;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<IssueEntity> getAllIssuesForComic(ComicEntity comic) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<StoryArcEntity> getAllStoryArcs() {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addStoryArc(String title) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public void addPublisher(String name) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
@Override
|
||||
public ComicEntity addComic(String title) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public PublisherEntity getPublisherById(String nodeValue) {
|
||||
// TODO Auto-generated method stub
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public void assignPublisher(ComicEntity comic, PublisherEntity publisher) {
|
||||
// TODO Auto-generated method stub
|
||||
|
||||
}
|
||||
|
||||
}
|
||||
@@ -0,0 +1,8 @@
|
||||
/**
|
||||
*
|
||||
*/
|
||||
/**
|
||||
* @author TPEETZ
|
||||
*
|
||||
*/
|
||||
package com.peetz.comics.service;
|
||||
@@ -0,0 +1,195 @@
|
||||
/*
|
||||
* To change this license header, choose License Headers in Project Properties.
|
||||
* To change this template file, choose Tools | Templates
|
||||
* and open the template in the editor.
|
||||
*/
|
||||
|
||||
package com.peetz.comics.service;
|
||||
|
||||
import com.peetz.comics.entity.ArtistEntity;
|
||||
import com.peetz.comics.entity.ComicEntity;
|
||||
import com.peetz.comics.entity.IssueEntity;
|
||||
import com.peetz.comics.entity.PublisherEntity;
|
||||
import com.peetz.comics.entity.StoryArcEntity;
|
||||
import java.util.Collection;
|
||||
import javax.ejb.embeddable.EJBContainer;
|
||||
import org.junit.After;
|
||||
import org.junit.AfterClass;
|
||||
import org.junit.Before;
|
||||
import org.junit.BeforeClass;
|
||||
import org.junit.Test;
|
||||
import static org.junit.Assert.*;
|
||||
import org.junit.Ignore;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TPEETZ
|
||||
*/
|
||||
public class ComicServiceImplTest {
|
||||
|
||||
private static ComicService instance;
|
||||
private static EJBContainer container;
|
||||
|
||||
public ComicServiceImplTest() {
|
||||
}
|
||||
|
||||
@BeforeClass
|
||||
public static void setUpClass() throws Exception {
|
||||
container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
|
||||
instance = (ComicService)container.getContext().lookup("java:global/main/ComicService");
|
||||
}
|
||||
|
||||
@AfterClass
|
||||
public static void tearDownClass() {
|
||||
container.close();
|
||||
}
|
||||
|
||||
@Before
|
||||
public void setUp() {
|
||||
}
|
||||
|
||||
@After
|
||||
public void tearDown() {
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAllComics method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testGetAllComics() throws Exception {
|
||||
System.out.println("getAllComics");
|
||||
Collection<ComicEntity> expResult = null;
|
||||
Collection<ComicEntity> result = instance.getAllComics();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAllPublisher method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testGetAllPublisher() throws Exception {
|
||||
System.out.println("getAllPublisher");
|
||||
Collection<PublisherEntity> expResult = null;
|
||||
Collection<PublisherEntity> result = instance.getAllPublisher();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAllArtists method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testGetAllArtists() throws Exception {
|
||||
System.out.println("getAllArtists");
|
||||
Collection<ArtistEntity> expResult = null;
|
||||
Collection<ArtistEntity> result = instance.getAllArtists();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAllIssuesForComic method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testGetAllIssuesForComic() throws Exception {
|
||||
System.out.println("getAllIssuesForComic");
|
||||
ComicEntity comic = null;
|
||||
Collection<IssueEntity> expResult = null;
|
||||
Collection<IssueEntity> result = instance.getAllIssuesForComic(comic);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getAllStoryArcs method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testGetAllStoryArcs() throws Exception {
|
||||
System.out.println("getAllStoryArcs");
|
||||
Collection<StoryArcEntity> expResult = null;
|
||||
Collection<StoryArcEntity> result = instance.getAllStoryArcs();
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of addStoryArc method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testAddStoryArc() throws Exception {
|
||||
System.out.println("addStoryArc");
|
||||
String title = "";
|
||||
instance.addStoryArc(title);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of addPublisher method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testAddPublisher() throws Exception {
|
||||
System.out.println("addPublisher");
|
||||
String name = "";
|
||||
instance.addPublisher(name);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of addComic method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testAddComic() throws Exception {
|
||||
System.out.println("addComic");
|
||||
String title = "";
|
||||
ComicEntity expResult = null;
|
||||
ComicEntity result = instance.addComic(title);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of getPublisherById method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testGetPublisherById() throws Exception {
|
||||
System.out.println("getPublisherById");
|
||||
String nodeValue = "";
|
||||
PublisherEntity expResult = null;
|
||||
PublisherEntity result = instance.getPublisherById(nodeValue);
|
||||
assertEquals(expResult, result);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
|
||||
/**
|
||||
* Test of assignPublisher method, of class ComicServiceImpl.
|
||||
*/
|
||||
@Ignore
|
||||
@Test
|
||||
public void testAssignPublisher() throws Exception {
|
||||
System.out.println("assignPublisher");
|
||||
ComicEntity comic = null;
|
||||
PublisherEntity publisher = null;
|
||||
instance.assignPublisher(comic, publisher);
|
||||
// TODO review the generated test code and remove the default call to fail.
|
||||
fail("The test case is a prototype.");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,7 @@
|
||||
apply plugin: 'war'
|
||||
|
||||
version = '0.0.1'
|
||||
|
||||
dependencies {
|
||||
compile project(':ComicsImpl')
|
||||
}
|
||||
@@ -0,0 +1,36 @@
|
||||
package com.peetz.comics.view;
|
||||
|
||||
import com.peetz.comics.service.ComicService;
|
||||
import java.io.Serializable;
|
||||
import java.util.logging.Logger;
|
||||
import javax.ejb.EJB;
|
||||
import javax.faces.bean.ManagedBean;
|
||||
import javax.faces.bean.RequestScoped;
|
||||
|
||||
/**
|
||||
*
|
||||
* @author TPEETZ
|
||||
*/
|
||||
@ManagedBean(name="ComicView")
|
||||
@RequestScoped
|
||||
public class ComicView implements Serializable {
|
||||
|
||||
private static final Logger LOG = Logger.getLogger(ComicView.class.getName());
|
||||
|
||||
@EJB
|
||||
private ComicService comicService;
|
||||
|
||||
private static final long serialVersionUID = -8261128991042235283L;
|
||||
|
||||
public ComicView() {
|
||||
LOG.info("ComicView created");
|
||||
}
|
||||
|
||||
public Integer getComicsNumber() {
|
||||
return comicService.getAllComics().size();
|
||||
}
|
||||
|
||||
public Integer getPublisherNumber() {
|
||||
return comicService.getAllPublisher().size();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="artistEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr><td>Name:</td><td><html:text property="name" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="saveArtist" />
|
||||
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="artistEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr><td>Name:</td><td><html:text property="name" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- hidden fields for id and userId --%>
|
||||
<html:hidden property="id" />
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="saveArtist" />
|
||||
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,95 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%" cellpadding="5">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Liste der Comics</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat" valign="top">
|
||||
<p>Comic Manager</p>
|
||||
Show the comic artist list
|
||||
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<%-- set the header --%>
|
||||
<tr>
|
||||
<td>Artist name</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<%-- check if publisher exists and display message or iterate over books --%>
|
||||
<logic:empty name="artistListForm" property="artistViews">
|
||||
<tr>
|
||||
<td colspan="5">No artists available</td>
|
||||
</tr>
|
||||
</logic:empty>
|
||||
<logic:notEmpty name="artistListForm" property="artistViews">
|
||||
<logic:iterate name="artistListForm" property="artistViews" id="artist">
|
||||
<tr>
|
||||
<%-- print out the book informations --%>
|
||||
<td><bean:write name="artist" property="name" /></td>
|
||||
<%-- print out the edit and delete link for each artist --%>
|
||||
<td><html:link action="artistEdit.do?do=editArtist" paramName="artist"
|
||||
paramProperty="id" paramId="id">Edit</html:link></td>
|
||||
<td><html:link action="artistEdit.do?do=deleteArtist" paramName="artist"
|
||||
paramProperty="id" paramId="id">Delete</html:link></td>
|
||||
</tr>
|
||||
</logic:iterate>
|
||||
</logic:notEmpty>
|
||||
<%-- end interate --%>
|
||||
|
||||
<%-- if publishers cannot be found display a text --%>
|
||||
<logic:notPresent name="artist">
|
||||
<tr>
|
||||
<td colspan="5">No artists found.</td>
|
||||
</tr>
|
||||
</logic:notPresent>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<%-- add and back to menu button --%>
|
||||
<html:button property="add" onclick="location.href='../artistEdit.do?do=addArtist'">Add a new artist</html:button>
|
||||
|
||||
<html:button property="back" onclick="location.href='default.do'">Back to menu
|
||||
</html:button>
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="comicEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr><td>Title:</td><td><html:text property="title" /></td></tr>
|
||||
<tr><td>Publisher:</td><td></td></tr>
|
||||
<tr><td>Completed:</td><td><html:checkbox property="completed" /></td></tr>
|
||||
<tr><td>Current Order:</td><td><html:checkbox property="currentOrder" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="saveComic" />
|
||||
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,90 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="comicEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr><td>Title:</td><td><html:text property="title" /></td></tr>
|
||||
<tr><td>Publisher:</td><td></td></tr>
|
||||
<tr><td>Completed:</td><td><html:checkbox property="completed" /></td></tr>
|
||||
<tr><td>Current Order:</td><td><html:checkbox property="currentOrder" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- hidden fields for id and userId --%>
|
||||
<html:hidden property="id" />
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="saveComic" />
|
||||
<table border="1">
|
||||
<tr><td>Issues</td><td> </td><td> </td></tr>
|
||||
<logic:empty name="comicEditForm" property="comicIssueViews">
|
||||
<tr><td>No issues available</td></tr>
|
||||
</logic:empty>
|
||||
<logic:notEmpty name="comicEditForm" property="comicIssueViews">
|
||||
<logic:iterate name="comicEditForm" property="comicIssueViews" id="issue">
|
||||
<tr>
|
||||
<td><bean:write name="issue" property="number" /></td>
|
||||
<td><html:link action="issueEdit.do?do=editIssue" paramName="issue"
|
||||
paramProperty="id" paramId="id">Edit</html:link></td>
|
||||
<td><html:link action="issueEdit.do?do=deleteIssue" paramName="issue"
|
||||
paramProperty="id" paramId="id">Delete</html:link></td>
|
||||
</tr>
|
||||
</logic:iterate>
|
||||
</logic:notEmpty>
|
||||
|
||||
<logic:notPresent name="issue">
|
||||
<tr><td>No issues available</td></tr>
|
||||
</logic:notPresent>
|
||||
<tr><td colspan="3"><html:link action="issueEdit.do?do=addIssue" paramName="comicEditForm" paramProperty="id" paramId="comicId">Add issue</html:link></td></tr>
|
||||
</table>
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,99 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%" cellpadding="5">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Liste der Comics</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat" valign="top">
|
||||
<p>Comic Manager</p>
|
||||
Show the comic list
|
||||
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<%-- set the header --%>
|
||||
<tr>
|
||||
<td>Comic name</td>
|
||||
<td>Publisher</td>
|
||||
<td>Order</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<%-- check if book exists and display message or iterate over books --%>
|
||||
<logic:empty name="comicListForm" property="comicViews">
|
||||
<tr>
|
||||
<td colspan="5">No comics available</td>
|
||||
</tr>
|
||||
</logic:empty>
|
||||
<logic:notEmpty name="comicListForm" property="comicViews">
|
||||
<logic:iterate name="comicListForm" property="comicViews" id="comic">
|
||||
<tr>
|
||||
<%-- print out the book informations --%>
|
||||
<td><bean:write name="comic" property="title" /></td>
|
||||
<td><bean:write name="comic" property="publisher" /></td>
|
||||
<td><html:checkbox name="comic" property="currentOrder" /></td>
|
||||
<%-- print out the edit and delete link for each book --%>
|
||||
<td><html:link action="comicEdit.do?do=editComic" paramName="comic"
|
||||
paramProperty="id" paramId="id">Edit</html:link></td>
|
||||
<td><html:link action="comicEdit.do?do=deleteComic" paramName="comic"
|
||||
paramProperty="id" paramId="id">Delete</html:link></td>
|
||||
</tr>
|
||||
</logic:iterate>
|
||||
</logic:notEmpty>
|
||||
<%-- end interate --%>
|
||||
|
||||
<%-- if books cannot be found display a text --%>
|
||||
<logic:notPresent name="comic">
|
||||
<tr>
|
||||
<td colspan="5">No comicss found.</td>
|
||||
</tr>
|
||||
</logic:notPresent>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<%-- add and back to menu button --%>
|
||||
<html:button property="add" onclick="location.href='../comicEdit.do?do=addComic'">Add a new comic</html:button>
|
||||
|
||||
<html:button property="back" onclick="location.href='default.do'">Back to menu
|
||||
</html:button>
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,51 @@
|
||||
<?xml version='1.0' encoding='UTF-8' ?>
|
||||
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
|
||||
<html xmlns="http://www.w3.org/1999/xhtml"
|
||||
xmlns:ui="http://java.sun.com/jsf/facelets"
|
||||
xmlns:h="http://java.sun.com/jsf/html">
|
||||
|
||||
<h:head>
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8" />
|
||||
<link href="css/stylesheet.css" rel="stylesheet" type="text/css" />
|
||||
|
||||
<title>Comics Application</title>
|
||||
</h:head>
|
||||
|
||||
<body bgcolor="white">
|
||||
<table border="0" width="100%" height="100%" cellpadding="5">
|
||||
<colgroup>
|
||||
<col width="10%"/>
|
||||
<col width="80%"/>
|
||||
<col width="10%"/>
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Kontor Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<a href="/kontor/faces/index.xhtml">Kontor</a><br/>
|
||||
<a href="/kontor/faces/comics.xhtml">Comics</a><br/>
|
||||
<a href="/kontor/faces/library.xhtml">Library</a><br/>
|
||||
<a href="/kontor/faces/medien.xhtml">Medien</a><br/>
|
||||
<a href="/kontor/faces/tradingcards.xhtml">TradingCards</a>
|
||||
</td>
|
||||
<td bgcolor="wheat" valign="top">
|
||||
<p>Kontor Manager</p>
|
||||
<h:form><h:outputText escape="false" value="Anzahl Comics #{ComicsNumberBean.getNumberOfComics}"/>
|
||||
</h:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,35 @@
|
||||
<html>
|
||||
<head><title>Comic Application</title></head>
|
||||
|
||||
|
||||
<body bgcolor="white">
|
||||
<table border="0" width="100%" height="100%" cellpadding="5">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Comic Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">test</td>
|
||||
<td bgcolor="wheat" valign="top">
|
||||
<p>Comic Manager</p>
|
||||
<a href="index.jsp">Show the comic list</a>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html>
|
||||
@@ -0,0 +1,67 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat" valign="top">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="issueEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<thead><tr><td colspan="3">Comic: <bean:write name="issueEditForm" property="comicTitle"></bean:write></td></tr></thead>
|
||||
<tbody>
|
||||
<tr><td>Number:</td><td><html:text property="number" /></td></tr>
|
||||
<tr><td>Author:</td><td></td></tr>
|
||||
<tr><td>Read:</td><td><html:checkbox property="read" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="saveIssue" />
|
||||
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="issueEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr><td>Number:</td><td><html:text property="number" /></td></tr>
|
||||
<tr><td>Author:</td><td></td></tr>
|
||||
<tr><td>Read:</td><td><html:checkbox property="read" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="saveIssue" />
|
||||
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,64 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="publisherEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr><td>Name:</td><td><html:text property="publisherName" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="savePublisher" />
|
||||
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,66 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Library Manager</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat">
|
||||
<%-- create a html form --%>
|
||||
<html:form action="publisherEdit">
|
||||
<%-- print out the form data --%>
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<tr><td>Name:</td><td><html:text property="publisherName" /></td></tr>
|
||||
</tbody>
|
||||
</table>
|
||||
<%-- hidden fields for id and userId --%>
|
||||
<html:hidden property="id" />
|
||||
<%-- set the parameter for the dispatch action --%>
|
||||
<html:hidden property="do" value="savePublisher" />
|
||||
|
||||
<br>
|
||||
<%-- submit and back button --%>
|
||||
<html:button property="back"
|
||||
onclick="history.back();">
|
||||
Back
|
||||
</html:button>
|
||||
|
||||
<html:submit>Save</html:submit>
|
||||
</html:form>
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,95 @@
|
||||
<%@ page language="java"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-bean" prefix="bean"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-html" prefix="html"%>
|
||||
<%@ taglib uri="http://jakarta.apache.org/struts/tags-logic" prefix="logic" %>
|
||||
|
||||
<html:html locale="true">
|
||||
<head>
|
||||
<html:base />
|
||||
|
||||
<meta http-equiv="Content-Type" content="text/html; charset=ISO-8859-1">
|
||||
|
||||
<title>Comic Application</title>
|
||||
</head>
|
||||
<body>
|
||||
<table border="0" width="100%" height="100%" cellpadding="5">
|
||||
<colgroup>
|
||||
<col width="10%">
|
||||
<col width="80%">
|
||||
<col width="10%">
|
||||
</colgroup>
|
||||
<!-- Kopfbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="center" colspan="3"><b>Liste der Comics</b></td>
|
||||
</tr>
|
||||
<!-- Hauptbereich -->
|
||||
<tr>
|
||||
<!-- Linker Navigationsbereich -->
|
||||
<td bgcolor="tan" valign="top" with="100">
|
||||
<% out.println(com.peetz.comics.navigation.MenuLinks.getInstance().toString()); %>
|
||||
</td>
|
||||
<td bgcolor="wheat" valign="top">
|
||||
<p>Comic Manager</p>
|
||||
Show the comic list
|
||||
|
||||
<table border="1">
|
||||
<tbody>
|
||||
<%-- set the header --%>
|
||||
<tr>
|
||||
<td>Publisher name</td>
|
||||
<td> </td>
|
||||
<td> </td>
|
||||
</tr>
|
||||
<%-- check if publisher exists and display message or iterate over books --%>
|
||||
<logic:empty name="publisherListForm" property="publisherViews">
|
||||
<tr>
|
||||
<td colspan="5">No publishers available</td>
|
||||
</tr>
|
||||
</logic:empty>
|
||||
<logic:notEmpty name="publisherListForm" property="publisherViews">
|
||||
<logic:iterate name="publisherListForm" property="publisherViews" id="publisher">
|
||||
<tr>
|
||||
<%-- print out the book informations --%>
|
||||
<td><bean:write name="publisher" property="name" /></td>
|
||||
<%-- print out the edit and delete link for each book --%>
|
||||
<td><html:link action="publisherEdit.do?do=editPublisher" paramName="publisher"
|
||||
paramProperty="id" paramId="id">Edit</html:link></td>
|
||||
<td><html:link action="publisherEdit.do?do=deletePublisher" paramName="publisher"
|
||||
paramProperty="id" paramId="id">Delete</html:link></td>
|
||||
</tr>
|
||||
</logic:iterate>
|
||||
</logic:notEmpty>
|
||||
<%-- end interate --%>
|
||||
|
||||
<%-- if publishers cannot be found display a text --%>
|
||||
<logic:notPresent name="publisher">
|
||||
<tr>
|
||||
<td colspan="5">No publishers found.</td>
|
||||
</tr>
|
||||
</logic:notPresent>
|
||||
|
||||
</tbody>
|
||||
</table>
|
||||
<br>
|
||||
<%-- add and back to menu button --%>
|
||||
<html:button property="add" onclick="location.href='../publisherEdit.do?do=addPublisher'">Add a new publisher</html:button>
|
||||
|
||||
<html:button property="back" onclick="location.href='default.do'">Back to menu
|
||||
</html:button>
|
||||
|
||||
|
||||
|
||||
|
||||
</td>
|
||||
<!-- Rechter Navigationsbereich -->
|
||||
<td bgcolor="tan" with="15%"> </td>
|
||||
</tr>
|
||||
<!-- Fussbereich -->
|
||||
<tr bgcolor="lightgrey" height="10%">
|
||||
<td align="right" colspan="3">
|
||||
<p>Ingenieurbüro Thomas Peetz</p>
|
||||
</td>
|
||||
</tr>
|
||||
</table>
|
||||
</body>
|
||||
</html:html>
|
||||
@@ -0,0 +1,391 @@
|
||||
Title
|
||||
(T)Raumschiff Surprise - Periode 1
|
||||
7 Zwerge - Männer allein im Wald
|
||||
A Beatiful Mind
|
||||
About Schmidt
|
||||
Akte X: Der Film
|
||||
Aladdin
|
||||
"Alias - Die Agentin
|
||||
|
||||
Vol. 1"
|
||||
"Alias - Die Agentin
|
||||
|
||||
Vol. 2"
|
||||
"Alias - Die Agentin
|
||||
|
||||
Vol. 3"
|
||||
Alles tanzt nach meiner Pfeife
|
||||
American Beauty
|
||||
American History X
|
||||
American Pie
|
||||
American Pie 2
|
||||
American Pie Jetzt wird geheiratet
|
||||
American Psycho
|
||||
An jedem verdammten Sonntag
|
||||
Angeklagt
|
||||
Antz
|
||||
Apollo 13
|
||||
Arac Attack
|
||||
Arachnophobia
|
||||
Arlington Road
|
||||
Asso
|
||||
Atlantis Das Geheimnis der verlorenen Stadt
|
||||
Austin Powers
|
||||
Austin Powers Goldständer
|
||||
Austin Powers Spion in geheimer Missionarsstellung
|
||||
"Avanti, Avanti"
|
||||
Backdraft
|
||||
Bad Taste
|
||||
Bang Boom Bang
|
||||
Bärenbrüder
|
||||
Being John Malkovich
|
||||
"Berlin, Berlin - Staffel 1"
|
||||
"Berlin, Berlin - Staffel 2"
|
||||
"Berlin, Berlin - Staffel 3"
|
||||
"Berlin, Berlin - Staffel 4"
|
||||
Bernard & Bianca
|
||||
Beverly Hills Cop
|
||||
Beverly Hills Cop II
|
||||
Beverly Hills Cop III
|
||||
Black Hawk Down
|
||||
Blow
|
||||
Blues Brothers
|
||||
Blues Brothers 2000
|
||||
Bowfingers grosse Nummer
|
||||
Braveheart
|
||||
Brust oder Keule
|
||||
Caddyshack
|
||||
Chasing Amy
|
||||
Cheech & Chong's The Corsican Brothers
|
||||
Cheech & Chong im Dauerstress
|
||||
Cheech & Chong Jetzt raucht überhaupt nichts mehr
|
||||
Cheech & Chong Viel Rauch um Nichts
|
||||
Cheech & Chongs Heisse Träume
|
||||
Cocktail für eine Leiche
|
||||
ConAir
|
||||
Daredevil
|
||||
Dark City
|
||||
Das Appartment
|
||||
Das Fenster zum Hof
|
||||
Das fünfte Element
|
||||
Das grosse Krabbeln
|
||||
Das Jesus Video
|
||||
Das kleine Arschloch
|
||||
Das Krokodil und sein Nilpferd
|
||||
Das Netz
|
||||
Das Schweigen der Lämmer
|
||||
Das Wunder von Bern
|
||||
Der Boss
|
||||
Der Club der toten Dichter
|
||||
Der dritte Mann
|
||||
Der Glückspilz
|
||||
Der Hauch des Todes
|
||||
Der kleine Horrorladen
|
||||
Der Knochenjäger
|
||||
Der Mann mit dem goldenen Colt
|
||||
"Der Mann, der zuviel wußte"
|
||||
Der Millionenfinger
|
||||
Der Mondmann
|
||||
Der Morgen stirbt nie
|
||||
Der Name der Rose
|
||||
Der Pate 1-3
|
||||
Der Puppenspieler
|
||||
Der Querkopf
|
||||
Der Schatzplanet
|
||||
"Der Spion, der mich liebte"
|
||||
Der talentierte Mr. Ripley
|
||||
Der Totmacher
|
||||
Der Wixxer
|
||||
Diamantenfieber
|
||||
"Dick und Doof erben eine Insel, Atoll K"
|
||||
Didi - der Doppelgänger
|
||||
Didi - Der Experte
|
||||
Didi - Der Schnüffler
|
||||
Didi - und die Rache der Enterbten
|
||||
Didi auf vollen Touren
|
||||
Die Ärzte Unplugged Rock'n' Roll Realschule
|
||||
Die Einsteiger
|
||||
"Die Geister, die ich rief"
|
||||
Die Glücksjäger
|
||||
Die Glücksritter
|
||||
Die große Schlacht des Don Camillo
|
||||
Die Harald Schmidt Show - Best Of Vol. 2
|
||||
Die Harald Schmidt Show - Best of
|
||||
Die Jury
|
||||
Die Liga der aussergewöhnlichen Gentlemen
|
||||
Die Monster AG
|
||||
Die Muppets erobern Manhattan
|
||||
Die Muppets Weihnachtsgeschichte
|
||||
Die nackte Kanone
|
||||
Die nackte Kanone 2 1/2
|
||||
Die nackte Kanone 33 1/3
|
||||
Die neun Pforten
|
||||
Die rechte und die linke Hand des Teufels
|
||||
Die Truman Show
|
||||
Die unglaubliche Reise in einem verrückten Flugzeug
|
||||
Die unglaubliche Reise in einem verrückten Raumschiff
|
||||
Die Unglaublichen
|
||||
Die Verurteilten
|
||||
Die Welt ist nicht genug
|
||||
Die Wiege der Sonne
|
||||
Diese Zwei sind nicht zu fassen
|
||||
Dogma
|
||||
Don Camillo und Peppone
|
||||
Don Camillos Rückkehr
|
||||
Dr. Dolittle 1+2
|
||||
Dragonheart
|
||||
Drei Amigos
|
||||
Ein Fisch namens Wanda
|
||||
Ein Fisch namens Wanda
|
||||
Ein irrer Typ
|
||||
Ein Ticket für Zwei
|
||||
Eine Leiche zum Dessert
|
||||
"Eine schrecklich nette Familie
|
||||
|
||||
Dritte Staffel"
|
||||
"Eine schrecklich nette Familie
|
||||
|
||||
Erste Staffel"
|
||||
"Eins, Zwei, Drei"
|
||||
Eiskalte Engel
|
||||
El Dorado
|
||||
Elektra
|
||||
Es war einmal in Amerika
|
||||
Evolution
|
||||
Ey Mann - Wo is' mein Auto?
|
||||
Faceoff - Im Körper des Feindes
|
||||
Fahrenheit 9/11
|
||||
Falsches Spiel mit Roger Rabbit
|
||||
Feuerball
|
||||
Findet Nemo
|
||||
Flammendes Inferno
|
||||
Fletcher's Visionen
|
||||
Fluch der Karibik
|
||||
Forrest Gump
|
||||
Four Rooms
|
||||
Foxy Brown
|
||||
Freddy vs. Jason
|
||||
Freeze - Alptraum Nachtwache
|
||||
Frenzy
|
||||
Frequency
|
||||
Fröhliche Ostern
|
||||
From Dusk Till Dawn
|
||||
From Dusk Till Dawn 2
|
||||
"From Dusk Till Dawn 3
|
||||
|
||||
The Hangman's Daughter"
|
||||
From Hell
|
||||
Galaxy Quest
|
||||
Gangs of New York
|
||||
Gegen jede Regel
|
||||
Geld oder Leber
|
||||
Genosse Don Camillo
|
||||
Ghost Ship
|
||||
Ghostbusters 2
|
||||
Girls United
|
||||
Glauben ist Alles!
|
||||
God's Army
|
||||
God's Army 3
|
||||
GoldenEye
|
||||
Goldfinger
|
||||
Good Bye Lenin!
|
||||
Good Morning Vietnam
|
||||
Good Will Hunting
|
||||
Gottes Werk und Teufels Beitrag
|
||||
Grosse Erwartungen
|
||||
Hannibal
|
||||
Harald Schmidt Best of Vol. 1+2 + Golden Goals
|
||||
Helden aus der zweiten Reihe
|
||||
Hercules
|
||||
Hero
|
||||
Hochwürden Don Camillo
|
||||
Höllentour - Die Tour der Helden
|
||||
Hot Shots 1 + 2
|
||||
Hulk
|
||||
"I, Robot"
|
||||
Ice Age
|
||||
Im Angesicht des Todes
|
||||
Im Geheimdienst Ihrer Majestät
|
||||
Immer Ärger mit Bernie
|
||||
In 80 Tagen um die Welt Teil 1
|
||||
In 80 Tagen um die Welt Teil 2
|
||||
In tödlicher Mission
|
||||
Independence Day
|
||||
Irma La Douce
|
||||
Jabberwocky
|
||||
Jackie Brown
|
||||
Jagd auf einen Unsichtbaren
|
||||
Jagd auf Roter Oktober
|
||||
James Bond jagt Dr. No
|
||||
JFK John F. Kennedy - Tatort Dallas
|
||||
Johnny English
|
||||
Jumanji
|
||||
Kentucky Fried Movie
|
||||
Kill Bill Vol. 1
|
||||
Kill Bill Vol. 2
|
||||
"Knight Moves
|
||||
|
||||
Ein mörderisches Spiel"
|
||||
König der Fischer
|
||||
La Boum
|
||||
La Boum 2
|
||||
Leben und Sterben lassen
|
||||
Liebesgrüße aus Moskau
|
||||
Lizenz zum Töten
|
||||
Lola rennt
|
||||
Lost in Space
|
||||
Lost In Translation
|
||||
Louis und seine außerirdischen Kohlköpfe
|
||||
Luther
|
||||
Mallrats
|
||||
Man lebt nur zweimal
|
||||
Marillion Christmas in the Chapel
|
||||
Marillion Live From Loreley
|
||||
Marillion shot in the dark
|
||||
Marnie
|
||||
Master & Commander
|
||||
Maverick
|
||||
"MexiCollection
|
||||
|
||||
El Mariachi
|
||||
|
||||
Desperado
|
||||
|
||||
Irgendwann in Mexico"
|
||||
MIB
|
||||
MIB 2
|
||||
Missing
|
||||
"Montys enzyklopythonia (Das Leben des Brian, Die Ritter der Kokosnuss, Der Sinn des Lebens)"
|
||||
Moonraker - Streng Geheim
|
||||
Mörderischer Vorsprung
|
||||
Mr. Bean 1
|
||||
Mr. Bean 2
|
||||
Mr. Bean 3
|
||||
Muppets aus dem All
|
||||
Muppets Die Schatzinsel
|
||||
Mystic River
|
||||
Nick Knatterton Teil 1
|
||||
Nick Knatterton Teil 2
|
||||
Nightmare Before Christmas
|
||||
Nightwish - end of innocence
|
||||
Nur 48 Stunden
|
||||
"O Brother, Where Art Thou?"
|
||||
Ocean's Eleven
|
||||
Ocean's Twelve
|
||||
Octopussy
|
||||
"Onkel Paul, die große Pflaume"
|
||||
Open Range
|
||||
Oscar
|
||||
Panic Room
|
||||
Perdita Durango
|
||||
Peter Gabriel Growing Up Live
|
||||
Peter Gabriel Secret World Live
|
||||
Platoon
|
||||
Pulp Fiction
|
||||
Rat Race Der nackte Wahnsinn
|
||||
Reservoir Dogs
|
||||
Resident Evil
|
||||
Richy Guitar
|
||||
Romeo Must Die
|
||||
Roter Drache
|
||||
Sag niemals nie
|
||||
Scary Movie
|
||||
Scary Movie 2
|
||||
Scharfe Kurven für Madame
|
||||
Schiffsmeldungen
|
||||
Schlappe Bullen beissen nicht
|
||||
Scooby-Doo
|
||||
Scream
|
||||
Scream 2
|
||||
Scrubs: Die Anfänger - Die komplette erste Staffel (4 DVDs)
|
||||
Scrubs: Die Anfänger - Die komplette zweite Staffel (4 DVDs)
|
||||
Scrubs: Die Anfänger - Die komplette dritte Staffel (4 DVDs)
|
||||
Shaft
|
||||
Shakespeare in Love
|
||||
Shang-High Noon
|
||||
Shrek
|
||||
Shrek 2
|
||||
Sideways
|
||||
Sin City
|
||||
Sin Eater
|
||||
Sleepers
|
||||
Sleepy Hollow
|
||||
Small Soldiers
|
||||
snatch Schweine und Diamanten
|
||||
Solo für Zwei
|
||||
Sonnenallee
|
||||
South Park Der Film
|
||||
Space Cowboys
|
||||
Spaceballs
|
||||
Speed Teil 1 + Teil 2
|
||||
Sphere
|
||||
Spider-Man 2
|
||||
Spiel mir das Lied vom Tod
|
||||
Stakeout II
|
||||
Star Trek 1
|
||||
Star Trek 10 Nemesis
|
||||
Star Trek 2 Der Zorn des Khan
|
||||
Star Trek 3 Auf der Such nach Mr. Spock
|
||||
Star Trek 4 Zurück in die Gegenwart
|
||||
Star Trek 5 Am Rande des Universums
|
||||
Star Trek 6 Das unentdeckte Land
|
||||
Star Trek 7 Treffen der Generationen
|
||||
Star Trek 8 Der erste Kontakt
|
||||
Star Trek 9 Der Aufstand
|
||||
Star Wars - Bonusmaterial
|
||||
Star Wars - Clone Wars Vol. 1
|
||||
Star Wars - Clone Wars Vol. 2
|
||||
Star Wars - Episode 2
|
||||
Star Wars - Episode 3 - Die Rache der Sith
|
||||
Star Wars - Episode IV - Eine neue Hoffnung
|
||||
Star Wars - Episode V - Das Imperium schlägt zurück
|
||||
Star Wars - Episode VI - Die Rückkehr der Jedi-Ritter
|
||||
Stigmata
|
||||
Stirb an einem anderen Tag
|
||||
Stirb langsam 1+2
|
||||
Sumo Bruno
|
||||
Tanz der Teufel
|
||||
Tanz der Vampire
|
||||
Terminator 2 Tag der Abrechnung
|
||||
Terminator 3 Rebellion der Maschinen
|
||||
The Abyss
|
||||
The Art of War
|
||||
The Big Lebowski
|
||||
The Core
|
||||
The Crow
|
||||
The Day After Tomorrow
|
||||
The Fog Nebel des Grauens
|
||||
The Game
|
||||
The Green Mile
|
||||
The Rock
|
||||
The Scorpion King
|
||||
The Time Machine
|
||||
Three Kings
|
||||
Tiger & Dragon
|
||||
Tomb Raider
|
||||
Tomb Raider Die Wiege des Lebens
|
||||
Topas
|
||||
Toy Story
|
||||
Toy Story 2
|
||||
Traffic Macht des Kartells
|
||||
Troja
|
||||
Tron
|
||||
Twister
|
||||
U-Turn
|
||||
UHF
|
||||
Und dann kam Polly
|
||||
under suspicion Mörderisches Spiel
|
||||
Underworld
|
||||
Van Helsing
|
||||
Verlockende Falle
|
||||
Verrückt nach Mary
|
||||
Verrückt nach mehr Mary
|
||||
Vertigo
|
||||
Vier Fäuste für ein Halleluja
|
||||
Vier Fäuste gegen Rio
|
||||
Volcano
|
||||
Volker Pispers Live
|
||||
Wayne's World
|
||||
Wayne's World 2
|
||||
Wilde Kreaturen
|
||||
X-Men
|
||||
|
Vendored
+15
@@ -0,0 +1,15 @@
|
||||
node {
|
||||
stage "Checkout"
|
||||
checkout scm
|
||||
stage 'Prepare Gradle build'
|
||||
sh "chmod +x gradlew"
|
||||
stage 'Stage Build'
|
||||
sh "./gradlew --no-daemon clean build -x findbugsMain -x findbugsTest -x test"
|
||||
stage 'Archive Artifacts'
|
||||
archiveArtifacts allowEmptyArchive: true, artifacts: '**/build/reports/*/*.xml', defaultExcludes: false, onlyIfSuccessful: true
|
||||
archiveArtifacts allowEmptyArchive: true, artifacts: '**/reports/*/*.html'
|
||||
junit allowEmptyResults: true, testResults: '**/build/test-results/*.xml'
|
||||
//step([$class: 'CheckStylePublisher', pattern: '**/build/reports/checkstyle/*.xml'])
|
||||
//step([$class: 'FindBugsPublisher', pattern: '**/build/reports/findbugs/*.xml'])
|
||||
}
|
||||
|
||||
@@ -0,0 +1,19 @@
|
||||
apply plugin: 'java'
|
||||
apply plugin: 'application'
|
||||
|
||||
dependencies {
|
||||
compile 'org.hibernate:hibernate-core:4.3.8.Final'
|
||||
compile 'org.hibernate:hibernate-entitymanager:4.3.8.Final'
|
||||
compile 'org.hsqldb:hsqldb:2.3.0'
|
||||
compile 'ch.qos.logback:logback-core:1.1.2'
|
||||
compile 'ch.qos.logback:logback-classic:1.1.2'
|
||||
testCompile group: 'junit', name: 'junit', version: '4.11'
|
||||
}
|
||||
|
||||
mainClassName = 'com.ibtp.kontor.KontorApp'
|
||||
|
||||
jar {
|
||||
manifest {
|
||||
attributes 'Implementation-Title': 'Kontor Application', 'Implementation-Version': version, 'Main-Class': mainClassName
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,69 @@
|
||||
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();
|
||||
}
|
||||
});
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,67 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,55 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,57 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,72 @@
|
||||
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() + "]";
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,81 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,75 @@
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,47 @@
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,48 @@
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,40 @@
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,21 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,11 @@
|
||||
package com.ibtp.kontor.dal;
|
||||
|
||||
import javax.persistence.EntityManager;
|
||||
|
||||
/**
|
||||
* Created by TPEETZ on 21.01.2015.
|
||||
*/
|
||||
public interface Database {
|
||||
|
||||
public EntityManager getEntityManager();
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,103 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,23 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,25 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,65 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,56 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,62 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,96 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,41 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,27 @@
|
||||
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; }
|
||||
}
|
||||
@@ -0,0 +1,13 @@
|
||||
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");
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,51 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,29 @@
|
||||
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);
|
||||
}
|
||||
+65
@@ -0,0 +1,65 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,24 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,43 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
package com.ibtp.kontor.tradingcards.dal;
|
||||
|
||||
import com.ibtp.kontor.dal.BaseImpl;
|
||||
import com.ibtp.kontor.tradingcards.entity.PositionEntity;
|
||||
|
||||
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 PositionImpl extends BaseImpl implements PositionDao {
|
||||
|
||||
@Override
|
||||
public PositionEntity getById(Long id) {
|
||||
Query q = getEntityManager().createNamedQuery("Position.findById");
|
||||
q.setParameter("id", id);
|
||||
return (PositionEntity)q.getSingleResult();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PositionEntity> findByIds(List<Long> ids) {
|
||||
return null;
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PositionEntity> findByName(String name) {
|
||||
Query q = getEntityManager().createNamedQuery("Position.findByName");
|
||||
q.setParameter("name", name);
|
||||
return q.getResultList();
|
||||
}
|
||||
|
||||
@Override
|
||||
public Collection<PositionEntity> findAll() {
|
||||
Query q = getEntityManager().createNamedQuery("Position.findAll");
|
||||
return q.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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,22 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,38 @@
|
||||
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) {
|
||||
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,64 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,26 @@
|
||||
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);
|
||||
}
|
||||
@@ -0,0 +1,66 @@
|
||||
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();
|
||||
}
|
||||
}
|
||||
+67
@@ -0,0 +1,67 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,74 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
+78
@@ -0,0 +1,78 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
+53
@@ -0,0 +1,53 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,46 @@
|
||||
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;
|
||||
}
|
||||
}
|
||||
Some files were not shown because too many files have changed in this diff Show More
Reference in New Issue
Block a user