Permalink
Browse files

Merge branch 'master' of https://github.com/AStA-Wedel/Kasse.git

  • Loading branch information...
2 parents cb41e92 + 8b2edb2 commit 8fadda9f726b5fd711d8f0f2a693a2e91a575a60 @alexbiehl alexbiehl committed Mar 23, 2013
@@ -0,0 +1,43 @@
+package org.fhw.asta.kasse.client.activity;
+
+import org.fhw.asta.kasse.client.widget.HasTopbar;
+import org.fhw.asta.kasse.client.widget.main.MainWidget;
+import org.fhw.asta.kasse.client.widget.sidebar.SidebarWidget;
+import org.fhw.asta.kasse.client.widget.topbar.ready.ReadyTopBarWidget;
+import org.fhw.asta.kasse.client.widget.userlist.UserListWidget;
+
+import com.google.gwt.activity.shared.AbstractActivity;
+import com.google.gwt.event.shared.EventBus;
+import com.google.gwt.user.client.ui.AcceptsOneWidget;
+import com.google.inject.Inject;
+
+public class UserListActivity extends AbstractActivity {
+
+ @Inject
+ private ReadyTopBarWidget readyTopbarWidget;
+
+ @Inject
+ private SidebarWidget sidebarWidget;
+
+ @Inject
+ private MainWidget mainWidget;
+
+ @Inject
+ private HasTopbar topbarContainer;
+
+ @Inject
+ private UserListWidget userListWidget;
+
+ @Override
+ public void start(AcceptsOneWidget panel, EventBus eventBus) {
+ topbarContainer.setTopbar(readyTopbarWidget);
+
+ mainWidget.setSidebarWidget(sidebarWidget);
+ mainWidget.setBasketWidget(null);
+ mainWidget.setWidget(userListWidget);
+
+ panel.setWidget(mainWidget);
+
+ }
+
+}
@@ -6,10 +6,12 @@
import org.fhw.asta.kasse.client.inject.module.factory.BackofficeActivityFactory;
import org.fhw.asta.kasse.client.inject.module.factory.LoginActivityFactory;
import org.fhw.asta.kasse.client.inject.module.factory.PrintCustomsActivityFactory;
+import org.fhw.asta.kasse.client.inject.module.factory.UserListActivityFactory;
import org.fhw.asta.kasse.client.place.ArticleListPlace;
import org.fhw.asta.kasse.client.place.BackofficePlace;
import org.fhw.asta.kasse.client.place.LoginPlace;
import org.fhw.asta.kasse.client.place.PrintCustomsPlace;
+import org.fhw.asta.kasse.client.place.UserListPlace;
import com.google.common.base.Optional;
import com.google.gwt.activity.shared.Activity;
@@ -38,6 +40,9 @@
@Inject
private PrintCustomsActivityFactory printCustomsActivityFactory;
+ @Inject
+ private UserListActivityFactory userListActivityFactory;
+
@Override
public Activity getActivity(Place place) {
@@ -62,6 +67,10 @@ public Activity getActivity(Place place) {
if (place instanceof PrintCustomsPlace) {
return printCustomsActivityFactory.create((PrintCustomsPlace)place);
}
+
+ if (place instanceof UserListPlace) {
+ return userListActivityFactory.create((UserListPlace)place);
+ }
return null;
}
@@ -3,9 +3,10 @@
import org.fhw.asta.kasse.client.place.ArticleListPlace;
import org.fhw.asta.kasse.client.place.LoginPlace;
import org.fhw.asta.kasse.client.place.PrintCustomsPlace;
+import org.fhw.asta.kasse.client.place.UserListPlace;
import com.google.gwt.place.shared.PlaceHistoryMapper;
import com.google.gwt.place.shared.WithTokenizers;
-@WithTokenizers({LoginPlace.Tokenizer.class, ArticleListPlace.Tokenizer.class, PrintCustomsPlace.Tokenizer.class})
+@WithTokenizers({LoginPlace.Tokenizer.class, ArticleListPlace.Tokenizer.class, PrintCustomsPlace.Tokenizer.class, UserListPlace.Tokenizer.class})
public interface AppPlaceHistoryMapper extends PlaceHistoryMapper {}
@@ -4,10 +4,12 @@
import org.fhw.asta.kasse.client.activity.BackofficeActivity;
import org.fhw.asta.kasse.client.activity.LoginActivity;
import org.fhw.asta.kasse.client.activity.PrintCustomsActivity;
+import org.fhw.asta.kasse.client.activity.UserListActivity;
import org.fhw.asta.kasse.client.inject.module.factory.ArticleListActivityFactory;
import org.fhw.asta.kasse.client.inject.module.factory.BackofficeActivityFactory;
import org.fhw.asta.kasse.client.inject.module.factory.LoginActivityFactory;
import org.fhw.asta.kasse.client.inject.module.factory.PrintCustomsActivityFactory;
+import org.fhw.asta.kasse.client.inject.module.factory.UserListActivityFactory;
import com.google.gwt.activity.shared.Activity;
import com.google.gwt.inject.client.AbstractGinModule;
@@ -21,6 +23,7 @@ protected void configure() {
install(new GinFactoryModuleBuilder().implement(Activity.class, ArticleListActivity.class).build(ArticleListActivityFactory.class));
install(new GinFactoryModuleBuilder().implement(Activity.class, BackofficeActivity.class).build(BackofficeActivityFactory.class));
install(new GinFactoryModuleBuilder().implement(Activity.class, PrintCustomsActivity.class).build(PrintCustomsActivityFactory.class));
+ install(new GinFactoryModuleBuilder().implement(Activity.class, UserListActivity.class).build(UserListActivityFactory.class));
}
}
@@ -0,0 +1,8 @@
+package org.fhw.asta.kasse.client.inject.module.factory;
+
+import org.fhw.asta.kasse.client.activity.UserListActivity;
+import org.fhw.asta.kasse.client.place.UserListPlace;
+
+public interface UserListActivityFactory {
+ UserListActivity create(UserListPlace userListPlace);
+}
@@ -0,0 +1,34 @@
+package org.fhw.asta.kasse.client.place;
+
+import com.google.gwt.place.shared.Place;
+import com.google.gwt.place.shared.PlaceTokenizer;
+
+public class UserListPlace extends Place {
+ private String token;
+
+ public UserListPlace(String token) {
+ this.token = token;
+ }
+
+ public UserListPlace() {
+ this.token = "";
+ }
+
+ public static final class Tokenizer implements PlaceTokenizer<UserListPlace> {
+
+ @Override
+ public UserListPlace getPlace(String token) {
+ return new UserListPlace(token);
+ }
+
+ @Override
+ public String getToken(UserListPlace place) {
+ return place.getToken();
+ }
+
+ }
+
+ public String getToken() {
+ return token;
+ }
+}
@@ -4,6 +4,8 @@
import java.sql.SQLException;
import java.util.List;
+import org.fhw.asta.kasse.shared.basket.BasketItem;
+import org.fhw.asta.kasse.shared.common.EuroAmount;
import org.fhw.asta.kasse.shared.model.BillOrder;
import org.fhw.asta.kasse.shared.model.OrderState;
import org.springframework.jdbc.core.RowMapper;
@@ -13,7 +15,8 @@
@Singleton
public class BillOrderDao extends GenericDao {
- private BillOrderRowMapper mapper = new BillOrderRowMapper();
+ private BillOrderRowMapper billOrderMapper = new BillOrderRowMapper();
+ private BasketItemMapper basketItemMapper = new BasketItemMapper();
private class BillOrderRowMapper implements RowMapper<BillOrder> {
@Override
@@ -24,13 +27,29 @@ public BillOrder mapRow(final ResultSet arg0, final int arg1) throws SQLExceptio
}
}
+ private class BasketItemMapper implements RowMapper<BasketItem> {
+ @Override
+ public BasketItem mapRow(ResultSet arg0, int arg1) throws SQLException {
+ // TODO Auto-generated method stub
+ return new BasketItem(arg0.getString(1), new EuroAmount(arg0.getInt(2)), arg0.getInt(3), arg0.getInt(4),
+ arg0.getInt(5));
+ }
+ }
+
public List<BillOrder> getAllBillOrders() {
- return this.template.query("SELECT * FROM bill_order", this.mapper);
+ return this.template.query("SELECT * FROM bill_order", this.billOrderMapper);
}
public BillOrder getBillOrder(int id) {
// TODO: loggen, falls wider erwarten mehr als ein ergebnis zurückkommt
- return this.template.queryForObject("SELECT * FROM bill_order WHERE bill_id = ?", new Object[]{id}, this.mapper);
+ return this.template.queryForObject("SELECT * FROM bill_order WHERE bill_id = ?", new Object[]{id},
+ this.billOrderMapper);
+ }
+
+ public List<BasketItem> getBillOrderArticles(int id) {
+ return this.template.query("SELECT a.name, a.price, a.article_id, bca.count,"
+ + " bca.discount FROM bill_order bo INNER JOIN bill_contains_article "
+ + "bca INNER JOIN article a WHERE bo.bill_id = ?", this.basketItemMapper);
}
}
@@ -1,6 +1,5 @@
package org.fhw.asta.kasse.server.service;
-import java.util.Collections;
import java.util.List;
import org.fhw.asta.kasse.server.dao.ArticleDao;
@@ -34,8 +33,7 @@ public BillOrder getBillOrder(int id) {
@Override
public List<BasketItem> getBillOrderArticles(int id) {
- final BillOrder bo = this.getBillOrder(id);
- return Collections.emptyList();
+ return this.billOrderDao.getBillOrderArticles(id);
}
}
Oops, something went wrong.

0 comments on commit 8fadda9

Please sign in to comment.