Skip to content
Snippets Groups Projects
Commit 4108250a authored by hkarwa2s's avatar hkarwa2s
Browse files

Super tolles Refaktorn -> entfernen unnötiger imports

Funktionen für Kategorie Unterpunkte, mit Parametern für die Produktsuche
parent 4d415678
No related branches found
No related tags found
No related merge requests found
Showing
with 94 additions and 167 deletions
......@@ -11,4 +11,26 @@
<goal>jetty:run</goal>
</goals>
</action>
<action>
<actionName>debug</actionName>
<packagings>
<packaging>war</packaging>
<packaging>ear</packaging>
<packaging>ejb</packaging>
</packagings>
<goals>
<goal>jetty:run</goal>
</goals>
<properties>
<netbeans.deploy.debugmode>true</netbeans.deploy.debugmode>
<jpda.listen>maven</jpda.listen>
</properties>
</action>
<action>
<actionName>CUSTOM-Sonarqube</actionName>
<displayName>Sonarqube</displayName>
<goals>
<goal>sonar:sonar</goal>
</goals>
</action>
</actions>
/*
* 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 org.s4s.dao;
import org.s4s.exceptions.NoSuchUserOrPassword;
import org.s4s.exceptions.DAOException;
import org.s4s.exceptions.NoSuchUserOrPassword;
import org.s4s.modell.dto.User;
/**
......
/*
* 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 org.s4s.dao;
import java.util.List;
......
/*
* 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 org.s4s.dao;
import java.sql.*;
......@@ -15,24 +10,24 @@ import org.s4s.services.db.JDBCConnection;
* @author Simon
*/
public class RegistrationDAO extends AbstractDatabaseClass {
Statement st = JDBCConnection.getInstance().getStatement();
String sql_update;
public void addUser(String benutzer, String nachname, String vorname, java.util.Date gebDate, int fBereich, String email, String emailwdh, String passwort, String passwortWdh) {
try {
sql_update = "INSERT INTO \"ERR\".\"user\"(benutzername, nachname, vorname, geburtsdatum, fachbreichid, email, passwort)" +
"VALUES(\'" + benutzer + "\', \'" + nachname + "\', \'" + vorname + "\', \'" + gebDate + "\', \'" + fBereich + "\', \'" + email + "\', \'" + passwort + "\')";
sql_update = "INSERT INTO \"ERR\".\"user\"(benutzername, nachname, vorname, geburtsdatum, fachbreichid, email, passwort)"
+ "VALUES(\'" + benutzer + "\', \'" + nachname + "\', \'" + vorname + "\', \'" + gebDate + "\', \'" + fBereich + "\', \'" + email + "\', \'" + passwort + "\')";
int exe = st.executeUpdate(sql_update);
if(exe < 0) {
if (exe < 0) {
throw new WrongInputException("Wrong Input!");
}
} catch (Exception ex) {
ex.printStackTrace();
System.out.println("Exception occur: " + ex);
}
}
}
/*
* 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 org.s4s.dao;
import java.sql.ResultSet;
......@@ -18,10 +13,12 @@ import org.s4s.services.db.JDBCConnection;
* @author Benjamin
*/
public class ShopDAO {
public static ShopDAO dao = null;
private final Statement statement = JDBCConnection.getInstance().getStatement();
private ShopDAO() {
}
public static ShopDAO getInstance() {
......@@ -30,14 +27,14 @@ public class ShopDAO {
}
return dao;
}
//Shop anhand von User/Besitzer auslesen
public boolean viewShop (User user) {
public boolean viewShop(User user) {
boolean result = true;
try {
ResultSet set = statement.executeQuery("SELECT *"
+ "FROM ERR.shop"
+ "WHERE besitzer = \'" + user.getBenutzername() + "\'");
+ "FROM ERR.shop"
+ "WHERE besitzer = \'" + user.getBenutzername() + "\'");
if (set != null) {
result = false;
......@@ -47,20 +44,20 @@ public class ShopDAO {
}
return result;
}
public boolean addShop (User user, String shopName, String shopDescription) {
public boolean addShop(User user, String shopName, String shopDescription) {
//Shop via Benutzername anlegen da dieser idR eindeutig ist
try {
// vorausgesetzt ID wird automatisch gesetzt von der DB
statement.execute("INSERT INTO ERR.shop (name, besitzer, beschreibung) VALUES ("
+ shopName + ","
+ user.getBenutzername() + ","
statement.execute("INSERT INTO ERR.shop (name, besitzer, beschreibung) VALUES ("
+ shopName + ","
+ user.getBenutzername() + ","
+ shopDescription + ");");
return true;
} catch (SQLException ex) {
Logger.getLogger(ShopDAO.class.getName()).log(Level.SEVERE, null, ex);
return false;
}
}
}
/*
* 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 org.s4s.dao;
import java.util.List;
......
/*
* 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 org.s4s.dao.impl;
import java.sql.ResultSet;
......@@ -28,12 +23,11 @@ public abstract class AbstractDatabaseClass {
stat.closeOnCompletion();
return set;
}
/*protected int executeUpdate(String sql) throws SQLException {
Statement stat = conn.getStatement();
int set = stat.executeUpdate(sql);
stat.closeOnCompletion();
return set;
}*/
}
/*
* 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 org.s4s.exceptions;
/**
......
/*
* 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 org.s4s.exceptions;
/**
......
/*
* 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 org.s4s.exceptions;
/**
......
/*
* 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 org.s4s.exceptions;
/**
......@@ -20,9 +15,9 @@ public class OwnsAlreadyShop extends Exception {
public void setReason(String reason) {
this.reason = reason;
}
public OwnsAlreadyShop (String reason) {
public OwnsAlreadyShop(String reason) {
this.reason = reason;
}
}
/*
* 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 org.s4s.exceptions;
/**
......@@ -10,8 +5,9 @@ package org.s4s.exceptions;
* @author Simon
*/
public class WrongInputException extends Exception {
String reason = null;
public String getReason() {
return reason;
}
......@@ -19,6 +15,7 @@ public class WrongInputException extends Exception {
public void setReason(String reason) {
this.reason = reason;
}
public WrongInputException(String reason) {
this.reason = reason;
}
......
......@@ -47,8 +47,8 @@ public class InitView extends UI {
navi.addView(Views.KONTAKTBESTAETIGUNG, Kontaktbestaetigung.class);
//Test der RegistrierungsView
UI.getCurrent().getNavigator().navigateTo(Views.WELCOME);
setHeight(100f,Unit.PERCENTAGE);
setWidth(100f,Unit.PERCENTAGE);
setHeight(100f, Unit.PERCENTAGE);
setWidth(100f, Unit.PERCENTAGE);
//UI.getCurrent().getNavigator().navigateTo(Views.REGISTRIERUNG);
//this.setWidth(64f, Unit.PERCENTAGE);
......
/*
* 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 org.s4s.gui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.ui.VerticalLayout;
/**
*
* @author Holger
*/
public class ArtikeldetailsView extends TemplateView{
public class ArtikeldetailsView extends TemplateView {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
/*
* 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 org.s4s.gui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.ui.VerticalLayout;
/**
*
* @author Holger
*/
public class BenutzerkontoView extends TemplateView{
public class BenutzerkontoView extends TemplateView {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
/*
* 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 org.s4s.gui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.ui.VerticalLayout;
/**
*
* @author Holger
*/
public class CheckoutView extends TemplateView{
public class CheckoutView extends TemplateView {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
......@@ -3,7 +3,6 @@ package org.s4s.gui.views;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.FontAwesome;
import com.vaadin.shared.ui.label.ContentMode;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Button;
import com.vaadin.ui.Label;
import com.vaadin.ui.Panel;
......@@ -16,36 +15,35 @@ import org.s4s.services.util.Views;
/**
* Created by Max-Desktop on 16.05.2017.
*/
public class ContactView extends TemplateView{
public class ContactView extends TemplateView {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
this.setUp();
}
public void setUp() {
setMargin(true);
final TextField tfEMail = new TextField("E-Mail");
final TextField tfBetreff = new TextField("Betreff");
final TextArea taNachricht = new TextArea("Ihr Anliegen");
final Button bSenden = new Button("Senden", FontAwesome.SEND);
final Label lSpace = new Label("&nbsp", ContentMode.HTML);
VerticalLayout vLayout = new VerticalLayout();
vLayout.addComponents(tfEMail, tfBetreff, taNachricht, lSpace, bSenden);
Panel pKontakt = new Panel("Kontakt Anfrage");
// pKontakt.addStyleName("kontakt");
//this.addComponent(pKontakt);
//this.setComponentAlignment(pKontakt, Alignment.MIDDLE_CENTER);
bSenden.addClickListener(e ->
UI.getCurrent().getNavigator().navigateTo(Views.KONTAKTBESTAETIGUNG));
bSenden.addClickListener(e
-> UI.getCurrent().getNavigator().navigateTo(Views.KONTAKTBESTAETIGUNG));
pKontakt.setContent(vLayout);
super.setUpFooterAndHeader(pKontakt);
}
}
/*
* 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 org.s4s.gui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.ui.VerticalLayout;
/**
*
* @author Holger
*/
public class FaqView extends TemplateView{
public class FaqView extends TemplateView {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
throw new UnsupportedOperationException("Not supported yet."); //To change body of generated methods, choose Tools | Templates.
}
}
/*
* 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 org.s4s.gui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.ui.Alignment;
import com.vaadin.ui.Label;
......@@ -15,14 +9,14 @@ import com.vaadin.ui.VerticalLayout;
*
* @author Holger
*/
public class ImpressumView extends TemplateView{
public class ImpressumView extends TemplateView {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
this.setUp();
}
private void setUp(){
private void setUp() {
VerticalLayout vertLayout = new VerticalLayout();
vertLayout.setSizeFull();
Label label = new Label("Lorem ipsum dolor sit amet, consetetur sadipscing elitr, "
......@@ -34,8 +28,7 @@ public class ImpressumView extends TemplateView{
+ " At vero eos et accusam et justo duo dolores et ea rebum. Stet clita kasd gubergren, "
+ "no sea takimata sanctus est Lorem ipsum dolor sit amet.");
vertLayout.addComponent(label);
vertLayout.setComponentAlignment(label,Alignment.MIDDLE_CENTER);
vertLayout.setComponentAlignment(label, Alignment.MIDDLE_CENTER);
super.setUpFooterAndHeader(vertLayout);
......
/*
* 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 org.s4s.gui.views;
import com.vaadin.navigator.View;
import com.vaadin.navigator.ViewChangeListener;
import com.vaadin.server.FontAwesome;
import com.vaadin.ui.Button;
......@@ -19,7 +13,7 @@ import org.s4s.services.util.Views;
*
* @author JanPhilipp
*/
public class KaufbestaetigungView extends TemplateView{
public class KaufbestaetigungView extends TemplateView {
@Override
public void enter(ViewChangeListener.ViewChangeEvent event) {
......@@ -27,26 +21,27 @@ public class KaufbestaetigungView extends TemplateView{
}
private void setUp() {
Panel panel = new Panel();
Panel panel = new Panel();
panel.setSizeUndefined();
VerticalLayout content = new VerticalLayout();
Button button = new Button("Weiter shoppen");
button.setIcon(FontAwesome.BOOK);
button.addClickListener(e ->
UI.getCurrent().getNavigator().navigateTo(Views.WELCOME));
button.addClickListener(e
-> UI.getCurrent().getNavigator().navigateTo(Views.WELCOME));
Label label = new Label("Vielen Dank für ihren Einkauf! Wenn sie weitershoppen wollen... :)");
content.addComponent(label);
content.addComponent(button);
content.setMargin(true);
panel.setContent(content);
//this.addComponent(panel);
//this.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
super.setUpFooterAndHeader(panel);
}}
content.addComponent(label);
content.addComponent(button);
content.setMargin(true);
panel.setContent(content);
//this.addComponent(panel);
//this.setComponentAlignment(panel, Alignment.MIDDLE_CENTER);
super.setUpFooterAndHeader(panel);
}
}
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