Franciaflex-magalie-commits
Threads by month
- ----- 2026 -----
- June
- May
- April
- March
- February
- January
- ----- 2025 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2024 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2023 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2022 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2021 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2020 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2019 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2018 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2017 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2016 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2015 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2014 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
- February
- January
- ----- 2013 -----
- December
- November
- October
- September
- August
- July
- June
- May
- April
- March
May 2013
- 4 participants
- 86 discussions
r208 - trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action
by bleny@users.forge.codelutin.com 29 May '13
by bleny@users.forge.codelutin.com 29 May '13
29 May '13
Author: bleny
Date: 2013-05-29 11:17:06 +0200 (Wed, 29 May 2013)
New Revision: 208
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
wrong value for activity
Modified:
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java 2013-05-29 08:55:37 UTC (rev 207)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java 2013-05-29 09:17:06 UTC (rev 208)
@@ -60,7 +60,7 @@
@Override
public String input() {
- session.setActivity(Activity.PREPARED_RECEPTIONS);
+ session.setActivity(Activity.RECEPTIONS);
Building building = session.getBuilding();
1
0
r207 - in branches/magalie-eugene/magalie-persistence/src/main: java/com/franciaflex/magalie/persistence/dao xmi
by tchemit@users.forge.codelutin.com 29 May '13
by tchemit@users.forge.codelutin.com 29 May '13
29 May '13
Author: tchemit
Date: 2013-05-29 10:55:37 +0200 (Wed, 29 May 2013)
New Revision: 207
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
add generic in user dao + notGeneratedValue stereotype
Modified:
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java
branches/magalie-eugene/magalie-persistence/src/main/xmi/magalie.properties
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -35,7 +35,7 @@
}
@Override
- public Article findByCode(String articleCode) {
+ public E findByCode(String articleCode) {
TypedQuery<E> query = createQuery("from Article a where a.code = :code");
query.setParameter(Article.PROPERTY_CODE, articleCode);
return findUniqueOrNull(query);
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -38,20 +38,20 @@
}
@Override
- public DeliveredRequestedArticle find(StorageMovementOrder storageMovementOrder) {
+ public E find(StorageMovementOrder storageMovementOrder) {
TypedQuery<E> query =
- entityManager.createQuery(
- "from DeliveredRequestedArticle dra where dra.storageMovementOrder = :storageMovementOrder", getEntityClass());
+ createQuery(
+ "from DeliveredRequestedArticle dra where dra.storageMovementOrder = :storageMovementOrder");
query.setParameter("storageMovementOrder", storageMovementOrder);
return findUniqueOrNull(query);
}
@Override
- public List<DeliveredRequestedArticle> findAll(RequestedList requestedList) {
+ public List<E> findAll(RequestedList requestedList) {
TypedQuery<E> query =
- entityManager.createQuery(
- "from DeliveredRequestedArticle dra where dra.requestedArticle.requestedList = :requestedList", getEntityClass());
+ createQuery(
+ "from DeliveredRequestedArticle dra where dra.requestedArticle.requestedList = :requestedList");
query.setParameter("requestedList", requestedList);
- return (List<DeliveredRequestedArticle>) findAll(query);
+ return findAll(query);
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -38,7 +38,7 @@
}
@Override
- public DeliveredRequestedList findByAffectedTo(MagalieUser affectedTo) {
+ public E findByAffectedTo(MagalieUser affectedTo) {
TypedQuery<E> query = createQuery(
"from DeliveredRequestedList drl where drl.status = :affected and drl.affectedTo = :affectedTo");
@@ -52,7 +52,7 @@
}
@Override
- public DeliveredRequestedList findByRequestedList(RequestedList requestedList) {
+ public E findByRequestedList(RequestedList requestedList) {
TypedQuery<E> query = createQuery(
"from DeliveredRequestedList drl where drl.requestedList = :requestedList");
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -37,8 +37,8 @@
}
@Override
- public Kanban find(Article article, Warehouse warehouse) {
- TypedQuery<E> query = entityManager.createQuery("from Kanban k where k.article = :article and k.warehouse = :warehouse", getEntityClass());
+ public E find(Article article, Warehouse warehouse) {
+ TypedQuery<E> query = createQuery("from Kanban k where k.article = :article and k.warehouse = :warehouse");
query.setParameter("article", article);
query.setParameter("warehouse", warehouse);
return query.getSingleResult();
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -39,7 +39,7 @@
}
@Override
- public LocationError findByLocation(Location location) {
+ public E findByLocation(Location location) {
TypedQuery<E> query = createQuery("from LocationError se where se.location = :location");
query.setParameter("location", location);
return findUniqueOrNull(query);
@@ -47,7 +47,8 @@
@Override
public List<Location> getAllLocationsInError(Article article) {
- Query query = entityManager.createQuery("select se.location from LocationError se where se.article = :article");
+ TypedQuery<Location> query = createQuery(Location.class,
+ "select se.location from LocationError se where se.article = :article");
query.setParameter("article", article);
List<Location> allLocationsInError = query.getResultList();
return allLocationsInError;
@@ -55,7 +56,7 @@
@Override
public List<E> findAll() {
- Query query = entityManager.createQuery("from LocationError se order by se.reportDate");
+ TypedQuery<E> query = createQuery("from LocationError se order by se.reportDate");
List<E> all = query.getResultList();
return all;
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -39,14 +39,14 @@
}
@Override
- public Location find(String code, Warehouse warehouse) {
+ public E find(String code, Warehouse warehouse) {
TypedQuery<E> query = createQuery("from Location l where l.code = :code and l.warehouse = :warehouse");
query.setParameter("code", code);
query.setParameter("warehouse", warehouse);
return findUnique(query);
}
- protected List<Location> findAllWithoutReception(Building building, Warehouse warehouse) {
+ protected List<E> findAllWithoutReception(Building building, Warehouse warehouse) {
boolean filterOnBuilding = building != null;
boolean filterOnWarehouse = warehouse != null;
String hql = " from Location l where";
@@ -69,16 +69,16 @@
}
query.setParameter("codeForReceptionLocations", Locations.codeForReceptionLocations());
query.setParameter("codeForWarehouseWithoutLocations", Locations.codeForWarehouseWithoutLocations());
- return (List<Location>) findAll(query);
+ return findAll(query);
}
@Override
- public List<Location> findAllWithoutReception(Building building) {
+ public List<E> findAllWithoutReception(Building building) {
return findAllWithoutReception(building, null);
}
@Override
- public List<Location> findAllWithoutReception(Warehouse warehouse) {
+ public List<E> findAllWithoutReception(Warehouse warehouse) {
return findAllWithoutReception(null, warehouse);
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -37,7 +37,7 @@
}
@Override
- public MagalieUser findByLogin(String login) {
+ public E findByLogin(String login) {
TypedQuery<E> query = createQuery("from MagalieUser mu where mu.login = :login");
query.setParameter("login", login);
return findUnique(query);
@@ -45,7 +45,7 @@
@Override
public List<E> findAll() {
- Query query = entityManager.createQuery("from MagalieUser mu order by mu.login");
+ TypedQuery<E> query = createQuery("from MagalieUser mu order by mu.login");
List<E> resultList = query.getResultList();
return resultList;
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -12,7 +12,7 @@
}
@Override
- public PreparedArticleReception findByBarcode(String barcode) {
+ public E findByBarcode(String barcode) {
TypedQuery<E> query = createQuery("from PreparedArticleReception par where par.barcode = :barcode");
query.setParameter("barcode", barcode);
return findUniqueOrNull(query);
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -40,7 +40,7 @@
}
@Override
- public List<RequestedArticle> findAllUndelivered(Building building, MagalieUser affectedTo, String listType) {
+ public List<E> findAllUndelivered(Building building, MagalieUser affectedTo, String listType) {
TypedQuery<E> query = createQuery(
"from RequestedArticle ra where "
+ " ra not in (select dra.requestedArticle from DeliveredRequestedArticle dra) "
@@ -52,14 +52,14 @@
query.setParameter("complete", DeliveredRequestedListStatus.COMPLETE);
query.setParameter("affected", DeliveredRequestedListStatus.AFFECTED);
query.setParameter("affectedTo", affectedTo);
- return (List<RequestedArticle>) findAll(query);
+ return findAll(query);
}
@Override
- public List<RequestedArticle> findAll(RequestedList requestedList) {
+ public List<E> findAll(RequestedList requestedList) {
TypedQuery<E> query = createQuery("from RequestedArticle ra where ra.requestedList = :requestedList");
query.setParameter("requestedList", requestedList);
- return (List<RequestedArticle>) findAll(query);
+ return findAll(query);
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -37,7 +37,7 @@
@Override
public List<String> findAllDistinctListTypes() {
- TypedQuery<String> query = entityManager.createQuery("select distinct rl.listType from RequestedList rl", String.class);
+ TypedQuery<String> query = createQuery(String.class, "select distinct rl.listType from RequestedList rl");
return query.getResultList();
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -29,7 +29,7 @@
import com.franciaflex.magalie.persistence.entity.StorageMovement;
import javax.persistence.EntityManager;
-import javax.persistence.Query;
+import javax.persistence.TypedQuery;
import java.util.List;
public class AbstractStorageMovementJpaDao<E extends StorageMovement> extends GeneratedStorageMovementJpaDao<E> {
@@ -39,15 +39,15 @@
}
@Override
- public List<StorageMovement> findAllByArticle(Article article) {
- Query query = entityManager.createQuery("from StorageMovement sm where sm.article = :article");
+ public List<E> findAllByArticle(Article article) {
+ TypedQuery<E> query = createQuery("from StorageMovement sm where sm.article = :article");
query.setParameter("article", article);
return query.getResultList();
}
@Override
- public List<StorageMovement> findAllInReception(Building building) {
- Query query = entityManager.createQuery(
+ public List<E> findAllInReception(Building building) {
+ TypedQuery<E> query = createQuery(
" from StorageMovement sm" +
" where sm.originLocation.code = :codeForReceptionLocations and sm.originLocation.warehouse.building = :building" +
" or " +
@@ -59,7 +59,7 @@
@Override
public List<E> findAll() {
- Query query = entityManager.createQuery("from StorageMovement sm order by sm.orderDate");
+ TypedQuery<E> query = createQuery("from StorageMovement sm order by sm.orderDate");
return query.getResultList();
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -28,7 +28,7 @@
import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
import javax.persistence.EntityManager;
-import javax.persistence.Query;
+import javax.persistence.TypedQuery;
import java.util.List;
public class AbstractStorageMovementOrderJpaDao<E extends StorageMovementOrder> extends GeneratedStorageMovementOrderJpaDao<E> {
@@ -38,8 +38,8 @@
}
@Override
- public List<StorageMovementOrder> findNotConfirmedByUser(MagalieUser magalieUser, Building building) {
- Query query = entityManager.createQuery(
+ public List<E> findNotConfirmedByUser(MagalieUser magalieUser, Building building) {
+ TypedQuery<E> query = createQuery(
" select distinct smo" +
" from StorageMovementOrder smo" +
" inner join smo.storageMovements as sm" +
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -39,11 +39,11 @@
}
@Override
- public List<StoredArticle> findAllForArticleInBuilding(Article article, Building building) {
+ public List<E> findAllForArticleInBuilding(Article article, Building building) {
TypedQuery<E> query = createQuery("from StoredArticle sa where sa.article = :article and sa.location.warehouse.withdrawAllowed = true and sa.location.warehouse.building = :building");
query.setParameter("article", article);
query.setParameter("building", building);
- List<StoredArticle> resultList = (List<StoredArticle>) findAll(query);
+ List<E> resultList = findAll(query);
for (StoredArticle storedArticle : resultList) {
entityManager.detach(storedArticle);
}
@@ -51,11 +51,11 @@
}
@Override
- public List<StoredArticle> findAllReceivedForAllSupplier(Building building) {
+ public List<E> findAllReceivedForAllSupplier(Building building) {
TypedQuery<E> query = createQuery("from StoredArticle sa where sa.location.warehouse.building = :building and sa.location.code = :code");
query.setParameter("building", building);
query.setParameter("code", Locations.codeForReceptionLocations());
- List<StoredArticle> resultList = (List<StoredArticle>) findAll(query);
+ List<E> resultList = findAll(query);
for (StoredArticle storedArticle : resultList) {
entityManager.detach(storedArticle);
}
@@ -63,12 +63,12 @@
}
@Override
- public List<StoredArticle> findAllReceivedForSupplier(Building building, String supplierId) {
+ public List<E> findAllReceivedForSupplier(Building building, String supplierId) {
TypedQuery<E> query = createQuery("from StoredArticle sa where sa.location.warehouse.building = :building and sa.location.code = :code and sa.article.supplier.id = :supplierId");
query.setParameter("building", building);
query.setParameter("supplierId", supplierId);
query.setParameter("code", Locations.codeForReceptionLocations());
- List<StoredArticle> resultList = (List<StoredArticle>) findAll(query);
+ List<E> resultList = findAll(query);
for (StoredArticle storedArticle : resultList) {
entityManager.detach(storedArticle);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -40,11 +40,11 @@
}
@Override
- public List<Supplier> findAllWithReceivedArticles(Building building) {
+ public List<E> findAllWithReceivedArticles(Building building) {
TypedQuery<E> query = createQuery("select sa.article.supplier from StoredArticle sa where sa.location.code = :code and sa.location.warehouse.building = :building");
query.setParameter(Warehouse.PROPERTY_BUILDING, building);
query.setParameter(Location.PROPERTY_CODE, Locations.codeForReceptionLocations());
- return (List<Supplier>) findAll(query);
+ return findAll(query);
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -37,7 +37,7 @@
}
@Override
- public UnavailableArticle findByArticle(Building building, Article article) {
+ public E findByArticle(Building building, Article article) {
TypedQuery<E> query = createQuery("from UnavailableArticle ua where ua.article = :article and ua.building = :building");
query.setParameter(UnavailableArticle.PROPERTY_ARTICLE, article);
query.setParameter(UnavailableArticle.PROPERTY_BUILDING, building);
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -38,10 +38,10 @@
}
@Override
- public List<Warehouse> findAllWithoutLocations(Building building) {
- TypedQuery<E> query = entityManager.createQuery("from Warehouse w where w.building = :building and w in (select l.warehouse from Location l where l.code = :code)", getEntityClass());
+ public List<E> findAllWithoutLocations(Building building) {
+ TypedQuery<E> query = createQuery("from Warehouse w where w.building = :building and w in (select l.warehouse from Location l where l.code = :code)");
query.setParameter(Warehouse.PROPERTY_BUILDING, building);
query.setParameter(Warehouse.PROPERTY_CODE, Locations.codeForWarehouseWithoutLocations());
- return (List<Warehouse>) query.getResultList();
+ return query.getResultList();
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -26,8 +26,8 @@
import com.franciaflex.magalie.persistence.entity.Article;
/** @author bleny */
-public interface ArticleDao {
+public interface ArticleDao<E extends Article> {
- Article findByCode(String articleCode);
+ E findByCode(String articleCode);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -23,7 +23,9 @@
* #L%
*/
+import com.franciaflex.magalie.persistence.entity.Building;
+
/** @author bleny */
-public interface BuildingDao {
+public interface BuildingDao<E extends Building> {
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -30,10 +30,10 @@
import java.util.List;
/** @author bleny */
-public interface DeliveredRequestedArticleDao {
+public interface DeliveredRequestedArticleDao<E extends DeliveredRequestedArticle> {
- DeliveredRequestedArticle find(StorageMovementOrder storageMovementOrder);
+ E find(StorageMovementOrder storageMovementOrder);
- List<DeliveredRequestedArticle> findAll(RequestedList requestedList);
+ List<E> findAll(RequestedList requestedList);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -28,10 +28,10 @@
import com.franciaflex.magalie.persistence.entity.RequestedList;
/** @author bleny */
-public interface DeliveredRequestedListDao {
+public interface DeliveredRequestedListDao<E extends DeliveredRequestedList> {
- DeliveredRequestedList findByAffectedTo(MagalieUser affectedTo);
+ E findByAffectedTo(MagalieUser affectedTo);
- DeliveredRequestedList findByRequestedList(RequestedList requestedList);
+ E findByRequestedList(RequestedList requestedList);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -28,8 +28,8 @@
import com.franciaflex.magalie.persistence.entity.Warehouse;
/** @author bleny */
-public interface KanbanDao {
+public interface KanbanDao<E extends Kanban> {
- public Kanban find(Article article, Warehouse warehouse);
+ public E find(Article article, Warehouse warehouse);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -29,11 +29,11 @@
import java.util.List;
-public interface LocationDao {
+public interface LocationDao<E extends Location> {
- Location find(String code, Warehouse warehouse);
+ E find(String code, Warehouse warehouse);
- List<Location> findAllWithoutReception(Building building);
+ List<E> findAllWithoutReception(Building building);
- List<Location> findAllWithoutReception(Warehouse warehouse);
+ List<E> findAllWithoutReception(Warehouse warehouse);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -30,12 +30,12 @@
import java.util.List;
/** @author bleny */
-public interface LocationErrorDao {
+public interface LocationErrorDao<E extends LocationError> {
- LocationError findByLocation(Location location);
+ E findByLocation(Location location);
List<Location> getAllLocationsInError(Article article);
-// List<LocationError> findAll();
+ List<E> findAll();
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -25,11 +25,13 @@
import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import java.util.List;
+
/** @author bleny */
-public interface MagalieUserDao {
+public interface MagalieUserDao<E extends MagalieUser> {
- MagalieUser findByLogin(String login);
+ E findByLogin(String login);
-// List<MagalieUser> findAll();
+ List<E> findAll();
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -3,8 +3,7 @@
import com.franciaflex.magalie.persistence.entity.PreparedArticleReception;
/** @author bleny */
-public interface PreparedArticleReceptionDao {
+public interface PreparedArticleReceptionDao<E extends PreparedArticleReception> {
- PreparedArticleReception findByBarcode(String barcode);
-
+ E findByBarcode(String barcode);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -31,10 +31,10 @@
import java.util.List;
/** @author bleny */
-public interface RequestedArticleDao {
+public interface RequestedArticleDao<E extends RequestedArticle> {
- List<RequestedArticle> findAllUndelivered(Building building, MagalieUser affectedTo, String listType);
+ List<E> findAllUndelivered(Building building, MagalieUser affectedTo, String listType);
- List<RequestedArticle> findAll(RequestedList requestedList);
+ List<E> findAll(RequestedList requestedList);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -23,10 +23,12 @@
* #L%
*/
+import com.franciaflex.magalie.persistence.entity.RequestedList;
+
import java.util.List;
/** @author bleny */
-public interface RequestedListDao {
+public interface RequestedListDao<E extends RequestedList> {
List<String> findAllDistinctListTypes();
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -30,11 +30,11 @@
import java.util.List;
/** @author bleny */
-public interface StorageMovementDao {
+public interface StorageMovementDao <E extends StorageMovement>{
- List<StorageMovement> findAllByArticle(Article article);
+ List<E> findAllByArticle(Article article);
-// List<StorageMovement> findAll();
+ List<E> findAll();
- List<StorageMovement> findAllInReception(Building building);
+ List<E> findAllInReception(Building building);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -29,8 +29,8 @@
import java.util.List;
-public interface StorageMovementOrderDao {
+public interface StorageMovementOrderDao<E extends StorageMovementOrder> {
- public List<StorageMovementOrder> findNotConfirmedByUser(MagalieUser magalieUser, Building building);
+ public List<E> findNotConfirmedByUser(MagalieUser magalieUser, Building building);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -29,11 +29,11 @@
import java.util.List;
-public interface StoredArticleDao {
+public interface StoredArticleDao<E extends StoredArticle> {
- List<StoredArticle> findAllForArticleInBuilding(Article article, Building building);
+ List<E> findAllForArticleInBuilding(Article article, Building building);
- List<StoredArticle> findAllReceivedForAllSupplier(Building building);
+ List<E> findAllReceivedForAllSupplier(Building building);
- List<StoredArticle> findAllReceivedForSupplier(Building building, String supplierId);
+ List<E> findAllReceivedForSupplier(Building building, String supplierId);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -29,8 +29,8 @@
import java.util.List;
/** @author bleny */
-public interface SupplierDao {
+public interface SupplierDao<E extends Supplier> {
- List<Supplier> findAllWithReceivedArticles(Building building);
+ List<E> findAllWithReceivedArticles(Building building);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -28,8 +28,8 @@
import com.franciaflex.magalie.persistence.entity.UnavailableArticle;
/** @author bleny */
-public interface UnavailableArticleDao {
+public interface UnavailableArticleDao<E extends UnavailableArticle> {
- UnavailableArticle findByArticle(Building building, Article article);
+ E findByArticle(Building building, Article article);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java 2013-05-29 08:55:37 UTC (rev 207)
@@ -29,8 +29,8 @@
import java.util.List;
/** @author bleny */
-public interface WarehouseDao {
+public interface WarehouseDao<E extends Warehouse> {
- List<Warehouse> findAllWithoutLocations(Building building);
+ List<E> findAllWithoutLocations(Building building);
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/xmi/magalie.properties
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/xmi/magalie.properties 2013-05-29 07:29:15 UTC (rev 206)
+++ branches/magalie-eugene/magalie-persistence/src/main/xmi/magalie.properties 2013-05-29 08:55:37 UTC (rev 207)
@@ -1,8 +1,12 @@
com.franciaflex.magalie.persistence.entity.Article.attribute.fixedLocations.stereotype=unique
-com.franciaflex.magalie.persistence.entity.DeliveredRequestedArticle.class.stereotype=generatedValue
-com.franciaflex.magalie.persistence.entity.DeliveredRequestedList.class.stereotype=generatedValue
-com.franciaflex.magalie.persistence.entity.Kanban.class.stereotype=generatedValue
-com.franciaflex.magalie.persistence.entity.LocationError.class.stereotype=generatedValue
-com.franciaflex.magalie.persistence.entity.StorageMovement.class.stereotype=generatedValue
-com.franciaflex.magalie.persistence.entity.StorageMovementOrder.class.stereotype=generatedValue
-com.franciaflex.magalie.persistence.entity.UnavailableArticle.class.stereotype=generatedValue
+
+com.franciaflex.magalie.persistence.entity.Article.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.Building.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.Location.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.MagalieUser.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.PreparedArticleReception.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.RequestedArticle.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.RequestedList.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.StoredArticle.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.Supplier.class.stereotype=notGeneratedValue
+com.franciaflex.magalie.persistence.entity.Warehouse.class.stereotype=notGeneratedValue
1
0
29 May '13
Author: Bavencoff
Date: 2013-05-29 09:29:15 +0200 (Wed, 29 May 2013)
New Revision: 206
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : debug
Modified:
trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js
Modified: trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js
===================================================================
--- trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js 2013-05-29 07:23:59 UTC (rev 205)
+++ trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js 2013-05-29 07:29:15 UTC (rev 206)
@@ -26,7 +26,11 @@
$('#storage-transfer_quantity').next('span').text(model.getUnit());
},
+ refreshLocation : function() {
+ $('#storage-transfer_destinationBarCode').val('');
+ }
+
};
var controller = {
@@ -35,6 +39,7 @@
var StoredArticleId = $('input[type=radio][name=storedArticleId]:checked').attr('value');
model.setArticle(StoredArticleId);
view.refreshQuantity();
+ view.refreshLocation();
$('#storage-transfer_destinationBarCode').focus();
}
1
0
29 May '13
Author: Bavencoff
Date: 2013-05-29 09:23:59 +0200 (Wed, 29 May 2013)
New Revision: 205
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : debug
Modified:
trunk/magalie-web/src/main/webapp/js/magalie.js
Modified: trunk/magalie-web/src/main/webapp/js/magalie.js
===================================================================
--- trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-29 07:19:10 UTC (rev 204)
+++ trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-29 07:23:59 UTC (rev 205)
@@ -75,8 +75,7 @@
function bindKey(key, handler) {
$(document).keydown(function(event) {
if (event.which == KEYS[key] && !($(document.activeElement).is(":input") && SHORTCUTS.indexOf(key) >= 0)) {
- alert("Key : " + key + "\n is input ? " + $(document.activeElement).is(":input") + "\n shortcuts ? " + (SHORTCUTS.indexOf(key) >= 0));
- /*event.preventDefault();*/
+ event.preventDefault();
handler();
}
})
1
0
r204 - in trunk/magalie-web/src/main: java/com/franciaflex/magalie/web/action webapp/js
by Bavencoff@users.forge.codelutin.com 29 May '13
by Bavencoff@users.forge.codelutin.com 29 May '13
29 May '13
Author: Bavencoff
Date: 2013-05-29 09:19:10 +0200 (Wed, 29 May 2013)
New Revision: 204
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : user experience and debug
Modified:
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java
trunk/magalie-web/src/main/webapp/js/magalie.js
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java 2013-05-28 15:41:17 UTC (rev 203)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java 2013-05-29 07:19:10 UTC (rev 204)
@@ -83,6 +83,10 @@
return storedArticleId;
}
+ public double getQuantity() {
+ return quantity;
+ }
+
public void setStoredArticleId(String storedArticleId) {
this.storedArticleId = storedArticleId;
}
Modified: trunk/magalie-web/src/main/webapp/js/magalie.js
===================================================================
--- trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-28 15:41:17 UTC (rev 203)
+++ trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-29 07:19:10 UTC (rev 204)
@@ -74,8 +74,9 @@
function bindKey(key, handler) {
$(document).keydown(function(event) {
- if (event.which == KEYS[key] && !($(document.activeElement).is(":input") && SHORTCUTS.indexOf(KEYS[key]) >= 0)) {
- event.preventDefault();
+ if (event.which == KEYS[key] && !($(document.activeElement).is(":input") && SHORTCUTS.indexOf(key) >= 0)) {
+ alert("Key : " + key + "\n is input ? " + $(document.activeElement).is(":input") + "\n shortcuts ? " + (SHORTCUTS.indexOf(key) >= 0));
+ /*event.preventDefault();*/
handler();
}
})
1
0
r203 - in trunk/magalie-web/src/main/webapp: css js
by Bavencoff@users.forge.codelutin.com 28 May '13
by Bavencoff@users.forge.codelutin.com 28 May '13
28 May '13
Author: Bavencoff
Date: 2013-05-28 17:41:17 +0200 (Tue, 28 May 2013)
New Revision: 203
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : user experience
Modified:
trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css
trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js
Modified: trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css
===================================================================
--- trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css 2013-05-28 14:28:53 UTC (rev 202)
+++ trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css 2013-05-28 15:41:17 UTC (rev 203)
@@ -49,6 +49,17 @@
margin-left: 0px;
}
+label.radio {
+position:relative;
+
+}
+
+input.radio {
+ position:inherit;
+ margin-top: 0px;
+ height:auto;
+}
+
/*.controls {
margin-left: 30px;
}
Modified: trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js
===================================================================
--- trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js 2013-05-28 14:28:53 UTC (rev 202)
+++ trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js 2013-05-28 15:41:17 UTC (rev 203)
@@ -35,6 +35,7 @@
var StoredArticleId = $('input[type=radio][name=storedArticleId]:checked').attr('value');
model.setArticle(StoredArticleId);
view.refreshQuantity();
+ $('#storage-transfer_destinationBarCode').focus();
}
};
1
0
r202 - in trunk/magalie-web/src/main/webapp: WEB-INF/content css js
by Bavencoff@users.forge.codelutin.com 28 May '13
by Bavencoff@users.forge.codelutin.com 28 May '13
28 May '13
Author: Bavencoff
Date: 2013-05-28 16:28:53 +0200 (Tue, 28 May 2013)
New Revision: 202
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : user experience and debug
Modified:
trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp
trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css
trunk/magalie-web/src/main/webapp/js/magalie.js
Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp 2013-05-28 12:32:42 UTC (rev 201)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp 2013-05-28 14:28:53 UTC (rev 202)
@@ -21,14 +21,14 @@
</header>
-<s:form>
+<s:form cssClass="form-horizontal">
<s:hidden name="originId" value="%{origin.id}" />
- <s:radio name="storedArticleId" list="storedArticles" listKey="id" listValue="article.description + ' (' + article.code + ')'" />
+ <s:radio name="storedArticleId" list="storedArticles" listKey="id" listValue="article.description + ' (' + article.code + ')'" cssClass="radio" />
<s:textfield name="quantity" label="Qté" inputAppend="" type="number" step="any" min="0" cssClass="input-mini" />
- <s:textfield key="destinationBarCode" label="Emplacement de destination" inputAppendIcon="barcode" cssClass="input-medium" />
+ <s:textfield key="destinationBarCode" label="Destination" inputAppendIcon="barcode" cssClass="input-small" />
<div class="btn-group">
Modified: trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css
===================================================================
--- trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css 2013-05-28 12:32:42 UTC (rev 201)
+++ trunk/magalie-web/src/main/webapp/css/magalie-ck3x.css 2013-05-28 14:28:53 UTC (rev 202)
@@ -45,6 +45,14 @@
margin-left: 110px;
}
+.control-group.radio > .controls {
+ margin-left: 0px;
+}
+
+/*.controls {
+ margin-left: 30px;
+}
+*/
.btn-group {
margin-top: 3px;
position: absolute;
Modified: trunk/magalie-web/src/main/webapp/js/magalie.js
===================================================================
--- trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-28 12:32:42 UTC (rev 201)
+++ trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-28 14:28:53 UTC (rev 202)
@@ -74,7 +74,7 @@
function bindKey(key, handler) {
$(document).keydown(function(event) {
- if (event.which == KEYS[key] && !($(document.activeElement).is(":input") && SHORTCUTS.indexOf(KEYS[key]) >= O)) {
+ if (event.which == KEYS[key] && !($(document.activeElement).is(":input") && SHORTCUTS.indexOf(KEYS[key]) >= 0)) {
event.preventDefault();
handler();
}
1
0
r201 - trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service
by Bavencoff@users.forge.codelutin.com 28 May '13
by Bavencoff@users.forge.codelutin.com 28 May '13
28 May '13
Author: Bavencoff
Date: 2013-05-28 14:32:42 +0200 (Tue, 28 May 2013)
New Revision: 201
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : storage transfer
Modified:
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java 2013-05-28 12:09:11 UTC (rev 200)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java 2013-05-28 12:32:42 UTC (rev 201)
@@ -11,6 +11,7 @@
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import com.franciaflex.magalie.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -78,24 +79,15 @@
public StoredArticle findStoredArticle(String storedArticleId) {
+ Preconditions.checkArgument(storedArticleId != null);
+
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
StoredArticleDao storedArticleDao = persistenceContext.getStoredArticleDao();
- StoredArticle storedArticle;
+ StoredArticle storedArticle = storedArticleDao.findById(storedArticleId);
- try {
-
- storedArticle = storedArticleDao.findById(storedArticleId);
-
- } catch (Exception e) {
-
- storedArticle = null;
-
- }
-
- return storedArticle;
-
+ return storedArticle;
}
public void confirmStorageTransfer(MagalieUser magalieUser, StoredArticle storedArticle, double Quantity, Location destinationLocation ) {
1
0
r200 - in trunk: magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa magalie-services/src/main/java/com/franciaflex/magalie/services/service magalie-web/src/main/java/com/franciaflex/magalie/web/action magalie-web/src/main/webapp/WEB-INF/content magalie-web/src/main/webapp/js
by Bavencoff@users.forge.codelutin.com 28 May '13
by Bavencoff@users.forge.codelutin.com 28 May '13
28 May '13
Author: Bavencoff
Date: 2013-05-28 14:09:11 +0200 (Tue, 28 May 2013)
New Revision: 200
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : storage transfer
Added:
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java
trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp
trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp
trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js
Modified:
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/LocationJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java
trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp
trunk/magalie-web/src/main/webapp/js/magalie.js
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-27 21:29:10 UTC (rev 199)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -36,4 +36,6 @@
List<Location> findAllWithoutReception(Building building);
List<Location> findAllWithoutReception(Warehouse warehouse);
+
+ Location findByBarCode(String barCode);
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-27 21:29:10 UTC (rev 199)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import java.util.List;
@@ -39,4 +40,6 @@
StoredArticle findDetachedById(String storedArticleId);
+
+ List<StoredArticle> findAllByLocation(Location location);
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/LocationJpaDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/LocationJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/LocationJpaDao.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -87,4 +87,11 @@
public List<Location> findAllWithoutReception(Warehouse warehouse) {
return findAllWithoutReception(null, warehouse);
}
+
+ @Override
+ public Location findByBarCode(String barCode) {
+ TypedQuery<Location> query = createQuery("from Location l where CONCAT(l.warehouse.code, l.code) = :barCode");
+ query.setParameter("barCode", barCode);
+ return findUniqueOrNull(query);
+ }
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -27,6 +27,7 @@
import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import javax.persistence.EntityManager;
@@ -82,6 +83,17 @@
}
@Override
+ public List<StoredArticle> findAllByLocation(Location location) {
+ TypedQuery<StoredArticle> query = createQuery("from StoredArticle sa where sa.location = :location");
+ query.setParameter("location", location);
+ List<StoredArticle> resultList = findAll(query);
+ for (StoredArticle storedArticle : resultList) {
+ entityManager.detach(storedArticle);
+ }
+ return resultList;
+ }
+
+ @Override
public StoredArticle findDetachedById(String storedArticleId) {
StoredArticle storedArticle = findById(storedArticleId);
entityManager.detach(storedArticle);
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java 2013-05-27 21:29:10 UTC (rev 199)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -60,6 +60,7 @@
protected MagalieServiceContext serviceContext;
+ @Override
public void setServiceContext(MagalieServiceContext serviceContext) {
this.serviceContext = serviceContext;
}
Added: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java (rev 0)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -0,0 +1,129 @@
+package com.franciaflex.magalie.services.service;
+
+
+import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
+import com.franciaflex.magalie.persistence.dao.LocationDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
+import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
+import com.franciaflex.magalie.persistence.entity.Location;
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.StorageMovement;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+import com.franciaflex.magalie.services.MagalieService;
+import com.franciaflex.magalie.services.MagalieServiceContext;
+import com.google.common.collect.Lists;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Date;
+import java.util.LinkedList;
+import java.util.List;
+
+public class StorageTransferService implements MagalieService {
+
+ private static final Log log = LogFactory.getLog(StorageTransferService.class);
+
+ protected MagalieServiceContext serviceContext;
+
+ @Override
+ public void setServiceContext(MagalieServiceContext serviceContext) {
+ this.serviceContext = serviceContext;
+ }
+
+ public Location getLocationByBarCode(String barCode) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ LocationDao locationDao = persistenceContext.getLocationDao();
+
+ Location location = locationDao.findByBarCode(barCode);
+
+ return location;
+ }
+
+ public Location getLocationById(String id) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ LocationDao locationDao = persistenceContext.getLocationDao();
+
+ Location location = locationDao.findById(id);
+
+ return location;
+ }
+
+ public List<StoredArticle> getStoredArticlesInLocation(Location location) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ StoredArticleDao storedArticleDao = persistenceContext.getStoredArticleDao();
+
+ Iterable<StoredArticle > storedArticles = storedArticleDao.findAllByLocation(location);
+
+ ArticleStorageService articleStorageService = serviceContext.newService(ArticleStorageService.class);
+
+ StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+
+ List<StorageMovement> allImpactingStoredArticle = new LinkedList<StorageMovement>();
+
+ for (StoredArticle storedArticle : storedArticles) {
+ allImpactingStoredArticle.addAll(storageMovementDao.findAllImpactingStoredArticle(storedArticle));
+ }
+
+ storedArticles = articleStorageService.computeActualQuantities(storedArticles, allImpactingStoredArticle);
+
+ return Lists.newArrayList(storedArticles);
+ }
+
+
+ public StoredArticle findStoredArticle(String storedArticleId) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ StoredArticleDao storedArticleDao = persistenceContext.getStoredArticleDao();
+
+ StoredArticle storedArticle;
+
+ try {
+
+ storedArticle = storedArticleDao.findById(storedArticleId);
+
+ } catch (Exception e) {
+
+ storedArticle = null;
+
+ }
+
+ return storedArticle;
+
+ }
+
+ public void confirmStorageTransfer(MagalieUser magalieUser, StoredArticle storedArticle, double Quantity, Location destinationLocation ) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+
+ Date now = serviceContext.getNow();
+
+ StorageMovement storageMovement = new StorageMovement();
+
+ Location originLocation = storedArticle.getLocation();
+
+ storageMovement.setOriginLocation(originLocation);
+
+ storageMovement.setDestinationLocation(destinationLocation);
+
+ storageMovement.setMagalieUser(magalieUser);
+
+ storageMovement.setArticle(storedArticle.getArticle());
+
+ storageMovement.setActualQuantity(Quantity);
+
+ storageMovement.setConfirmDate(now);
+
+ storageMovementDao.persist(storageMovement);
+
+ persistenceContext.commit();
+ }
+}
Added: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java (rev 0)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -0,0 +1,152 @@
+package com.franciaflex.magalie.web.action;
+
+import com.franciaflex.magalie.persistence.entity.Location;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+import com.franciaflex.magalie.services.service.StorageTransferService;
+import com.franciaflex.magalie.web.MagalieActionSupport;
+import com.franciaflex.magalie.web.MagalieSession;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Result;
+import org.apache.struts2.convention.annotation.Results;
+import org.apache.struts2.json.JSONException;
+import org.apache.struts2.json.JSONUtil;
+
+import java.util.List;
+
+/**
+ * @author Bavencoff
+ */
+
+@Results({
+ @Result(name="success", type="redirectAction", params = { "actionName", "storage-transfer-location!input"})
+})
+public class StorageTransferAction extends MagalieActionSupport {
+
+ private static final Log log = LogFactory.getLog(StorageTransferAction.class);
+
+ protected MagalieSession session;
+
+ protected StorageTransferService service;
+
+ protected String originId;
+
+ protected Location origin;
+
+ protected List<StoredArticle> storedArticles;
+
+ protected String storedArticleId;
+
+ protected String destinationBarCode;
+
+ protected double quantity;
+
+ public void setService(StorageTransferService service) {
+ this.service = service;
+ }
+
+ public void setSession(MagalieSession session) {
+ this.session = session;
+ }
+
+ public void setOriginId(String originId) {
+ this.originId = originId;
+ }
+
+ @Override
+ public String input() {
+
+ origin = service.getLocationById(originId);
+
+ storedArticles = service.getStoredArticlesInLocation(origin);
+
+ return INPUT;
+ }
+
+ public Location getOrigin() {
+ return origin;
+ }
+
+ public List<StoredArticle> getStoredArticles() {
+ return storedArticles;
+ }
+
+ public String getModelAsJson() throws JSONException {
+
+ String json = JSONUtil.serialize(getStoredArticles());
+
+ return json;
+
+ }
+
+ public String getStoredArticleId() {
+ return storedArticleId;
+ }
+
+ public void setStoredArticleId(String storedArticleId) {
+ this.storedArticleId = storedArticleId;
+ }
+
+ public void setDestinationBarCode(String destinationBarCode) {
+ this.destinationBarCode = destinationBarCode;
+ }
+
+ public void setQuantity(double quantity) {
+ this.quantity = quantity;
+ }
+
+ @Override
+ public String execute() {
+
+ if (log.isDebugEnabled()) {
+ log.debug("originId : " + originId + "\n" +
+ "storedArticleId : " + storedArticleId + "\n" +
+ "quantity : " + quantity + "\n" +
+ "destinationBarCode : " + destinationBarCode);
+ }
+
+
+ origin = service.getLocationById(originId);
+
+ storedArticles = service.getStoredArticlesInLocation(origin);
+
+ if (storedArticleId == null) {
+ addFieldError("storedArticleId", "Sélectionnez un article");
+ return INPUT;
+ }
+
+ StoredArticle storedArticle = service.findStoredArticle(storedArticleId);
+
+ if (quantity == 0) {
+ addFieldError("quantity", "la quantité ne doit pas être nulle");
+ return INPUT;
+ }
+
+ if (quantity > storedArticle.getQuantity()) {
+ addFieldError("quantity", "Stock insuffisant");
+ return INPUT;
+ }
+
+ if (destinationBarCode.isEmpty()) {
+ addFieldError("destinationBarCode", "L'emplacement de destination doit être renseigné");
+ return INPUT;
+ }
+
+ Location destination = service.getLocationByBarCode(destinationBarCode);
+
+ if (destination == null) {
+ addFieldError("destinationBarCode", "Le code barre n'est pas un code valide");
+ return INPUT;
+ }
+
+ if (destination.equals(storedArticle.getLocation())) {
+ addFieldError("destinationBarCode", "la destination doit être différente de l'origine");
+ return INPUT;
+ }
+
+ service.confirmStorageTransfer(session.getMagalieUser(), storedArticle, quantity, destination);
+
+ return SUCCESS;
+ }
+
+}
Added: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java (rev 0)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java 2013-05-28 12:09:11 UTC (rev 200)
@@ -0,0 +1,77 @@
+package com.franciaflex.magalie.web.action;
+
+import com.franciaflex.magalie.persistence.entity.Location;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+import com.franciaflex.magalie.services.service.StorageTransferService;
+import com.franciaflex.magalie.web.MagalieActionSupport;
+import com.franciaflex.magalie.web.MagalieSession;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.apache.struts2.convention.annotation.Result;
+import org.apache.struts2.convention.annotation.Results;
+
+import java.util.List;
+
+/**
+ * @author Bavencoff
+ */
+
+@Results({
+ @Result(name="success", type="redirectAction", params = { "actionName", "storage-transfer!input", "originId", "${originId}" })
+})
+public class StorageTransferLocationAction extends MagalieActionSupport {
+
+ private static final Log log = LogFactory.getLog(StorageTransferAction.class);
+
+ protected MagalieSession session;
+
+ protected StorageTransferService service;
+
+ protected String originBarCode;
+
+ protected Location origin;
+
+ public void setService(StorageTransferService service) {
+ this.service = service;
+ }
+
+ public void setSession(MagalieSession session) {
+ this.session = session;
+ }
+
+ public void setOriginBarCode(String originBarCode) {
+ this.originBarCode = originBarCode;
+ }
+
+ @Override
+ public String execute() {
+
+ if (log.isDebugEnabled()) {
+ log.debug("origin BarCode : " + originBarCode);
+ }
+
+ origin = service.getLocationByBarCode(originBarCode);
+
+ if (origin == null) {
+ addFieldError("originBarCode", "Le code barre n'est pas un code valide");
+ return INPUT;
+ }
+
+ List<StoredArticle> storedArticles = service.getStoredArticlesInLocation(origin);
+
+ if (storedArticles.isEmpty()) {
+ addFieldError("originBarCode", "Aucun articles dans cet emplacement");
+ return INPUT;
+ }
+
+ return SUCCESS;
+ }
+
+ public String getOriginId() {
+ String originId = "";
+ if (origin != null) {
+ originId = origin.getId();
+ }
+ return originId;
+ }
+}
Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp 2013-05-27 21:29:10 UTC (rev 199)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp 2013-05-28 12:09:11 UTC (rev 200)
@@ -33,8 +33,9 @@
bindKey('2', function(){ redirectTo($('#deliverRequestedArticleLink'));});
bindKey('3', function(){ redirectTo($('#prepareArticleReceptionLink'));});
bindKey('4', function(){ redirectTo($('#preparePreparedArticleReceptionLink'));});
+ bindKey('5', function(){ redirectTo($('#storageTransferLink'));});
<s:if test="movementOrderResume" >
- bindKey('5', function(){ redirectTo($('#movementOrderResumeLink'));});
+ bindKey('6', function(){ redirectTo($('#movementOrderResumeLink'));});
</s:if>
bindKey('Esc', function(){ redirectTo($('#logoutLink'));});
});
@@ -62,11 +63,14 @@
<s:url namespace="/" action="prepare-prepared-article-reception!input" id="preparePreparedArticleReceptionUrl"/>
<s:a href="%{preparePreparedArticleReceptionUrl}" cssClass="btn btn-block" id="preparePreparedArticleReceptionLink" >Traiter les réceptions fournisseurs préparées (4)</s:a>
+<s:url namespace="/" action="storage-transfer-location!input" id="storageTransferUrl"/>
+<s:a href="%{storageTransferUrl}" cssClass="btn btn-block" id="storageTransferLink" >Transfert de stock (5)</s:a>
+
<s:if test="movementOrderResume" >
<s:url namespace="/" action="withdraw-item!input" id="movementOrderResumeUrl">
<s:param name="storageMovementOrderId" value="%{movementOrderResume.id}" />
</s:url>
- <s:a href="%{movementOrderResumeUrl}" cssClass="btn btn-block" id="movementOrderResumeLink" >Reprendre l'ordre de mouvement (5)</s:a>
+ <s:a href="%{movementOrderResumeUrl}" cssClass="btn btn-block" id="movementOrderResumeLink" >Reprendre l'ordre de mouvement (6)</s:a>
</s:if>
<s:url namespace="/" action="logout" id="logoutUrl"/>
Added: trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp (rev 0)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp 2013-05-28 12:09:11 UTC (rev 200)
@@ -0,0 +1,38 @@
+
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<head>
+ <title>Transfert de stock</title>
+ <script type="text/javascript">
+ var model = <s:property value="modelAsJson" escapeHtml="false" />;
+ </script>
+ <script src="<s:url value='/js/storage-transfer-input.js' />"></script>
+ <link rel="stylesheet" href="<s:url value='/css/magalie-ck3x-reduced.css' />"/>
+</head>
+
+<s:url namespace="/" action="choose-activity" id="cancelUrl" />
+
+<header>
+ <dl class="dl-horizontal">
+ <dt>Source</dt>
+ <dd><s:property value="origin.warehouse.code + origin.code" /></dd>
+ </dl>
+</header>
+
+
+<s:form>
+ <s:hidden name="originId" value="%{origin.id}" />
+
+ <s:radio name="storedArticleId" list="storedArticles" listKey="id" listValue="article.description + ' (' + article.code + ')'" />
+
+ <s:textfield name="quantity" label="Qté" inputAppend="" type="number" step="any" min="0" cssClass="input-mini" />
+
+ <s:textfield key="destinationBarCode" label="Emplacement de destination" inputAppendIcon="barcode" cssClass="input-medium" />
+
+
+ <div class="btn-group">
+ <s:a href="%{cancelUrl}" cssClass="btn" id="CancelLink" >Quitter (Esc)</s:a>
+ <s:submit name="" value="Valider" cssClass="btn btn-primary" />
+ </div>
+</s:form>
\ No newline at end of file
Added: trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp (rev 0)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp 2013-05-28 12:09:11 UTC (rev 200)
@@ -0,0 +1,24 @@
+
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<head>
+ <title>Transfert de stock</title>
+ <script type="text/javascript">
+ $(document).ready(function () {
+ $("#storage-transfer-location_originBarCode").focus();
+ bindKey('Esc', function(){ redirectTo($('#chooseActivityLink'));});
+ });
+ </script>
+</head>
+
+<s:url namespace="/" action="choose-activity" id="chooseActivityUrl"/>
+
+<s:form>
+ <s:textfield key="originBarCode" label="Emplacement de prélévement" inputAppendIcon="barcode" cssClass="input-medium" />
+
+ <div class="btn-group">
+ <s:a href="%{chooseActivityUrl}" cssClass="btn" id="chooseActivityLink" >Changer d'activité (Esc)</s:a>
+ <s:submit name="next" value="Suivant" cssClass="btn btn-primary" />
+ </div>
+</s:form>
\ No newline at end of file
Modified: trunk/magalie-web/src/main/webapp/js/magalie.js
===================================================================
--- trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-27 21:29:10 UTC (rev 199)
+++ trunk/magalie-web/src/main/webapp/js/magalie.js 2013-05-28 12:09:11 UTC (rev 200)
@@ -74,7 +74,7 @@
function bindKey(key, handler) {
$(document).keydown(function(event) {
- if (event.which == KEYS[key]) {
+ if (event.which == KEYS[key] && !($(document.activeElement).is(":input") && SHORTCUTS.indexOf(KEYS[key]) >= O)) {
event.preventDefault();
handler();
}
Added: trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js
===================================================================
--- trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js (rev 0)
+++ trunk/magalie-web/src/main/webapp/js/storage-transfer-input.js 2013-05-28 12:09:11 UTC (rev 200)
@@ -0,0 +1,52 @@
+
+model.storedArticleIndex = 0;
+
+model.setArticle = function(StorageArticleId) {
+ for (var i = 0; i < this.length; i++) {
+ if (this[i].id == StorageArticleId) {
+ model.storedArticleIndex = i;
+ }
+ }
+ return this.storedArticleIndex;
+};
+
+model.getQuantity = function() {
+ return this[this.storedArticleIndex].quantity;
+};
+
+model.getUnit = function() {
+ return this[this.storedArticleIndex].article.unit;
+
+};
+
+var view = {
+
+ refreshQuantity : function() {
+ $('#storage-transfer_quantity').val(model.getQuantity());
+ $('#storage-transfer_quantity').next('span').text(model.getUnit());
+ },
+
+
+};
+
+var controller = {
+
+ onChangeArticle : function () {
+ var StoredArticleId = $('input[type=radio][name=storedArticleId]:checked').attr('value');
+ model.setArticle(StoredArticleId);
+ view.refreshQuantity();
+ }
+
+};
+
+$(document).ready(function () {
+ var inputRadios = $("input[name='storedArticleId']") ;
+ $.each(inputRadios, function(index, radio) {
+ if (index < SHORTCUTS.length) {
+ $(radio).parent().append(" (" + SHORTCUTS[index] + ")")
+ bindKey(SHORTCUTS[index], function(){ $(radio).click();});
+ }
+ });
+ $('input[type=radio][name=storedArticleId]').change(controller.onChangeArticle);
+ bindKey('Esc', function(){ redirectTo($('#CancelLink'));});
+});
\ No newline at end of file
1
0
r199 - in branches/magalie-eugene: magalie-persistence/src/main/java/com/franciaflex/magalie/persistence magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao magalie-services/src/main/java/com/franciaflex/magalie/services/service magalie-services/src/test/java/com/franciaflex/magalie/services/service
by tchemit@users.forge.codelutin.com 27 May '13
by tchemit@users.forge.codelutin.com 27 May '13
27 May '13
Author: tchemit
Date: 2013-05-27 23:29:10 +0200 (Mon, 27 May 2013)
New Revision: 199
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
review persistence api
Added:
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java
Removed:
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java
Modified:
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java
branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -23,27 +23,25 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.dao.ArticleDao;
-import com.franciaflex.magalie.persistence.dao.BuildingDao;
-import com.franciaflex.magalie.persistence.dao.DeliveredRequestedArticleDao;
-import com.franciaflex.magalie.persistence.dao.DeliveredRequestedListDao;
-import com.franciaflex.magalie.persistence.dao.KanbanDao;
-import com.franciaflex.magalie.persistence.dao.LocationDao;
-import com.franciaflex.magalie.persistence.dao.LocationErrorDao;
-import com.franciaflex.magalie.persistence.dao.MagalieUserDao;
-import com.franciaflex.magalie.persistence.dao.PreparedArticleReceptionDao;
-import com.franciaflex.magalie.persistence.dao.RequestedArticleDao;
-import com.franciaflex.magalie.persistence.dao.RequestedListDao;
-import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
-import com.franciaflex.magalie.persistence.dao.StorageMovementOrderDao;
-import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
-import com.franciaflex.magalie.persistence.dao.SupplierDao;
-import com.franciaflex.magalie.persistence.dao.UnavailableArticleDao;
-import com.franciaflex.magalie.persistence.dao.WarehouseDao;
+import com.franciaflex.magalie.persistence.dao.ArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.BuildingJpaDao;
+import com.franciaflex.magalie.persistence.dao.DeliveredRequestedArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.DeliveredRequestedListJpaDao;
+import com.franciaflex.magalie.persistence.dao.KanbanJpaDao;
+import com.franciaflex.magalie.persistence.dao.LocationErrorJpaDao;
+import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
+import com.franciaflex.magalie.persistence.dao.MagalieUserJpaDao;
+import com.franciaflex.magalie.persistence.dao.PreparedArticleReceptionJpaDao;
+import com.franciaflex.magalie.persistence.dao.RequestedArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.RequestedListJpaDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementJpaDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementOrderJpaDao;
+import com.franciaflex.magalie.persistence.dao.StoredArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.SupplierJpaDao;
+import com.franciaflex.magalie.persistence.dao.UnavailableArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.WarehouseJpaDao;
-/**
- * @author bleny
- */
+/** @author bleny */
public interface MagaliePersistenceContext {
void commit();
@@ -52,38 +50,38 @@
void clearDatabase();
- MagalieUserDao getMagalieUserDao();
+ MagalieUserJpaDao getMagalieUserDao();
- StoredArticleDao getStoredArticleDao();
+ StoredArticleJpaDao getStoredArticleDao();
- RequestedArticleDao getRequestedArticleDao();
+ RequestedArticleJpaDao getRequestedArticleDao();
- ArticleDao getArticleDao();
+ ArticleJpaDao getArticleDao();
- StorageMovementDao getStorageMovementDao();
+ StorageMovementJpaDao getStorageMovementDao();
- LocationErrorDao getLocationErrorDao();
+ LocationErrorJpaDao getLocationErrorDao();
- StorageMovementOrderDao getStorageMovementOrderDao();
+ StorageMovementOrderJpaDao getStorageMovementOrderDao();
- LocationDao getLocationDao();
+ LocationJpaDao getLocationDao();
- DeliveredRequestedArticleDao getDeliveredRequestedArticleDao();
+ DeliveredRequestedArticleJpaDao getDeliveredRequestedArticleDao();
- BuildingDao getBuildingDao();
+ BuildingJpaDao getBuildingDao();
- WarehouseDao getWarehouseDao();
+ WarehouseJpaDao getWarehouseDao();
- RequestedListDao getRequestedListDao();
+ RequestedListJpaDao getRequestedListDao();
- DeliveredRequestedListDao getDeliveredRequestedListDao();
+ DeliveredRequestedListJpaDao getDeliveredRequestedListDao();
- KanbanDao getKanbanDao();
+ KanbanJpaDao getKanbanDao();
- SupplierDao getSupplierDao();
+ SupplierJpaDao getSupplierDao();
- UnavailableArticleDao getUnavailableArticleDao();
+ UnavailableArticleJpaDao getUnavailableArticleDao();
- PreparedArticleReceptionDao getPreparedArticleReceptionDao();
+ PreparedArticleReceptionJpaDao getPreparedArticleReceptionDao();
}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,43 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.Article;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+
+public class AbstractArticleJpaDao<E extends Article> extends GeneratedArticleJpaDao<E> {
+
+ public AbstractArticleJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public Article findByCode(String articleCode) {
+ TypedQuery<E> query = createQuery("from Article a where a.code = :code");
+ query.setParameter(Article.PROPERTY_CODE, articleCode);
+ return findUniqueOrNull(query);
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,57 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.DeliveredRequestedArticle;
+import com.franciaflex.magalie.persistence.entity.RequestedList;
+import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractDeliveredRequestedArticleJpaDao<E extends DeliveredRequestedArticle> extends GeneratedDeliveredRequestedArticleJpaDao<E> {
+
+ public AbstractDeliveredRequestedArticleJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public DeliveredRequestedArticle find(StorageMovementOrder storageMovementOrder) {
+ TypedQuery<E> query =
+ entityManager.createQuery(
+ "from DeliveredRequestedArticle dra where dra.storageMovementOrder = :storageMovementOrder", getEntityClass());
+ query.setParameter("storageMovementOrder", storageMovementOrder);
+ return findUniqueOrNull(query);
+ }
+
+ @Override
+ public List<DeliveredRequestedArticle> findAll(RequestedList requestedList) {
+ TypedQuery<E> query =
+ entityManager.createQuery(
+ "from DeliveredRequestedArticle dra where dra.requestedArticle.requestedList = :requestedList", getEntityClass());
+ query.setParameter("requestedList", requestedList);
+ return (List<DeliveredRequestedArticle>) findAll(query);
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractDeliveredRequestedListJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,65 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.DeliveredRequestedList;
+import com.franciaflex.magalie.persistence.entity.DeliveredRequestedListStatus;
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.RequestedList;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+
+public class AbstractDeliveredRequestedListJpaDao<E extends DeliveredRequestedList> extends GeneratedDeliveredRequestedListJpaDao<E> {
+
+ public AbstractDeliveredRequestedListJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public DeliveredRequestedList findByAffectedTo(MagalieUser affectedTo) {
+
+ TypedQuery<E> query = createQuery(
+ "from DeliveredRequestedList drl where drl.status = :affected and drl.affectedTo = :affectedTo");
+
+ query.setParameter("affectedTo", affectedTo);
+
+ query.setParameter("affected", DeliveredRequestedListStatus.AFFECTED);
+
+ return findUniqueOrNull(query);
+
+ }
+
+ @Override
+ public DeliveredRequestedList findByRequestedList(RequestedList requestedList) {
+
+ TypedQuery<E> query = createQuery(
+ "from DeliveredRequestedList drl where drl.requestedList = :requestedList");
+
+ query.setParameter("requestedList", requestedList);
+
+ return findUniqueOrNull(query);
+
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractKanbanJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,46 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Kanban;
+import com.franciaflex.magalie.persistence.entity.Warehouse;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+
+public class AbstractKanbanJpaDao<E extends Kanban> extends GeneratedKanbanJpaDao<E> {
+
+ public AbstractKanbanJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public Kanban find(Article article, Warehouse warehouse) {
+ TypedQuery<E> query = entityManager.createQuery("from Kanban k where k.article = :article and k.warehouse = :warehouse", getEntityClass());
+ query.setParameter("article", article);
+ query.setParameter("warehouse", warehouse);
+ return query.getSingleResult();
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationErrorJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,62 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Location;
+import com.franciaflex.magalie.persistence.entity.LocationError;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractLocationErrorJpaDao<E extends LocationError> extends GeneratedLocationErrorJpaDao<E> {
+
+ public AbstractLocationErrorJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public LocationError findByLocation(Location location) {
+ TypedQuery<E> query = createQuery("from LocationError se where se.location = :location");
+ query.setParameter("location", location);
+ return findUniqueOrNull(query);
+ }
+
+ @Override
+ public List<Location> getAllLocationsInError(Article article) {
+ Query query = entityManager.createQuery("select se.location from LocationError se where se.article = :article");
+ query.setParameter("article", article);
+ List<Location> allLocationsInError = query.getResultList();
+ return allLocationsInError;
+ }
+
+ @Override
+ public List<E> findAll() {
+ Query query = entityManager.createQuery("from LocationError se order by se.reportDate");
+ List<E> all = query.getResultList();
+ return all;
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractLocationJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,84 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.Locations;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Location;
+import com.franciaflex.magalie.persistence.entity.Warehouse;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractLocationJpaDao<E extends Location> extends GeneratedLocationJpaDao<E> {
+
+ public AbstractLocationJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public Location find(String code, Warehouse warehouse) {
+ TypedQuery<E> query = createQuery("from Location l where l.code = :code and l.warehouse = :warehouse");
+ query.setParameter("code", code);
+ query.setParameter("warehouse", warehouse);
+ return findUnique(query);
+ }
+
+ protected List<Location> findAllWithoutReception(Building building, Warehouse warehouse) {
+ boolean filterOnBuilding = building != null;
+ boolean filterOnWarehouse = warehouse != null;
+ String hql = " from Location l where";
+ if (filterOnBuilding) {
+ hql += " l.warehouse.building = :building and ";
+ }
+ if (filterOnWarehouse) {
+ hql += " l.warehouse = :warehouse and ";
+ }
+ hql += " l.code != :codeForReceptionLocations and "
+ + " l.code != :codeForWarehouseWithoutLocations and "
+ + " l.fullLocation = false "
+ + " order by l.warehouse.building.code, l.warehouse.code, l.code";
+ TypedQuery<E> query = createQuery(hql);
+ if (filterOnBuilding) {
+ query.setParameter("building", building);
+ }
+ if (filterOnWarehouse) {
+ query.setParameter("warehouse", warehouse);
+ }
+ query.setParameter("codeForReceptionLocations", Locations.codeForReceptionLocations());
+ query.setParameter("codeForWarehouseWithoutLocations", Locations.codeForWarehouseWithoutLocations());
+ return (List<Location>) findAll(query);
+ }
+
+ @Override
+ public List<Location> findAllWithoutReception(Building building) {
+ return findAllWithoutReception(building, null);
+ }
+
+ @Override
+ public List<Location> findAllWithoutReception(Warehouse warehouse) {
+ return findAllWithoutReception(null, warehouse);
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractMagalieUserJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,52 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractMagalieUserJpaDao<E extends MagalieUser> extends GeneratedMagalieUserJpaDao<E> {
+
+ public AbstractMagalieUserJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public MagalieUser findByLogin(String login) {
+ TypedQuery<E> query = createQuery("from MagalieUser mu where mu.login = :login");
+ query.setParameter("login", login);
+ return findUnique(query);
+ }
+
+ @Override
+ public List<E> findAll() {
+ Query query = entityManager.createQuery("from MagalieUser mu order by mu.login");
+ List<E> resultList = query.getResultList();
+ return resultList;
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractPreparedArticleReceptionJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,20 @@
+package com.franciaflex.magalie.persistence.dao;
+
+import com.franciaflex.magalie.persistence.entity.PreparedArticleReception;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+
+public class AbstractPreparedArticleReceptionJpaDao<E extends PreparedArticleReception> extends GeneratedPreparedArticleReceptionJpaDao<E> {
+
+ public AbstractPreparedArticleReceptionJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public PreparedArticleReception findByBarcode(String barcode) {
+ TypedQuery<E> query = createQuery("from PreparedArticleReception par where par.barcode = :barcode");
+ query.setParameter("barcode", barcode);
+ return findUniqueOrNull(query);
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,65 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.DeliveredRequestedListStatus;
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.RequestedArticle;
+import com.franciaflex.magalie.persistence.entity.RequestedList;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractRequestedArticleJpaDao<E extends RequestedArticle> extends GeneratedRequestedArticleJpaDao<E> {
+
+ public AbstractRequestedArticleJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<RequestedArticle> findAllUndelivered(Building building, MagalieUser affectedTo, String listType) {
+ TypedQuery<E> query = createQuery(
+ "from RequestedArticle ra where "
+ + " ra not in (select dra.requestedArticle from DeliveredRequestedArticle dra) "
+ + " and ra.requestedList.building = :building "
+ + " and ra.requestedList.listType = :listType "
+ + " and ra.requestedList not in (select drl.requestedList from DeliveredRequestedList drl where drl.status = :complete or drl.status = :affected and drl.affectedTo != :affectedTo)");
+ query.setParameter("building", building);
+ query.setParameter("listType", listType);
+ query.setParameter("complete", DeliveredRequestedListStatus.COMPLETE);
+ query.setParameter("affected", DeliveredRequestedListStatus.AFFECTED);
+ query.setParameter("affectedTo", affectedTo);
+ return (List<RequestedArticle>) findAll(query);
+ }
+
+ @Override
+ public List<RequestedArticle> findAll(RequestedList requestedList) {
+ TypedQuery<E> query = createQuery("from RequestedArticle ra where ra.requestedList = :requestedList");
+ query.setParameter("requestedList", requestedList);
+ return (List<RequestedArticle>) findAll(query);
+ }
+
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractRequestedListJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,43 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.RequestedList;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractRequestedListJpaDao<E extends RequestedList> extends GeneratedRequestedListJpaDao<E> {
+
+ public AbstractRequestedListJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<String> findAllDistinctListTypes() {
+ TypedQuery<String> query = entityManager.createQuery("select distinct rl.listType from RequestedList rl", String.class);
+ return query.getResultList();
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,65 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.Locations;
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.StorageMovement;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.List;
+
+public class AbstractStorageMovementJpaDao<E extends StorageMovement> extends GeneratedStorageMovementJpaDao<E> {
+
+ public AbstractStorageMovementJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<StorageMovement> findAllByArticle(Article article) {
+ Query query = entityManager.createQuery("from StorageMovement sm where sm.article = :article");
+ query.setParameter("article", article);
+ return query.getResultList();
+ }
+
+ @Override
+ public List<StorageMovement> findAllInReception(Building building) {
+ Query query = entityManager.createQuery(
+ " from StorageMovement sm" +
+ " where sm.originLocation.code = :codeForReceptionLocations and sm.originLocation.warehouse.building = :building" +
+ " or " +
+ " sm.destinationLocation.code = :codeForReceptionLocations and sm.destinationLocation.warehouse.building = :building");
+ query.setParameter("building", building);
+ query.setParameter("codeForReceptionLocations", Locations.codeForReceptionLocations());
+ return query.getResultList();
+ }
+
+ @Override
+ public List<E> findAll() {
+ Query query = entityManager.createQuery("from StorageMovement sm order by sm.orderDate");
+ return query.getResultList();
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStorageMovementOrderJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,53 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.List;
+
+public class AbstractStorageMovementOrderJpaDao<E extends StorageMovementOrder> extends GeneratedStorageMovementOrderJpaDao<E> {
+
+ public AbstractStorageMovementOrderJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<StorageMovementOrder> findNotConfirmedByUser(MagalieUser magalieUser, Building building) {
+ Query query = entityManager.createQuery(
+ " select distinct smo" +
+ " from StorageMovementOrder smo" +
+ " inner join smo.storageMovements as sm" +
+ " where sm.magalieUser = :magalieUser" +
+ " and sm.originLocation.warehouse.building = :building" +
+ " and sm.confirmDate is null");
+ query.setParameter("magalieUser", magalieUser);
+ query.setParameter("building", building);
+ return query.getResultList();
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractStoredArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,77 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.Locations;
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractStoredArticleJpaDao<E extends StoredArticle> extends GeneratedStoredArticleJpaDao<E> {
+
+ public AbstractStoredArticleJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<StoredArticle> findAllForArticleInBuilding(Article article, Building building) {
+ TypedQuery<E> query = createQuery("from StoredArticle sa where sa.article = :article and sa.location.warehouse.withdrawAllowed = true and sa.location.warehouse.building = :building");
+ query.setParameter("article", article);
+ query.setParameter("building", building);
+ List<StoredArticle> resultList = (List<StoredArticle>) findAll(query);
+ for (StoredArticle storedArticle : resultList) {
+ entityManager.detach(storedArticle);
+ }
+ return resultList;
+ }
+
+ @Override
+ public List<StoredArticle> findAllReceivedForAllSupplier(Building building) {
+ TypedQuery<E> query = createQuery("from StoredArticle sa where sa.location.warehouse.building = :building and sa.location.code = :code");
+ query.setParameter("building", building);
+ query.setParameter("code", Locations.codeForReceptionLocations());
+ List<StoredArticle> resultList = (List<StoredArticle>) findAll(query);
+ for (StoredArticle storedArticle : resultList) {
+ entityManager.detach(storedArticle);
+ }
+ return resultList;
+ }
+
+ @Override
+ public List<StoredArticle> findAllReceivedForSupplier(Building building, String supplierId) {
+ TypedQuery<E> query = createQuery("from StoredArticle sa where sa.location.warehouse.building = :building and sa.location.code = :code and sa.article.supplier.id = :supplierId");
+ query.setParameter("building", building);
+ query.setParameter("supplierId", supplierId);
+ query.setParameter("code", Locations.codeForReceptionLocations());
+ List<StoredArticle> resultList = (List<StoredArticle>) findAll(query);
+ for (StoredArticle storedArticle : resultList) {
+ entityManager.detach(storedArticle);
+ }
+ return resultList;
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractSupplierJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,50 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.Locations;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Location;
+import com.franciaflex.magalie.persistence.entity.Supplier;
+import com.franciaflex.magalie.persistence.entity.Warehouse;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractSupplierJpaDao<E extends Supplier> extends GeneratedSupplierJpaDao<E> {
+
+ public AbstractSupplierJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<Supplier> findAllWithReceivedArticles(Building building) {
+ TypedQuery<E> query = createQuery("select sa.article.supplier from StoredArticle sa where sa.location.code = :code and sa.location.warehouse.building = :building");
+ query.setParameter(Warehouse.PROPERTY_BUILDING, building);
+ query.setParameter(Location.PROPERTY_CODE, Locations.codeForReceptionLocations());
+ return (List<Supplier>) findAll(query);
+ }
+
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractUnavailableArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,46 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.UnavailableArticle;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+
+public class AbstractUnavailableArticleJpaDao<E extends UnavailableArticle> extends GeneratedUnavailableArticleJpaDao<E> {
+
+ public AbstractUnavailableArticleJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public UnavailableArticle findByArticle(Building building, Article article) {
+ TypedQuery<E> query = createQuery("from UnavailableArticle ua where ua.article = :article and ua.building = :building");
+ query.setParameter(UnavailableArticle.PROPERTY_ARTICLE, article);
+ query.setParameter(UnavailableArticle.PROPERTY_BUILDING, building);
+ return findUniqueOrNull(query);
+ }
+}
Copied: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java (from rev 198, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java)
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java (rev 0)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/AbstractWarehouseJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -0,0 +1,47 @@
+package com.franciaflex.magalie.persistence.dao;
+
+/*
+ * #%L
+ * MagaLiE :: Persistence
+ * $Id:$
+ * $HeadURL:$
+ * %%
+ * Copyright (C) 2013 CodeLutin
+ * %%
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published by
+ * the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see <http://www.gnu.org/licenses/>.
+ * #L%
+ */
+
+import com.franciaflex.magalie.persistence.Locations;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Warehouse;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class AbstractWarehouseJpaDao<E extends Warehouse> extends GeneratedWarehouseJpaDao<E> {
+
+ public AbstractWarehouseJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<Warehouse> findAllWithoutLocations(Building building) {
+ TypedQuery<E> query = entityManager.createQuery("from Warehouse w where w.building = :building and w in (select l.warehouse from Location l where l.code = :code)", getEntityClass());
+ query.setParameter(Warehouse.PROPERTY_BUILDING, building);
+ query.setParameter(Warehouse.PROPERTY_CODE, Locations.codeForWarehouseWithoutLocations());
+ return (List<Warehouse>) query.getResultList();
+ }
+}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -24,12 +24,9 @@
*/
import com.franciaflex.magalie.persistence.entity.Article;
-import org.nuiton.jpa.api.JpaDao;
-/**
- * @author bleny
- */
-public interface ArticleDao extends JpaDao<Article> {
+/** @author bleny */
+public interface ArticleDao {
Article findByCode(String articleCode);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,43 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.Article;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-public class ArticleJpaDao extends AbstractArticleJpaDao<Article> implements ArticleDao {
-
- public ArticleJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public Article findByCode(String articleCode) {
- TypedQuery<Article> query = createQuery("from Article a where a.code = :code");
- query.setParameter(Article.PROPERTY_CODE, articleCode);
- return findUniqueOrNull(query);
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -23,12 +23,7 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.entity.Building;
-import org.nuiton.jpa.api.JpaDao;
+/** @author bleny */
+public interface BuildingDao {
-/**
- * @author bleny
- */
-public interface BuildingDao extends JpaDao<Building> {
-
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,14 +26,11 @@
import com.franciaflex.magalie.persistence.entity.DeliveredRequestedArticle;
import com.franciaflex.magalie.persistence.entity.RequestedList;
import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-/**
- * @author bleny
- */
-public interface DeliveredRequestedArticleDao extends JpaDao<DeliveredRequestedArticle> {
+/** @author bleny */
+public interface DeliveredRequestedArticleDao {
DeliveredRequestedArticle find(StorageMovementOrder storageMovementOrder);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,57 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.DeliveredRequestedArticle;
-import com.franciaflex.magalie.persistence.entity.RequestedList;
-import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class DeliveredRequestedArticleJpaDao extends AbstractDeliveredRequestedArticleJpaDao<DeliveredRequestedArticle> implements DeliveredRequestedArticleDao{
-
- public DeliveredRequestedArticleJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public DeliveredRequestedArticle find(StorageMovementOrder storageMovementOrder) {
- TypedQuery<DeliveredRequestedArticle> query =
- entityManager.createQuery(
- "from DeliveredRequestedArticle dra where dra.storageMovementOrder = :storageMovementOrder", getEntityClass());
- query.setParameter("storageMovementOrder", storageMovementOrder);
- return findUniqueOrNull(query);
- }
-
- @Override
- public List<DeliveredRequestedArticle> findAll(RequestedList requestedList) {
- TypedQuery<DeliveredRequestedArticle> query =
- entityManager.createQuery(
- "from DeliveredRequestedArticle dra where dra.requestedArticle.requestedList = :requestedList", getEntityClass());
- query.setParameter("requestedList", requestedList);
- return findAll(query);
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,12 +26,9 @@
import com.franciaflex.magalie.persistence.entity.DeliveredRequestedList;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.RequestedList;
-import org.nuiton.jpa.api.JpaDao;
-/**
- * @author bleny
- */
-public interface DeliveredRequestedListDao extends JpaDao<DeliveredRequestedList> {
+/** @author bleny */
+public interface DeliveredRequestedListDao {
DeliveredRequestedList findByAffectedTo(MagalieUser affectedTo);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,65 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.DeliveredRequestedList;
-import com.franciaflex.magalie.persistence.entity.DeliveredRequestedListStatus;
-import com.franciaflex.magalie.persistence.entity.MagalieUser;
-import com.franciaflex.magalie.persistence.entity.RequestedList;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-public class DeliveredRequestedListJpaDao extends AbstractDeliveredRequestedListJpaDao<DeliveredRequestedList> implements DeliveredRequestedListDao{
-
- public DeliveredRequestedListJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public DeliveredRequestedList findByAffectedTo(MagalieUser affectedTo) {
-
- TypedQuery<DeliveredRequestedList> query = createQuery(
- "from DeliveredRequestedList drl where drl.status = :affected and drl.affectedTo = :affectedTo");
-
- query.setParameter("affectedTo", affectedTo);
-
- query.setParameter("affected", DeliveredRequestedListStatus.AFFECTED);
-
- return findUniqueOrNull(query);
-
- }
-
- @Override
- public DeliveredRequestedList findByRequestedList(RequestedList requestedList) {
-
- TypedQuery<DeliveredRequestedList> query = createQuery(
- "from DeliveredRequestedList drl where drl.requestedList = :requestedList");
-
- query.setParameter("requestedList", requestedList);
-
- return findUniqueOrNull(query);
-
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,12 +26,9 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Kanban;
import com.franciaflex.magalie.persistence.entity.Warehouse;
-import org.nuiton.jpa.api.JpaDao;
-/**
- * @author bleny
- */
-public interface KanbanDao extends JpaDao<Kanban> {
+/** @author bleny */
+public interface KanbanDao {
public Kanban find(Article article, Warehouse warehouse);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,46 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.Article;
-import com.franciaflex.magalie.persistence.entity.Kanban;
-import com.franciaflex.magalie.persistence.entity.Warehouse;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-public class KanbanJpaDao extends AbstractKanbanJpaDao<Kanban> implements KanbanDao{
-
- public KanbanJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public Kanban find(Article article, Warehouse warehouse) {
- TypedQuery<Kanban> query = entityManager.createQuery("from Kanban k where k.article = :article and k.warehouse = :warehouse", getEntityClass());
- query.setParameter("article", article);
- query.setParameter("warehouse", warehouse);
- return query.getSingleResult();
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,11 +26,10 @@
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.Warehouse;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-public interface LocationDao extends JpaDao<Location> {
+public interface LocationDao {
Location find(String code, Warehouse warehouse);
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,19 +26,16 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.LocationError;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-/**
- * @author bleny
- */
-public interface LocationErrorDao extends JpaDao<LocationError> {
+/** @author bleny */
+public interface LocationErrorDao {
LocationError findByLocation(Location location);
List<Location> getAllLocationsInError(Article article);
- List<LocationError> findAll();
+// List<LocationError> findAll();
}
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,62 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.Article;
-import com.franciaflex.magalie.persistence.entity.Location;
-import com.franciaflex.magalie.persistence.entity.LocationError;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class LocationErrorJpaDao extends AbstractLocationErrorJpaDao<LocationError> implements LocationErrorDao{
-
- public LocationErrorJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public LocationError findByLocation(Location location) {
- TypedQuery<LocationError> query = createQuery("from LocationError se where se.location = :location");
- query.setParameter("location", location);
- return findUniqueOrNull(query);
- }
-
- @Override
- public List<Location> getAllLocationsInError(Article article) {
- Query query = entityManager.createQuery("select se.location from LocationError se where se.article = :article");
- query.setParameter("article", article);
- List<Location> allLocationsInError = query.getResultList();
- return allLocationsInError;
- }
-
- @Override
- public List<LocationError> findAll() {
- Query query = entityManager.createQuery("from LocationError se order by se.reportDate");
- List<LocationError> all = query.getResultList();
- return all;
- }
-}
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,84 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.Locations;
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.Location;
-import com.franciaflex.magalie.persistence.entity.Warehouse;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class LocationJpaDao extends AbstractLocationJpaDao<Location> implements LocationDao {
-
- public LocationJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public Location find(String code, Warehouse warehouse) {
- TypedQuery<Location> query = createQuery("from Location l where l.code = :code and l.warehouse = :warehouse");
- query.setParameter("code", code);
- query.setParameter("warehouse", warehouse);
- return findUnique(query);
- }
-
- protected List<Location> findAllWithoutReception(Building building, Warehouse warehouse) {
- boolean filterOnBuilding = building != null;
- boolean filterOnWarehouse = warehouse != null;
- String hql = " from Location l where";
- if (filterOnBuilding) {
- hql += " l.warehouse.building = :building and ";
- }
- if (filterOnWarehouse) {
- hql += " l.warehouse = :warehouse and ";
- }
- hql += " l.code != :codeForReceptionLocations and "
- + " l.code != :codeForWarehouseWithoutLocations and "
- + " l.fullLocation = false "
- + " order by l.warehouse.building.code, l.warehouse.code, l.code";
- TypedQuery<Location> query = createQuery(hql);
- if (filterOnBuilding) {
- query.setParameter("building", building);
- }
- if (filterOnWarehouse) {
- query.setParameter("warehouse", warehouse);
- }
- query.setParameter("codeForReceptionLocations", Locations.codeForReceptionLocations());
- query.setParameter("codeForWarehouseWithoutLocations", Locations.codeForWarehouseWithoutLocations());
- return findAll(query);
- }
-
- @Override
- public List<Location> findAllWithoutReception(Building building) {
- return findAllWithoutReception(building, null);
- }
-
- @Override
- public List<Location> findAllWithoutReception(Warehouse warehouse) {
- return findAllWithoutReception(null, warehouse);
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -24,17 +24,12 @@
*/
import com.franciaflex.magalie.persistence.entity.MagalieUser;
-import org.nuiton.jpa.api.JpaDao;
-import java.util.List;
+/** @author bleny */
+public interface MagalieUserDao {
-/**
- * @author bleny
- */
-public interface MagalieUserDao extends JpaDao<MagalieUser> {
-
MagalieUser findByLogin(String login);
- List<MagalieUser> findAll();
+// List<MagalieUser> findAll();
}
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,52 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.MagalieUser;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class MagalieUserJpaDao extends AbstractMagalieUserJpaDao<MagalieUser> implements MagalieUserDao {
-
- public MagalieUserJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public MagalieUser findByLogin(String login) {
- TypedQuery<MagalieUser> query = createQuery("from MagalieUser mu where mu.login = :login");
- query.setParameter("login", login);
- return findUnique(query);
- }
-
- @Override
- public List<MagalieUser> findAll() {
- Query query = entityManager.createQuery("from MagalieUser mu order by mu.login");
- List<MagalieUser> resultList = query.getResultList();
- return resultList;
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,12 +1,9 @@
package com.franciaflex.magalie.persistence.dao;
import com.franciaflex.magalie.persistence.entity.PreparedArticleReception;
-import org.nuiton.jpa.api.JpaDao;
-/**
- * @author bleny
- */
-public interface PreparedArticleReceptionDao extends JpaDao<PreparedArticleReception> {
+/** @author bleny */
+public interface PreparedArticleReceptionDao {
PreparedArticleReception findByBarcode(String barcode);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,20 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-import com.franciaflex.magalie.persistence.entity.PreparedArticleReception;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-public class PreparedArticleReceptionJpaDao extends AbstractPreparedArticleReceptionJpaDao<PreparedArticleReception> implements PreparedArticleReceptionDao{
-
- public PreparedArticleReceptionJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public PreparedArticleReception findByBarcode(String barcode) {
- TypedQuery<PreparedArticleReception> query = createQuery("from PreparedArticleReception par where par.barcode = :barcode");
- query.setParameter("barcode", barcode);
- return findUniqueOrNull(query);
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -27,14 +27,11 @@
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.RequestedArticle;
import com.franciaflex.magalie.persistence.entity.RequestedList;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-/**
- * @author bleny
- */
-public interface RequestedArticleDao extends JpaDao<RequestedArticle> {
+/** @author bleny */
+public interface RequestedArticleDao {
List<RequestedArticle> findAllUndelivered(Building building, MagalieUser affectedTo, String listType);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,65 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.DeliveredRequestedListStatus;
-import com.franciaflex.magalie.persistence.entity.MagalieUser;
-import com.franciaflex.magalie.persistence.entity.RequestedArticle;
-import com.franciaflex.magalie.persistence.entity.RequestedList;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class RequestedArticleJpaDao extends AbstractRequestedArticleJpaDao<RequestedArticle> implements RequestedArticleDao{
-
- public RequestedArticleJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public List<RequestedArticle> findAllUndelivered(Building building, MagalieUser affectedTo, String listType) {
- TypedQuery<RequestedArticle> query = createQuery(
- "from RequestedArticle ra where "
- + " ra not in (select dra.requestedArticle from DeliveredRequestedArticle dra) "
- + " and ra.requestedList.building = :building "
- + " and ra.requestedList.listType = :listType "
- + " and ra.requestedList not in (select drl.requestedList from DeliveredRequestedList drl where drl.status = :complete or drl.status = :affected and drl.affectedTo != :affectedTo)");
- query.setParameter("building", building);
- query.setParameter("listType", listType);
- query.setParameter("complete", DeliveredRequestedListStatus.COMPLETE);
- query.setParameter("affected", DeliveredRequestedListStatus.AFFECTED);
- query.setParameter("affectedTo", affectedTo);
- return findAll(query);
- }
-
- @Override
- public List<RequestedArticle> findAll(RequestedList requestedList) {
- TypedQuery<RequestedArticle> query = createQuery("from RequestedArticle ra where ra.requestedList = :requestedList");
- query.setParameter("requestedList", requestedList);
- return findAll(query);
- }
-
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -23,15 +23,10 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.entity.RequestedList;
-import org.nuiton.jpa.api.JpaDao;
-
import java.util.List;
-/**
- * @author bleny
- */
-public interface RequestedListDao extends JpaDao<RequestedList> {
+/** @author bleny */
+public interface RequestedListDao {
List<String> findAllDistinctListTypes();
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,43 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.RequestedList;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class RequestedListJpaDao extends AbstractRequestedListJpaDao<RequestedList> implements RequestedListDao{
-
- public RequestedListJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public List<String> findAllDistinctListTypes() {
- TypedQuery<String> query = entityManager.createQuery("select distinct rl.listType from RequestedList rl", String.class);
- return query.getResultList();
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,18 +26,15 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.StorageMovement;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-/**
- * @author bleny
- */
-public interface StorageMovementDao extends JpaDao<StorageMovement> {
+/** @author bleny */
+public interface StorageMovementDao {
List<StorageMovement> findAllByArticle(Article article);
- List<StorageMovement> findAll();
+// List<StorageMovement> findAll();
List<StorageMovement> findAllInReception(Building building);
}
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,65 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.Locations;
-import com.franciaflex.magalie.persistence.entity.Article;
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.StorageMovement;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.List;
-
-public class StorageMovementJpaDao extends AbstractStorageMovementJpaDao<StorageMovement> implements StorageMovementDao{
-
- public StorageMovementJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public List<StorageMovement> findAllByArticle(Article article) {
- Query query = entityManager.createQuery("from StorageMovement sm where sm.article = :article");
- query.setParameter("article", article);
- return query.getResultList();
- }
-
- @Override
- public List<StorageMovement> findAllInReception(Building building) {
- Query query = entityManager.createQuery(
- " from StorageMovement sm" +
- " where sm.originLocation.code = :codeForReceptionLocations and sm.originLocation.warehouse.building = :building" +
- " or " +
- " sm.destinationLocation.code = :codeForReceptionLocations and sm.destinationLocation.warehouse.building = :building");
- query.setParameter("building", building);
- query.setParameter("codeForReceptionLocations", Locations.codeForReceptionLocations());
- return query.getResultList();
- }
-
- @Override
- public List<StorageMovement> findAll() {
- Query query = entityManager.createQuery("from StorageMovement sm order by sm.orderDate");
- return query.getResultList();
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,11 +26,10 @@
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-public interface StorageMovementOrderDao extends JpaDao<StorageMovementOrder> {
+public interface StorageMovementOrderDao {
public List<StorageMovementOrder> findNotConfirmedByUser(MagalieUser magalieUser, Building building);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,53 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.MagalieUser;
-import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
-
-import javax.persistence.EntityManager;
-import javax.persistence.Query;
-import java.util.List;
-
-public class StorageMovementOrderJpaDao extends AbstractStorageMovementOrderJpaDao<StorageMovementOrder> implements StorageMovementOrderDao{
-
- public StorageMovementOrderJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public List<StorageMovementOrder> findNotConfirmedByUser(MagalieUser magalieUser, Building building) {
- Query query = entityManager.createQuery(
- " select distinct smo" +
- " from StorageMovementOrder smo" +
- " inner join smo.storageMovements as sm" +
- " where sm.magalieUser = :magalieUser" +
- " and sm.originLocation.warehouse.building = :building" +
- " and sm.confirmDate is null");
- query.setParameter("magalieUser", magalieUser);
- query.setParameter("building", building);
- return query.getResultList();
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,11 +26,10 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-public interface StoredArticleDao extends JpaDao<StoredArticle> {
+public interface StoredArticleDao {
List<StoredArticle> findAllForArticleInBuilding(Article article, Building building);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,77 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.Locations;
-import com.franciaflex.magalie.persistence.entity.Article;
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.StoredArticle;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class StoredArticleJpaDao extends AbstractStoredArticleJpaDao<StoredArticle> implements StoredArticleDao {
-
- public StoredArticleJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public List<StoredArticle> findAllForArticleInBuilding(Article article, Building building) {
- TypedQuery<StoredArticle> query = createQuery("from StoredArticle sa where sa.article = :article and sa.location.warehouse.withdrawAllowed = true and sa.location.warehouse.building = :building");
- query.setParameter("article", article);
- query.setParameter("building", building);
- List<StoredArticle> resultList = findAll(query);
- for (StoredArticle storedArticle : resultList) {
- entityManager.detach(storedArticle);
- }
- return resultList;
- }
-
- @Override
- public List<StoredArticle> findAllReceivedForAllSupplier(Building building) {
- TypedQuery<StoredArticle> query = createQuery("from StoredArticle sa where sa.location.warehouse.building = :building and sa.location.code = :code");
- query.setParameter("building", building);
- query.setParameter("code", Locations.codeForReceptionLocations());
- List<StoredArticle> resultList = findAll(query);
- for (StoredArticle storedArticle : resultList) {
- entityManager.detach(storedArticle);
- }
- return resultList;
- }
-
- @Override
- public List<StoredArticle> findAllReceivedForSupplier(Building building, String supplierId) {
- TypedQuery<StoredArticle> query = createQuery("from StoredArticle sa where sa.location.warehouse.building = :building and sa.location.code = :code and sa.article.supplier.id = :supplierId");
- query.setParameter("building", building);
- query.setParameter("supplierId", supplierId);
- query.setParameter("code", Locations.codeForReceptionLocations());
- List<StoredArticle> resultList = findAll(query);
- for (StoredArticle storedArticle : resultList) {
- entityManager.detach(storedArticle);
- }
- return resultList;
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -25,14 +25,11 @@
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Supplier;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-/**
- * @author bleny
- */
-public interface SupplierDao extends JpaDao<Supplier> {
+/** @author bleny */
+public interface SupplierDao {
List<Supplier> findAllWithReceivedArticles(Building building);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,50 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.Locations;
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.Location;
-import com.franciaflex.magalie.persistence.entity.Supplier;
-import com.franciaflex.magalie.persistence.entity.Warehouse;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class SupplierJpaDao extends AbstractSupplierJpaDao<Supplier> implements SupplierDao{
-
- public SupplierJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public List<Supplier> findAllWithReceivedArticles(Building building) {
- TypedQuery<Supplier> query = createQuery("select sa.article.supplier from StoredArticle sa where sa.location.code = :code and sa.location.warehouse.building = :building");
- query.setParameter(Warehouse.PROPERTY_BUILDING, building);
- query.setParameter(Location.PROPERTY_CODE, Locations.codeForReceptionLocations());
- return findAll(query);
- }
-
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,12 +26,9 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.UnavailableArticle;
-import org.nuiton.jpa.api.JpaDao;
-/**
- * @author bleny
- */
-public interface UnavailableArticleDao extends JpaDao<UnavailableArticle> {
+/** @author bleny */
+public interface UnavailableArticleDao {
UnavailableArticle findByArticle(Building building, Article article);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,46 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.entity.Article;
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.UnavailableArticle;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-
-public class UnavailableArticleJpaDao extends AbstractUnavailableArticleJpaDao<UnavailableArticle> implements UnavailableArticleDao{
-
- public UnavailableArticleJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public UnavailableArticle findByArticle(Building building, Article article) {
- TypedQuery<UnavailableArticle> query = createQuery("from UnavailableArticle ua where ua.article = :article and ua.building = :building");
- query.setParameter(UnavailableArticle.PROPERTY_ARTICLE, article);
- query.setParameter(UnavailableArticle.PROPERTY_BUILDING, building);
- return findUniqueOrNull(query);
- }
-}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -25,14 +25,11 @@
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Warehouse;
-import org.nuiton.jpa.api.JpaDao;
import java.util.List;
-/**
- * @author bleny
- */
-public interface WarehouseDao extends JpaDao<Warehouse> {
+/** @author bleny */
+public interface WarehouseDao {
List<Warehouse> findAllWithoutLocations(Building building);
Deleted: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -1,47 +0,0 @@
-package com.franciaflex.magalie.persistence.dao;
-
-/*
- * #%L
- * MagaLiE :: Persistence
- * $Id:$
- * $HeadURL:$
- * %%
- * Copyright (C) 2013 CodeLutin
- * %%
- * This program is free software: you can redistribute it and/or modify
- * it under the terms of the GNU Affero General Public License as published by
- * the Free Software Foundation, either version 3 of the License, or
- * (at your option) any later version.
- *
- * This program is distributed in the hope that it will be useful,
- * but WITHOUT ANY WARRANTY; without even the implied warranty of
- * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
- * GNU General Public License for more details.
- *
- * You should have received a copy of the GNU Affero General Public License
- * along with this program. If not, see <http://www.gnu.org/licenses/>.
- * #L%
- */
-
-import com.franciaflex.magalie.persistence.Locations;
-import com.franciaflex.magalie.persistence.entity.Building;
-import com.franciaflex.magalie.persistence.entity.Warehouse;
-
-import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
-import java.util.List;
-
-public class WarehouseJpaDao extends AbstractWarehouseJpaDao<Warehouse> implements WarehouseDao {
-
- public WarehouseJpaDao(EntityManager entityManager) {
- super(entityManager);
- }
-
- @Override
- public List<Warehouse> findAllWithoutLocations(Building building) {
- TypedQuery<Warehouse> query = entityManager.createQuery("from Warehouse w where w.building = :building and w in (select l.warehouse from Location l where l.code = :code)", getEntityClass());
- query.setParameter(Warehouse.PROPERTY_BUILDING, building);
- query.setParameter(Warehouse.PROPERTY_CODE, Locations.codeForWarehouseWithoutLocations());
- return query.getResultList();
- }
-}
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -25,14 +25,30 @@
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.StoredArticles;
-import com.franciaflex.magalie.persistence.dao.*;
-import com.franciaflex.magalie.persistence.entity.*;
+import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementOrderJpaDao;
+import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
+import com.franciaflex.magalie.persistence.dao.UnavailableArticleJpaDao;
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Location;
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.StorageMovement;
+import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+import com.franciaflex.magalie.persistence.entity.UnavailableArticle;
import com.franciaflex.magalie.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
import com.franciaflex.magalie.services.StorageMovementConfirmation;
import com.franciaflex.magalie.services.StorageMovementTask;
import com.google.common.base.Preconditions;
-import com.google.common.collect.*;
+import com.google.common.collect.ImmutableMap;
+import com.google.common.collect.Iterables;
+import com.google.common.collect.Lists;
+import com.google.common.collect.Maps;
+import com.google.common.collect.Ordering;
+import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
import org.apache.commons.logging.Log;
import org.apache.commons.logging.LogFactory;
@@ -96,7 +112,7 @@
StorageMovementOrder storageMovementOrder = bookArticleResult.getStorageMovementOrder();
- StorageMovementOrderDao dao = persistenceContext.getStorageMovementOrderDao();
+ StorageMovementOrderJpaDao dao = persistenceContext.getStorageMovementOrderDao();
dao.persist(storageMovementOrder);
@@ -110,9 +126,7 @@
}
- /**
- * Add or remove a line in table {@link UnavailableArticle}
- */
+ /** Add or remove a line in table {@link UnavailableArticle} */
protected void updateArticleAvailability(BookArticleResult bookArticleResult) {
BookArticleRequest bookArticleRequest = bookArticleResult.getBookArticleRequest();
@@ -123,11 +137,11 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- UnavailableArticleDao dao = persistenceContext.getUnavailableArticleDao();
+ UnavailableArticleJpaDao dao = persistenceContext.getUnavailableArticleDao();
UnavailableArticle unavailableArticle = dao.findByArticle(building, article);
- boolean articleIsAvailable = ! bookArticleResult.isArticleUnavailable();
+ boolean articleIsAvailable = !bookArticleResult.isArticleUnavailable();
if (articleIsAvailable) {
@@ -231,8 +245,8 @@
if (bookArticleRequest.isBestEffortPolicy()) {
log.debug("best effort policy, requested quantity was "
- + requestedQuantity + " but only " + quantity +
- " available");
+ + requestedQuantity + " but only " + quantity +
+ " available");
} else {
@@ -274,7 +288,7 @@
public StorageMovementTask getStorageMovementTask(String storageMovementOrderId) {
- StorageMovementOrderDao dao = serviceContext.getPersistenceContext().getStorageMovementOrderDao();
+ StorageMovementOrderJpaDao dao = serviceContext.getPersistenceContext().getStorageMovementOrderDao();
StorageMovementOrder storageMovementOrder = dao.findById(storageMovementOrderId);
@@ -297,7 +311,7 @@
Location location = storedArticle.getLocation();
- if ( ! locationsInOrder.contains(location)) {
+ if (!locationsInOrder.contains(location)) {
StorageMovement newStorageMovement = new StorageMovement();
@@ -316,9 +330,7 @@
}
- /**
- * Get a snapshot of the actual current state of the stock.
- */
+ /** Get a snapshot of the actual current state of the stock. */
protected Iterable<StoredArticle> getStoredArticles(Building building, Article article) {
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
@@ -389,10 +401,10 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- StorageMovementOrderDao storageMovementOrderDao =
+ StorageMovementOrderJpaDao storageMovementOrderDao =
persistenceContext.getStorageMovementOrderDao();
- LocationDao locationDao = persistenceContext.getLocationDao();
+ LocationJpaDao locationDao = persistenceContext.getLocationDao();
StorageMovementOrder storageMovementOrder =
storageMovementOrderDao.findById(
@@ -464,7 +476,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- StorageMovementOrderDao storageMovementOrderDao =
+ StorageMovementOrderJpaDao storageMovementOrderDao =
persistenceContext.getStorageMovementOrderDao();
StorageMovementOrder storageMovementOrder = storageMovementOrderDao.findById(storageMovementOrderId);
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -23,7 +23,7 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.dao.BuildingDao;
+import com.franciaflex.magalie.persistence.dao.BuildingJpaDao;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
@@ -41,7 +41,7 @@
public List<Building> getAllBuildings() {
- BuildingDao dao = serviceContext.getPersistenceContext().getBuildingDao();
+ BuildingJpaDao dao = serviceContext.getPersistenceContext().getBuildingDao();
return dao.findAll();
@@ -49,7 +49,7 @@
public Building getBuilding(String buildingId) {
- BuildingDao dao = serviceContext.getPersistenceContext().getBuildingDao();
+ BuildingJpaDao dao = serviceContext.getPersistenceContext().getBuildingDao();
return dao.findById(buildingId);
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -24,17 +24,17 @@
*/
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
-import com.franciaflex.magalie.persistence.dao.ArticleDao;
-import com.franciaflex.magalie.persistence.dao.BuildingDao;
-import com.franciaflex.magalie.persistence.dao.KanbanDao;
-import com.franciaflex.magalie.persistence.dao.LocationDao;
-import com.franciaflex.magalie.persistence.dao.MagalieUserDao;
-import com.franciaflex.magalie.persistence.dao.PreparedArticleReceptionDao;
-import com.franciaflex.magalie.persistence.dao.RequestedArticleDao;
-import com.franciaflex.magalie.persistence.dao.RequestedListDao;
-import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
-import com.franciaflex.magalie.persistence.dao.SupplierDao;
-import com.franciaflex.magalie.persistence.dao.WarehouseDao;
+import com.franciaflex.magalie.persistence.dao.ArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.BuildingJpaDao;
+import com.franciaflex.magalie.persistence.dao.KanbanJpaDao;
+import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
+import com.franciaflex.magalie.persistence.dao.MagalieUserJpaDao;
+import com.franciaflex.magalie.persistence.dao.PreparedArticleReceptionJpaDao;
+import com.franciaflex.magalie.persistence.dao.RequestedArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.RequestedListJpaDao;
+import com.franciaflex.magalie.persistence.dao.StoredArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.SupplierJpaDao;
+import com.franciaflex.magalie.persistence.dao.WarehouseJpaDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Kanban;
@@ -108,7 +108,7 @@
}
- MagalieUserDao magalieUserDao = persistenceContext.getMagalieUserDao();
+ MagalieUserJpaDao magalieUserDao = persistenceContext.getMagalieUserDao();
Collection<MagalieUser> users = fixtures.fixture("users");
@@ -118,7 +118,7 @@
}
- BuildingDao buildingDao = persistenceContext.getBuildingDao();
+ BuildingJpaDao buildingDao = persistenceContext.getBuildingDao();
Collection<Building> buildings = fixtures.fixture("buildings");
@@ -128,7 +128,7 @@
}
- WarehouseDao warehouseDao = persistenceContext.getWarehouseDao();
+ WarehouseJpaDao warehouseDao = persistenceContext.getWarehouseDao();
Collection<Warehouse> warehouses = fixtures.fixture("warehouses");
@@ -140,7 +140,7 @@
persistenceContext.commit();
- LocationDao locationDao = persistenceContext.getLocationDao();
+ LocationJpaDao locationDao = persistenceContext.getLocationDao();
Collection<Location> locations = fixtures.fixture("locations");
@@ -152,7 +152,7 @@
persistenceContext.commit();
- SupplierDao supplierDao = persistenceContext.getSupplierDao();
+ SupplierJpaDao supplierDao = persistenceContext.getSupplierDao();
Collection<Supplier> suppliers = fixtures.fixture("suppliers");
@@ -164,7 +164,7 @@
persistenceContext.commit();
- ArticleDao articleDao = persistenceContext.getArticleDao();
+ ArticleJpaDao articleDao = persistenceContext.getArticleDao();
Collection<Article> articles = fixtures.fixture("articles");
@@ -174,7 +174,7 @@
}
- KanbanDao kanbanDao = persistenceContext.getKanbanDao();
+ KanbanJpaDao kanbanDao = persistenceContext.getKanbanDao();
Collection<Kanban> kanbans = fixtures.fixture("kanbans");
@@ -186,7 +186,7 @@
persistenceContext.commit();
- StoredArticleDao storedArticleDao = persistenceContext.getStoredArticleDao();
+ StoredArticleJpaDao storedArticleDao = persistenceContext.getStoredArticleDao();
Collection<StoredArticle> storedArticles = fixtures.fixture("storedArticles");
@@ -198,7 +198,7 @@
persistenceContext.commit();
- RequestedListDao requestedListDao = persistenceContext.getRequestedListDao();
+ RequestedListJpaDao requestedListDao = persistenceContext.getRequestedListDao();
Collection<RequestedList> requestedLists = fixtures.fixture("requestedLists");
@@ -210,7 +210,7 @@
persistenceContext.commit();
- RequestedArticleDao requestedArticleDao = persistenceContext.getRequestedArticleDao();
+ RequestedArticleJpaDao requestedArticleDao = persistenceContext.getRequestedArticleDao();
Collection<RequestedArticle> requestedArticles = fixtures.fixture("requestedArticles");
@@ -222,7 +222,7 @@
persistenceContext.commit();
- PreparedArticleReceptionDao preparedArticleReceptionDao = persistenceContext.getPreparedArticleReceptionDao();
+ PreparedArticleReceptionJpaDao preparedArticleReceptionDao = persistenceContext.getPreparedArticleReceptionDao();
Collection<PreparedArticleReception> preparedArticleReceptions = fixtures.fixture("preparedArticleReceptions");
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -28,6 +28,7 @@
import com.franciaflex.magalie.persistence.dao.KanbanDao;
import com.franciaflex.magalie.persistence.dao.LocationDao;
import com.franciaflex.magalie.persistence.dao.WarehouseDao;
+import com.franciaflex.magalie.persistence.dao.WarehouseJpaDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Kanban;
@@ -57,7 +58,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- WarehouseDao warehouseDao = persistenceContext.getWarehouseDao();
+ WarehouseJpaDao warehouseDao = persistenceContext.getWarehouseDao();
Warehouse warehouse = warehouseDao.findById(storeId);
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -23,7 +23,7 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.dao.LocationErrorDao;
+import com.franciaflex.magalie.persistence.dao.LocationErrorJpaDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.LocationError;
@@ -57,7 +57,7 @@
public void reportError(Location location, Article article, MagalieUser magalieUser, Date reportDate) {
- LocationErrorDao locationErrorDao = serviceContext.getPersistenceContext().getLocationErrorDao();
+ LocationErrorJpaDao locationErrorDao = serviceContext.getPersistenceContext().getLocationErrorDao();
LocationError existingLocationError = locationErrorDao.findByLocation(location);
@@ -88,7 +88,7 @@
public List<Location> getAllLocationsInError(Article article) {
- LocationErrorDao locationErrorDao = serviceContext.getPersistenceContext().getLocationErrorDao();
+ LocationErrorJpaDao locationErrorDao = serviceContext.getPersistenceContext().getLocationErrorDao();
List<Location> allLocationsInError = locationErrorDao.getAllLocationsInError(article);
@@ -98,7 +98,7 @@
public List<LocationError> getAllLocationErrors() {
- LocationErrorDao locationErrorDao = serviceContext.getPersistenceContext().getLocationErrorDao();
+ LocationErrorJpaDao locationErrorDao = serviceContext.getPersistenceContext().getLocationErrorDao();
List<LocationError> allLocationErrors = locationErrorDao.findAll();
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -23,7 +23,7 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.dao.MagalieUserDao;
+import com.franciaflex.magalie.persistence.dao.MagalieUserJpaDao;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
@@ -42,7 +42,7 @@
public MagalieUser getMagalieUser(String login) {
- MagalieUserDao dao = serviceContext.getPersistenceContext().getMagalieUserDao();
+ MagalieUserJpaDao dao = serviceContext.getPersistenceContext().getMagalieUserDao();
MagalieUser magalieUser = dao.findByLogin(login);
@@ -54,7 +54,7 @@
public List<MagalieUser> getAllMagalieUsers() {
- MagalieUserDao dao = serviceContext.getPersistenceContext().getMagalieUserDao();
+ MagalieUserJpaDao dao = serviceContext.getPersistenceContext().getMagalieUserDao();
List<MagalieUser> allMagalieUsers = dao.findAll();
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -28,9 +28,12 @@
import com.franciaflex.magalie.persistence.StorageMovements;
import com.franciaflex.magalie.persistence.StoredArticles;
import com.franciaflex.magalie.persistence.dao.LocationDao;
-import com.franciaflex.magalie.persistence.dao.PreparedArticleReceptionDao;
+import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
+import com.franciaflex.magalie.persistence.dao.PreparedArticleReceptionJpaDao;
import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementJpaDao;
import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
+import com.franciaflex.magalie.persistence.dao.StoredArticleJpaDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Location;
@@ -69,10 +72,10 @@
Iterable<Supplier> suppliers =
Sets.newHashSet( // to prevent multiple occurrence of the same supplier
- Iterables.transform(
- allReceivedArticles,
- StoredArticles.getArticleSupplierFunction()
- )
+ Iterables.transform(
+ allReceivedArticles,
+ StoredArticles.getArticleSupplierFunction()
+ )
);
SuppliersToReceive suppliersToReceive = new SuppliersToReceive(suppliers);
@@ -148,7 +151,7 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- StoredArticleDao storedArticleDao = persistenceContext.getStoredArticleDao();
+ StoredArticleJpaDao storedArticleDao = persistenceContext.getStoredArticleDao();
StoredArticle storedArticle =
storedArticleDao.findById(storedArticleId);
@@ -258,15 +261,15 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- StoredArticleDao storedArticleDao =
+ StoredArticleJpaDao storedArticleDao =
persistenceContext.getStoredArticleDao();
StoredArticle storedArticle =
storedArticleDao.findById(storedArticleId);
- LocationDao locationDao = persistenceContext.getLocationDao();
+ LocationJpaDao locationDao = persistenceContext.getLocationDao();
- StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+ StorageMovementJpaDao storageMovementDao = persistenceContext.getStorageMovementDao();
Date now = serviceContext.getNow();
@@ -303,7 +306,7 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- PreparedArticleReceptionDao dao =
+ PreparedArticleReceptionJpaDao dao =
persistenceContext.getPreparedArticleReceptionDao();
PreparedArticleReception preparedArticleReception =
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -24,8 +24,8 @@
*/
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
-import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
-import com.franciaflex.magalie.persistence.dao.UnavailableArticleDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementJpaDao;
+import com.franciaflex.magalie.persistence.dao.UnavailableArticleJpaDao;
import com.franciaflex.magalie.persistence.entity.DeliveredRequestedList;
import com.franciaflex.magalie.persistence.entity.LocationError;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
@@ -62,7 +62,7 @@
magalieReport.setAllMagalieUsers(allMagalieUsers);
- StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+ StorageMovementJpaDao storageMovementDao = persistenceContext.getStorageMovementDao();
List<StorageMovement> allStorageMovements = storageMovementDao.findAll();
@@ -80,7 +80,7 @@
magalieReport.setAllDeliveredRequestedLists(allDeliveredRequestedLists);
- UnavailableArticleDao unavailableArticleDao = persistenceContext.getUnavailableArticleDao();
+ UnavailableArticleJpaDao unavailableArticleDao = persistenceContext.getUnavailableArticleDao();
magalieReport.setAllUnavailableArticles(unavailableArticleDao.findAll());
Modified: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -26,11 +26,13 @@
import com.franciaflex.magalie.persistence.DeliveredRequestedArticles;
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.RequestedArticles;
-import com.franciaflex.magalie.persistence.dao.DeliveredRequestedArticleDao;
+import com.franciaflex.magalie.persistence.dao.DeliveredRequestedArticleJpaDao;
import com.franciaflex.magalie.persistence.dao.DeliveredRequestedListDao;
+import com.franciaflex.magalie.persistence.dao.DeliveredRequestedListJpaDao;
import com.franciaflex.magalie.persistence.dao.RequestedArticleDao;
-import com.franciaflex.magalie.persistence.dao.RequestedListDao;
-import com.franciaflex.magalie.persistence.dao.StorageMovementOrderDao;
+import com.franciaflex.magalie.persistence.dao.RequestedArticleJpaDao;
+import com.franciaflex.magalie.persistence.dao.RequestedListJpaDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementOrderJpaDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.DeliveredRequestedArticle;
@@ -111,7 +113,7 @@
boolean somethingIsAvailable = false;
- while ( ! success && requestedArticleIterator.hasNext()) {
+ while (!success && requestedArticleIterator.hasNext()) {
requestedArticle = requestedArticleIterator.next();
@@ -125,7 +127,7 @@
bookArticleResult = articleStorageService.bookArticle(bookArticleRequest);
- boolean articleIsAvailable = ! bookArticleResult.isArticleUnavailable();
+ boolean articleIsAvailable = !bookArticleResult.isArticleUnavailable();
if (articleIsAvailable) {
@@ -151,7 +153,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- DeliveredRequestedArticleDao dao = persistenceContext.getDeliveredRequestedArticleDao();
+ DeliveredRequestedArticleJpaDao dao = persistenceContext.getDeliveredRequestedArticleDao();
DeliveredRequestedArticle newDeliveredRequestedArticle = new DeliveredRequestedArticle();
@@ -166,7 +168,7 @@
findOrderToExecuteResult.setStorageMovementOrder(storageMovementOrder);
// deal with affectations
- DeliveredRequestedListDao deliveredRequestedListDao =
+ DeliveredRequestedListJpaDao deliveredRequestedListDao =
persistenceContext.getDeliveredRequestedListDao();
DeliveredRequestedList oldAffectation =
@@ -207,23 +209,23 @@
log.info("user is affected to " + oldAffectation.getRequestedList().getCode());
}
- boolean affectationChanged = ! oldAffectation.getRequestedList().equals(requestedList);
+ boolean affectationChanged = !oldAffectation.getRequestedList().equals(requestedList);
if (affectationChanged) {
if (log.isInfoEnabled()) {
log.info("user changed affectation from "
- + oldAffectation.getRequestedList().getCode()
- + " to " + requestedList.getCode());
+ + oldAffectation.getRequestedList().getCode()
+ + " to " + requestedList.getCode());
}
boolean isFinished = oldAffectation.getStatus().equals(DeliveredRequestedListStatus.COMPLETE);
- if ( ! isFinished) {
+ if (!isFinished) {
if (log.isInfoEnabled()) {
log.info("request list " + oldAffectation.getRequestedList()
- + " is not complete, putting it back to pending");
+ + " is not complete, putting it back to pending");
}
oldAffectation.setStatus(DeliveredRequestedListStatus.PENDING);
@@ -270,7 +272,7 @@
log.info("no order to execute found: everything is unavailable");
}
- Preconditions.checkState( ! driverLicenseRequired);
+ Preconditions.checkState(!driverLicenseRequired);
findOrderToExecuteResult.setEverythingUnavailable(true);
@@ -317,7 +319,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- DeliveredRequestedListDao dao = persistenceContext.getDeliveredRequestedListDao();
+ DeliveredRequestedListJpaDao dao = persistenceContext.getDeliveredRequestedListDao();
List<DeliveredRequestedList> all = dao.findAll();
@@ -338,10 +340,10 @@
RequestedList requestedList = deliveredRequestedList.getRequestedList();
- RequestedArticleDao requestedArticleDao =
+ RequestedArticleJpaDao requestedArticleDao =
persistenceContext.getRequestedArticleDao();
- DeliveredRequestedArticleDao deliveredRequestedArticleDao =
+ DeliveredRequestedArticleJpaDao deliveredRequestedArticleDao =
persistenceContext.getDeliveredRequestedArticleDao();
List<RequestedArticle> requestedArticles =
@@ -351,15 +353,15 @@
deliveredRequestedArticleDao.findAll(requestedList);
boolean allIsConfirmed = deliveredRequestedArticles.size() == requestedArticles.size()
- && Iterables.all(
- deliveredRequestedArticles,
- DeliveredRequestedArticles.isConfirmedPredicate());
+ && Iterables.all(
+ deliveredRequestedArticles,
+ DeliveredRequestedArticles.isConfirmedPredicate());
if (allIsConfirmed) {
if (log.isInfoEnabled()) {
log.info("all requested articles have confirmed order, marking list "
- + requestedList.getCode() + " as complete");
+ + requestedList.getCode() + " as complete");
}
deliveredRequestedList.setStatus(DeliveredRequestedListStatus.COMPLETE);
@@ -385,8 +387,8 @@
if (log.isInfoEnabled()) {
log.info("user " + magalieUser.getLogin() +
- " is no longer affected to list " +
- deliveredRequestedList.getRequestedList().getCode());
+ " is no longer affected to list " +
+ deliveredRequestedList.getRequestedList().getCode());
}
deliveredRequestedList.setAffectedTo(null);
@@ -403,7 +405,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- DeliveredRequestedListDao dao = persistenceContext.getDeliveredRequestedListDao();
+ DeliveredRequestedListJpaDao dao = persistenceContext.getDeliveredRequestedListDao();
DeliveredRequestedList deliveredRequestedList = dao.findByAffectedTo(magalieUser);
@@ -423,7 +425,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- RequestedListDao dao = persistenceContext.getRequestedListDao();
+ RequestedListJpaDao dao = persistenceContext.getRequestedListDao();
List<String> allDistinctListTypes = dao.findAllDistinctListTypes();
@@ -431,18 +433,16 @@
}
- /**
- * @return null if storage movement order is not about a requested-list (for example, kanban)
- */
+ /** @return null if storage movement order is not about a requested-list (for example, kanban) */
public DeliveredRequestedList getDeliveredRequestedList(String storageMovementOrderId) {
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- DeliveredRequestedArticleDao deliveredRequestedArticleDao =
+ DeliveredRequestedArticleJpaDao deliveredRequestedArticleDao =
persistenceContext.getDeliveredRequestedArticleDao();
- StorageMovementOrderDao storageMovementOrderDao =
+ StorageMovementOrderJpaDao storageMovementOrderDao =
persistenceContext.getStorageMovementOrderDao();
StorageMovementOrder storageMovementOrder =
@@ -458,7 +458,7 @@
RequestedList requestedList =
deliveredRequestedArticle.getRequestedArticle().getRequestedList();
- DeliveredRequestedListDao deliveredRequestedListDao =
+ DeliveredRequestedListJpaDao deliveredRequestedListDao =
persistenceContext.getDeliveredRequestedListDao();
deliveredRequestedList =
@@ -475,7 +475,7 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- DeliveredRequestedArticleDao deliveredRequestedArticleDao =
+ DeliveredRequestedArticleJpaDao deliveredRequestedArticleDao =
persistenceContext.getDeliveredRequestedArticleDao();
DeliveredRequestedArticle deliveredRequestedArticle =
Modified: branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java
===================================================================
--- branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java 2013-05-27 14:32:50 UTC (rev 198)
+++ branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java 2013-05-27 21:29:10 UTC (rev 199)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.Locations;
import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementJpaDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Location;
@@ -192,7 +193,7 @@
service.confirmReception(magalieUser, receptionConfirmation);
- StorageMovementDao storageMovementDao = serviceContext.getPersistenceContext().getStorageMovementDao();
+ StorageMovementJpaDao storageMovementDao = serviceContext.getPersistenceContext().getStorageMovementDao();
List<StorageMovement> storageMovements = storageMovementDao.findAll();
1
0