remove obsolete kontor.py

This commit is contained in:
2025-04-30 17:31:18 +02:00
parent 304005822c
commit 931b4a0aba
1043 changed files with 61259 additions and 0 deletions
+5
View File
@@ -0,0 +1,5 @@
jar {
manifest {
attributes 'Implementation-Title': 'TradingCards', '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,31 @@
/*
* 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.tradingcards.dal;
import com.peetz.tradingcards.entity.BaseSetEntity;
import com.peetz.tradingcards.entity.ManufacturerEntity;
import java.util.List;
import javax.ejb.Local;
/**
*
* @author tpeetz
*/
@Local
public interface ManufacturerDao {
public ManufacturerEntity getById(Long id);
public List<ManufacturerEntity> findByIds(List<Long> ids);
public List<ManufacturerEntity> findByName(String name);
public ManufacturerEntity assignBaseSet(ManufacturerEntity comic, BaseSetEntity baseSet);
public ManufacturerEntity store(ManufacturerEntity entity);
public void delete(ManufacturerEntity entity);
}
@@ -0,0 +1,67 @@
/*
* 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.tradingcards.dal;
import com.peetz.tradingcards.entity.BaseSetEntity;
import com.peetz.tradingcards.entity.ManufacturerEntity;
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;
/**
*
* @author tpeetz
*/
@Stateless(name = "ManufacturerDao")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class ManufacturerImpl implements ManufacturerDao {
@PersistenceContext(unitName = "kontor")
private EntityManager em;
@Override
public ManufacturerEntity getById(Long id) {
Query q = em.createNamedQuery("Manufacturer.findById");
q.setParameter("id", id);
ManufacturerEntity entity = (ManufacturerEntity)q.getSingleResult();
return entity;
}
@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 = em.createNamedQuery("Manufacturer.findByName");
q.setParameter("name", name);
List<ManufacturerEntity> resultList = q.getResultList();
return resultList;
}
@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 store(ManufacturerEntity entity) {
em.persist(entity);
return entity;
}
@Override
public void delete(ManufacturerEntity entity) {
em.remove(entity);
}
}
@@ -0,0 +1,28 @@
/*
* 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.tradingcards.dal;
import com.peetz.tradingcards.entity.SportEntity;
import java.util.List;
import javax.ejb.Local;
/**
*
* @author tpeetz
*/
@Local
public interface SportDao {
public SportEntity getById(Long id);
public List<SportEntity> findByIds(List<Long> ids);
public List<SportEntity> findByName(String name);
public SportEntity store(SportEntity entity);
public void delete(SportEntity entity);
}
@@ -0,0 +1,58 @@
/*
* 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.tradingcards.dal;
import com.peetz.tradingcards.entity.SportEntity;
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;
/**
*
* @author tpeetz
*/
@Stateless(name = "SportDao")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class SportImpl implements SportDao {
@PersistenceContext(unitName = "kontor")
private EntityManager em;
@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 = em.createNamedQuery("Sport.findByName");
query.setParameter("name", name);
List<SportEntity> resultList = query.getResultList();
return resultList;
}
@Override
public SportEntity store(SportEntity entity) {
em.persist(entity);
return entity;
}
@Override
public void delete(SportEntity entity) {
em.remove(entity);
}
}
@@ -0,0 +1,67 @@
package com.peetz.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.peetz.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;
}
}
@@ -0,0 +1,74 @@
package com.peetz.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>();
@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;
}
@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;
}
}
@@ -0,0 +1,53 @@
package com.peetz.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.peetz.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;
}
}
@@ -0,0 +1,53 @@
package com.peetz.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="POSITION")
public class PositionEntity {
private Long id;
private String name;
private String shortName;
private SportEntity sport;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@Column
public String getName() {
return name;
}
public void setName(String name) {
this.name = name;
}
@Column
public String getShortName() {
return shortName;
}
public void setShortName(String shortName) {
this.shortName = shortName;
}
@ManyToOne
public SportEntity getSport() {
return sport;
}
public void setSport(SportEntity sport) {
this.sport = sport;
}
}
@@ -0,0 +1,68 @@
package com.peetz.tradingcards.entity;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="SportCard.findAll", query="SELECT s from SportCardEntity as s")
})
@Entity
@Table(name = "SPORTCARD")
public class SportCardEntity {
private Long id;
private PlayerEntity player;
private BaseSetEntity baseSet;
private ParallelSetEntity parallelSet;
private InsertEntity insert;
@Id
@GeneratedValue(strategy=GenerationType.AUTO)
public Long getId() { return id; }
@SuppressWarnings("unused")
private void setId(Long id) { this.id = id; }
@ManyToOne
public PlayerEntity getPlayer() {
return player;
}
public void setPlayer(PlayerEntity player) {
this.player = player;
}
@ManyToOne
public BaseSetEntity getBaseSet() {
return baseSet;
}
public void setBaseSet(BaseSetEntity baseSet) {
this.baseSet = baseSet;
}
@ManyToOne
public ParallelSetEntity getParallelSet() {
return parallelSet;
}
public void setParallelSet(ParallelSetEntity parallelSet) {
this.parallelSet = parallelSet;
}
@ManyToOne
public InsertEntity getInsert() {
return insert;
}
public void setInsert(InsertEntity insert) {
this.insert = insert;
}
}
@@ -0,0 +1,64 @@
package com.peetz.tradingcards.entity;
import java.util.ArrayList;
import java.util.Collection;
import javax.persistence.CascadeType;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.OneToMany;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="Sport.findAll", query="SELECT s from SportEntity as s"),
@NamedQuery(name="Sport.findByName", query="SELECT s from SportEntity as s WHERE s.name = :name")
})
@Entity
@Table(name="SPORT")
public class SportEntity {
private Long id;
private String name;
private Collection<TeamEntity> teams = new ArrayList<TeamEntity>();
private Collection<PositionEntity> positions = new ArrayList<PositionEntity>();
@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;
}
@OneToMany(mappedBy="sport", cascade=CascadeType.REMOVE)
public Collection<TeamEntity> getTeams() {
return teams;
}
public void setTeams(Collection<TeamEntity> teams) {
this.teams = teams;
}
@OneToMany(mappedBy="sport", cascade=CascadeType.REMOVE)
public Collection<PositionEntity> getPositions() {
return positions;
}
public void setPositions(Collection<PositionEntity> positions) {
this.positions = positions;
}
}
@@ -0,0 +1,42 @@
package com.peetz.tradingcards.entity;
import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.GeneratedValue;
import javax.persistence.GenerationType;
import javax.persistence.Id;
import javax.persistence.ManyToOne;
import javax.persistence.NamedQueries;
import javax.persistence.NamedQuery;
import javax.persistence.Table;
@NamedQueries({
@NamedQuery(name="Team.findAll", query="SELECT t from TeamEntity as t"),
@NamedQuery(name="Team.findByName", query="SELECT t from TeamEntity as t WHERE t.name = :name")
})
@Entity
@Table(name="TEAM")
public class TeamEntity {
private Long id;
private String name;
private SportEntity sport;
@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 SportEntity getSport() { return sport; }
public void setSport(SportEntity sport) { this.sport = sport; }
}
@@ -0,0 +1,24 @@
package com.peetz.tradingcards.service;
import java.util.Collection;
import javax.ejb.Local;
import com.peetz.tradingcards.entity.PositionEntity;
import com.peetz.tradingcards.entity.SportEntity;
import com.peetz.tradingcards.entity.TeamEntity;
@Local
public interface SportService {
Collection<SportEntity> getAllSports();
Collection<TeamEntity> getAllTeams();
void addSport(String name);
Collection<TeamEntity> getTeams(SportEntity sport);
Collection<PositionEntity> getPositions(SportEntity sport);
}
@@ -0,0 +1,63 @@
package com.peetz.tradingcards.service;
import com.peetz.tradingcards.dal.SportDao;
import java.util.Collection;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import com.peetz.tradingcards.entity.PositionEntity;
import com.peetz.tradingcards.entity.SportEntity;
import com.peetz.tradingcards.entity.TeamEntity;
import java.util.ArrayList;
import javax.ejb.EJB;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@Stateless(name="SportService")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class SportServiceImpl implements SportService {
@PersistenceContext(unitName = "kontor")
private EntityManager em;
@EJB
SportDao sportDao;
@SuppressWarnings("unchecked")
@Override
public Collection<SportEntity> getAllSports() {
Query query = em.createNamedQuery("Sport.findAll");
ArrayList<SportEntity> sportList = new ArrayList<SportEntity>(query.getResultList());
return sportList;
}
@SuppressWarnings("unchecked")
@Override
public Collection<TeamEntity> getAllTeams() {
Query query = em.createNamedQuery("Team.findAll");
ArrayList<TeamEntity> teamList = new ArrayList<TeamEntity>(query.getResultList());
return teamList;
}
@Override
public void addSport(String name) {
SportEntity entity = new SportEntity();
entity.setName(name);
sportDao.store(entity);
}
@Override
public Collection<TeamEntity> getTeams(SportEntity sport) {
return null;
}
@Override
public Collection<PositionEntity> getPositions(SportEntity sport) {
// TODO Auto-generated method stub
return null;
}
}
@@ -0,0 +1,28 @@
package com.peetz.tradingcards.service;
import java.util.Collection;
import javax.ejb.Local;
import com.peetz.tradingcards.entity.BaseSetEntity;
import com.peetz.tradingcards.entity.InsertEntity;
import com.peetz.tradingcards.entity.ManufacturerEntity;
import com.peetz.tradingcards.entity.ParallelSetEntity;
import com.peetz.tradingcards.entity.SportCardEntity;
@Local
public interface TradingcardService {
Collection<ManufacturerEntity> getAllManufacturers();
void addManufacturer(String name);
Collection<SportCardEntity> getAllSportCards();
Collection<BaseSetEntity> getBaseSetsByManufacturer(ManufacturerEntity manufacturer);
Collection<ParallelSetEntity> getParallelSetsByManufacturer(ManufacturerEntity manufacturer);
Collection<InsertEntity> getInsertsByManufacturer(ManufacturerEntity manufacturer);
}
@@ -0,0 +1,75 @@
package com.peetz.tradingcards.service;
import com.peetz.tradingcards.dal.ManufacturerDao;
import java.util.Collection;
import javax.ejb.Stateless;
import javax.ejb.TransactionAttribute;
import javax.ejb.TransactionAttributeType;
import com.peetz.tradingcards.entity.BaseSetEntity;
import com.peetz.tradingcards.entity.InsertEntity;
import com.peetz.tradingcards.entity.ManufacturerEntity;
import com.peetz.tradingcards.entity.ParallelSetEntity;
import com.peetz.tradingcards.entity.SportCardEntity;
import java.util.ArrayList;
import java.util.List;
import javax.ejb.EJB;
import javax.persistence.EntityManager;
import javax.persistence.PersistenceContext;
import javax.persistence.Query;
@Stateless(name="TradingcardService")
@TransactionAttribute(TransactionAttributeType.REQUIRED)
public class TradingcardServiceImpl implements TradingcardService {
@PersistenceContext(unitName = "kontor")
private EntityManager em;
@EJB
ManufacturerDao manufacturerDao;
@SuppressWarnings("unchecked")
@Override
public Collection<ManufacturerEntity> getAllManufacturers() {
Query query = em.createNamedQuery("Manufacturer.findAll");
ArrayList<ManufacturerEntity> manufacturerList = new ArrayList<ManufacturerEntity>(query.getResultList());
return manufacturerList;
}
@Override
public void addManufacturer(String name) {
List<ManufacturerEntity> resultList = manufacturerDao.findByName(name);
if (resultList.isEmpty()) {
ManufacturerEntity manufacturer = new ManufacturerEntity();
manufacturer.setName(name);
manufacturerDao.store(manufacturer);
}
}
@SuppressWarnings("unchecked")
@Override
public Collection<SportCardEntity> getAllSportCards() {
Query query = em.createNamedQuery("SportCard.findAll");
ArrayList<SportCardEntity> sportCardList = new ArrayList<SportCardEntity>(query.getResultList());
return sportCardList;
}
@Override
public Collection<BaseSetEntity> getBaseSetsByManufacturer(ManufacturerEntity manufacturer) {
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<ParallelSetEntity> getParallelSetsByManufacturer(ManufacturerEntity manufacturer) {
// TODO Auto-generated method stub
return null;
}
@Override
public Collection<InsertEntity> getInsertsByManufacturer(ManufacturerEntity manufacturer) {
// TODO Auto-generated method stub
return null;
}
}
@@ -0,0 +1,5 @@
/**
* @author TPEETZ
*
*/
package com.peetz.tradingcards.service;
@@ -0,0 +1,147 @@
/*
* 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.tradingcards.dal;
import com.peetz.tradingcards.entity.BaseSetEntity;
import com.peetz.tradingcards.entity.ManufacturerEntity;
import java.util.Collection;
import java.util.List;
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.*;
/**
*
* @author tpeetz
*/
public class ManufacturerImplTest {
public ManufacturerImplTest() {
}
@BeforeClass
public static void setUpClass() {
}
@AfterClass
public static void tearDownClass() {
}
@Before
public void setUp() {
}
@After
public void tearDown() {
}
/**
* Test of getById method, of class ManufacturerImpl.
*/
@Test
public void testGetById() throws Exception {
System.out.println("getById");
Long id = null;
EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
ManufacturerDao instance = (ManufacturerDao)container.getContext().lookup("java:global/main/ManufacturerDao");
ManufacturerEntity expResult = null;
ManufacturerEntity result = instance.getById(id);
assertEquals(expResult, result);
container.close();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of findByIds method, of class ManufacturerImpl.
*/
@Test
public void testFindByIds() throws Exception {
System.out.println("findByIds");
List<Long> ids = null;
EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
ManufacturerDao instance = (ManufacturerDao)container.getContext().lookup("java:global/classes/ManufacturerImpl");
Collection<ManufacturerEntity> expResult = null;
Collection<ManufacturerEntity> result = instance.findByIds(ids);
assertEquals(expResult, result);
container.close();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of findByName method, of class ManufacturerImpl.
*/
@Test
public void testFindByName() throws Exception {
System.out.println("findByName");
String name = "";
EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
ManufacturerDao instance = (ManufacturerDao)container.getContext().lookup("java:global/classes/ManufacturerImpl");
Collection<ManufacturerEntity> expResult = null;
Collection<ManufacturerEntity> result = instance.findByName(name);
assertEquals(expResult, result);
container.close();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of assignBaseSet method, of class ManufacturerImpl.
*/
@Test
public void testAssignBaseSet() throws Exception {
System.out.println("assignBaseSet");
ManufacturerEntity comic = null;
BaseSetEntity baseSet = null;
EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
ManufacturerDao instance = (ManufacturerDao)container.getContext().lookup("java:global/classes/ManufacturerImpl");
ManufacturerEntity expResult = null;
ManufacturerEntity result = instance.assignBaseSet(comic, baseSet);
assertEquals(expResult, result);
container.close();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of store method, of class ManufacturerImpl.
*/
@Test
public void testStore() throws Exception {
System.out.println("store");
ManufacturerEntity entity = null;
EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
ManufacturerDao instance = (ManufacturerDao)container.getContext().lookup("java:global/classes/ManufacturerImpl");
ManufacturerEntity expResult = null;
ManufacturerEntity result = instance.store(entity);
assertEquals(expResult, result);
container.close();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
/**
* Test of delete method, of class ManufacturerImpl.
*/
@Test
public void testDelete() throws Exception {
System.out.println("delete");
ManufacturerEntity entity = null;
EJBContainer container = javax.ejb.embeddable.EJBContainer.createEJBContainer();
ManufacturerDao instance = (ManufacturerDao)container.getContext().lookup("java:global/classes/ManufacturerImpl");
instance.delete(entity);
container.close();
// TODO review the generated test code and remove the default call to fail.
fail("The test case is a prototype.");
}
}