Skip to content
Snippets Groups Projects
Commit 9234bd79 authored by Goik Martin's avatar Goik Martin
Browse files

Cleanup warnings

parent 4afcf0b3
No related branches found
No related tags found
No related merge requests found
......@@ -18,7 +18,7 @@ public class EmployeeInfo {
* This refers to a corresponding element {@code <persistence-unit name = "strategy_none" >}
* in META-INF/persistence.xml leaving the Database "as is".
*/
static public final String PERSISTENCE_UNIT_NONE = "strategy_none";
static private final String PERSISTENCE_UNIT_NONE = "strategy_none";
/**
* @param args Unused
*/
......@@ -35,12 +35,9 @@ public class EmployeeInfo {
cq.from(Department.class); // Set query root, don't forget me!
em.getTransaction().begin();
for (final Department d: em.createQuery(cq).getResultList()) {
System.out.println(d.getName());
}
for (final Department d: em.createQuery(cq).getResultList()) {
System.out.println(d.getName());
}
em.getTransaction().commit();
em.close();
......
......@@ -10,8 +10,8 @@ import de.hdm_stuttgart.mi.sda1.exam.dataexport.model.Department;
import de.hdm_stuttgart.mi.sda1.exam.dataexport.model.Employee;
/**
* Exporting company data. Execution requires importing corresponding
* schema and optionally sample data from Sql/sample.sql
* Exporting company data. Execution requires an existing database schema and
* optionally sample data. See file Sql/sample.sql.
*/
public class EmployeeInfo {
......@@ -19,7 +19,7 @@ public class EmployeeInfo {
* This refers to a corresponding element {@code <persistence-unit name = "strategy_none" >}
* in META-INF/persistence.xml leaving the Database "as is".
*/
static public final String PERSISTENCE_UNIT_NONE = "strategy_none";
static private final String PERSISTENCE_UNIT_NONE = "strategy_none";
/**
* @param args Unused
*/
......@@ -46,17 +46,18 @@ public class EmployeeInfo {
factory.close();
}
static String getInfo(final Employee e) {
final StringBuffer ret = new StringBuffer(e.getCommonName() + ", department " + e.getDepartment().getName());
private static String getInfo(final Employee e) {
final StringBuilder ret = new StringBuilder(e.getCommonName() + ", department " + e.getDepartment().getName());
final Department rootDepartment = getRootDepartment(e.getDepartment());
if (rootDepartment != e.getDepartment()) {
ret.append(", Top level department " + rootDepartment.getName());
ret.append(", Top level department ");
ret.append(rootDepartment.getName());
}
return ret.toString();
}
static Department getRootDepartment(Department d) {
private static Department getRootDepartment(Department d) {
while (null != d.getParent()) {
d = d.getParent();
}
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment