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
31 May '13
Author: Bavencoff
Date: 2013-05-31 17:45:03 +0200 (Fri, 31 May 2013)
New Revision: 228
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2370 : Multy-Companies
Added:
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingJpaDao.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/CompanyService.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ChooseCompanyAction.java
trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-company.jsp
Modified:
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java
trunk/magalie-persistence/src/main/xmi/magalie.properties
trunk/magalie-persistence/src/main/xmi/magalie.zargo
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/MagalieFixtures.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieBarcodeService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java
trunk/magalie-services/src/main/resources/fixtures.yaml
trunk/magalie-services/src/main/resources/fixtures2.yaml
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieSession.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/IndexAction.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/LoginAction.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java
trunk/magalie-web/src/main/webapp/WEB-INF/content/login-input.jsp
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.dao.ArticleJpaDao;
import com.franciaflex.magalie.persistence.dao.BuildingJpaDao;
+import com.franciaflex.magalie.persistence.dao.CompanyJpaDao;
import com.franciaflex.magalie.persistence.dao.DeliveredRequestedArticleJpaDao;
import com.franciaflex.magalie.persistence.dao.DeliveredRequestedListJpaDao;
import com.franciaflex.magalie.persistence.dao.KanbanJpaDao;
@@ -84,4 +85,5 @@
PreparedArticleReceptionJpaDao getPreparedArticleReceptionDao();
+ CompanyJpaDao getCompanyDao();
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -24,10 +24,11 @@
*/
import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Company;
/** @author bleny */
public interface ArticleDao {
- Article findByCode(String articleCode);
+ Article findByCode(String articleCode, Company company);
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -24,6 +24,7 @@
*/
import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Company;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
@@ -35,9 +36,11 @@
}
@Override
- public Article findByCode(String articleCode) {
- TypedQuery<Article> query = createQuery("from Article a where a.code = :code");
- query.setParameter("code", articleCode);
+ public Article findByCode(String articleCode, Company company) {
+
+ TypedQuery<Article> query = createQuery(Article.PROPERTY_CODE, articleCode,
+ Article.PROPERTY_COMPANY, company);
+
return findUniqueOrNull(query);
}
Added: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -0,0 +1,15 @@
+package com.franciaflex.magalie.persistence.dao;
+
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
+
+import java.util.List;
+
+/**
+ * @author Bavencoff
+ */
+public interface BuildingDao {
+
+ public List<Building> findAllByCompany(Company company);
+
+}
Added: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingJpaDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingJpaDao.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -0,0 +1,25 @@
+package com.franciaflex.magalie.persistence.dao;
+
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+/**
+ * @author Bavencoff
+ */
+public class BuildingJpaDao extends AbstractBuildingJpaDao {
+ public BuildingJpaDao(EntityManager entityManager) {
+ super(entityManager);
+ }
+
+ @Override
+ public List<Building> findAllByCompany(Company company) {
+
+ TypedQuery<Building> query = createQuery(Building.PROPERTY_COMPANY, company);
+
+ return findAll(query);
+ }
+}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -23,6 +23,7 @@
* #L%
*/
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import java.util.List;
@@ -34,4 +35,6 @@
List<MagalieUser> findAll();
+ List<MagalieUser> findAllByCompany(Company company);
+
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -23,10 +23,10 @@
* #L%
*/
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import javax.persistence.EntityManager;
-import javax.persistence.Query;
import javax.persistence.TypedQuery;
import java.util.List;
@@ -45,8 +45,13 @@
@Override
public List<MagalieUser> findAll() {
- Query query = entityManager.createQuery("from MagalieUser mu order by mu.login");
- List<MagalieUser> resultList = query.getResultList();
- return resultList;
+ TypedQuery<MagalieUser> query = createQuery("from MagalieUser mu order by mu.login");
+ return findAll(query);
}
+
+ @Override
+ public List<MagalieUser> findAllByCompany(Company company) {
+ TypedQuery<MagalieUser> query = createQuery(MagalieUser.PROPERTY_COMPANY, company);
+ return findAll(query);
+ }
}
Modified: trunk/magalie-persistence/src/main/xmi/magalie.properties
===================================================================
--- trunk/magalie-persistence/src/main/xmi/magalie.properties 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-persistence/src/main/xmi/magalie.properties 2013-05-31 15:45:03 UTC (rev 228)
@@ -22,6 +22,7 @@
###
com.franciaflex.magalie.persistence.entity.Article.attribute.fixedLocations.stereotype=unique
+com.franciaflex.magalie.persistence.entity.Company.class.stereotype=notGeneratedValue
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
Modified: trunk/magalie-persistence/src/main/xmi/magalie.zargo
===================================================================
(Binary files differ)
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/MagalieFixtures.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/MagalieFixtures.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/MagalieFixtures.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -28,6 +28,7 @@
import com.franciaflex.magalie.MagalieTechnicalException;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.Kanban;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
@@ -58,6 +59,7 @@
throw new IllegalArgumentException(fixturesName + " is not a valid fixtures set name", e);
}
YamlReader reader = new YamlReader(yaml);
+ reader.getConfig().setClassTag("company", Company.class);
reader.getConfig().setClassTag("building", Building.class);
reader.getConfig().setClassTag("warehouse", Warehouse.class);
reader.getConfig().setClassTag("supplier", Supplier.class);
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.dao.BuildingJpaDao;
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
@@ -55,4 +56,10 @@
}
+ public List<Building> getAllBuildingsByCompany(Company company) {
+
+ BuildingJpaDao dao = serviceContext.getPersistenceContext().getBuildingDao();
+
+ return dao.findAllByCompany(company);
+ }
}
Added: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/CompanyService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/CompanyService.java (rev 0)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/CompanyService.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -0,0 +1,38 @@
+package com.franciaflex.magalie.services.service;
+
+import com.franciaflex.magalie.persistence.dao.CompanyJpaDao;
+import com.franciaflex.magalie.persistence.entity.Company;
+import com.franciaflex.magalie.services.MagalieService;
+import com.franciaflex.magalie.services.MagalieServiceContext;
+
+import java.util.List;
+
+/**
+ * @author Bavencoff
+ */
+public class CompanyService implements MagalieService {
+
+ protected MagalieServiceContext serviceContext;
+
+ @Override
+ public void setServiceContext(com.franciaflex.magalie.services.MagalieServiceContext serviceContext) {
+ this.serviceContext = serviceContext;
+ }
+
+ public List<Company> getAllCompanies() {
+
+ CompanyJpaDao dao = serviceContext.getPersistenceContext().getCompanyDao();
+
+ return dao.findAll();
+
+ }
+
+ public Company getCompany(String CompanyId) {
+
+ CompanyJpaDao dao = serviceContext.getPersistenceContext().getCompanyDao();
+
+ return dao.findById(CompanyId);
+
+ }
+
+}
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -26,6 +26,7 @@
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.dao.ArticleJpaDao;
import com.franciaflex.magalie.persistence.dao.BuildingJpaDao;
+import com.franciaflex.magalie.persistence.dao.CompanyJpaDao;
import com.franciaflex.magalie.persistence.dao.KanbanJpaDao;
import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
import com.franciaflex.magalie.persistence.dao.MagalieUserJpaDao;
@@ -37,6 +38,7 @@
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.Company;
import com.franciaflex.magalie.persistence.entity.Kanban;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
@@ -108,6 +110,16 @@
}
+ CompanyJpaDao companyDao = persistenceContext.getCompanyDao();
+
+ Collection<Company> companies = fixtures.fixture("companies");
+
+ for (Company company : companies) {
+
+ companyDao.persist(company);
+
+ }
+
MagalieUserJpaDao magalieUserDao = persistenceContext.getMagalieUserDao();
Collection<MagalieUser> users = fixtures.fixture("users");
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -29,6 +29,7 @@
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.Company;
import com.franciaflex.magalie.persistence.entity.Kanban;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
@@ -120,12 +121,12 @@
}
- public Article getArticle(String articleBarcode) throws InvalidMagalieBarcodeException {
+ public Article getArticle(String articleBarcode, Company company) throws InvalidMagalieBarcodeException {
MagalieBarcodeService magalieBarcodeService =
serviceContext.newService(MagalieBarcodeService.class);
- Article article = magalieBarcodeService.getArticle(articleBarcode);
+ Article article = magalieBarcodeService.getArticle(articleBarcode, company);
return article;
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieBarcodeService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieBarcodeService.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieBarcodeService.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.dao.ArticleDao;
import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException;
@@ -38,11 +39,11 @@
this.serviceContext = serviceContext;
}
- public Article getArticle(String articleBarcode) throws InvalidMagalieBarcodeException {
+ public Article getArticle(String articleBarcode, Company company) throws InvalidMagalieBarcodeException {
ArticleDao articleDao = serviceContext.getPersistenceContext().getArticleDao();
- Article article = articleDao.findByCode(articleBarcode);
+ Article article = articleDao.findByCode(articleBarcode, company);
if (article == null) {
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -24,6 +24,7 @@
*/
import com.franciaflex.magalie.persistence.dao.MagalieUserJpaDao;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
@@ -40,13 +41,13 @@
this.serviceContext = serviceContext;
}
- public MagalieUser getMagalieUser(String login) {
+ public MagalieUser getMagalieUser(String magalieUserId) {
MagalieUserJpaDao dao = serviceContext.getPersistenceContext().getMagalieUserDao();
- MagalieUser magalieUser = dao.findByLogin(login);
+ MagalieUser magalieUser = dao.findById(magalieUserId);
- Preconditions.checkArgument(magalieUser != null, "there is no user with login '" + login + "'");
+ Preconditions.checkArgument(magalieUser != null, "there is no user with id '" + magalieUserId + "'");
return magalieUser;
@@ -61,4 +62,13 @@
return allMagalieUsers;
}
+
+ public List<MagalieUser> getAllMagalieUsersByCompany(Company company) {
+
+ MagalieUserJpaDao dao = serviceContext.getPersistenceContext().getMagalieUserDao();
+
+ List<MagalieUser> allMagalieUsers = dao.findAllByCompany(company);
+
+ return allMagalieUsers;
+ }
}
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -31,6 +31,7 @@
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.Company;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.StorageMovement;
@@ -66,8 +67,10 @@
MagalieBarcodeService magalieBarcodeService =
serviceContext.newService(MagalieBarcodeService.class);
- Article article = magalieBarcodeService.getArticle(articleBarcode);
+ Company company = magalieUser.getCompany();
+ Article article = magalieBarcodeService.getArticle(articleBarcode, company);
+
Iterable<StoredArticle> storedArticles =
articleStorageService.getStoredArticles(building, article);
Modified: trunk/magalie-services/src/main/resources/fixtures.yaml
===================================================================
--- trunk/magalie-services/src/main/resources/fixtures.yaml 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/resources/fixtures.yaml 2013-05-31 15:45:03 UTC (rev 228)
@@ -1,3 +1,17 @@
+franciaflex:
+ &franciaflex !company
+ id: frflex
+ name: FranciaFlex
+
+lerheu:
+ &lerheu !company
+ id: lr
+ name: Le Rheu
+
+companies:
+ - *franciaflex
+ - *lerheu
+
pascal:
&pascal !user
id: magalie_user_pascal
@@ -5,6 +19,7 @@
name: Pascal Heinz
accreditationLevel: 9
craneMan: false
+ company: *franciaflex
bruno:
&bruno !user
@@ -13,6 +28,7 @@
name: Bruno Menager
accreditationLevel: 9
craneMan: true
+ company: *franciaflex
corinne:
&corinne !user
@@ -21,6 +37,7 @@
name: Corinne Cocolon
accreditationLevel: 0
craneMan: false
+ company: *franciaflex
xavier:
&xavier !user
@@ -29,6 +46,7 @@
name: Xavier Bertini
accreditationLevel: 0
craneMan: false
+ company: *franciaflex
users:
- *bruno
@@ -40,11 +58,13 @@
&B1 !building
id: building_1
code: B1
+ company: *franciaflex
B2:
&B2 !building
id: building_2
code: B2
+ company: *franciaflex
buildings:
- *B1
@@ -316,6 +336,7 @@
unit: M
description: Jonc Souple D5
fixedLocationsFirst: true
+ company: *franciaflex
article2:
&article2 !article
@@ -326,6 +347,7 @@
unit: PCE
description: Moteur Oréa Slt 50 RTS 50/12
fixedLocationsFirst: false
+ company: *franciaflex
article3:
&article3 !article
@@ -336,6 +358,7 @@
unit: PCE
description: Interface ASA/SOMFY + clip
fixedLocationsFirst: true
+ company: *franciaflex
article4:
&article4 !article
@@ -344,6 +367,7 @@
unit: PCE
description: Kit Tr.PM Fixe 122G D40Plat 10
fixedLocationsFirst: false
+ company: *franciaflex
article5:
&article5 !article
@@ -354,6 +378,7 @@
unit: B60
description: Caisson 2005 3F 6000 Brun
fixedLocationsFirst: false
+ company: *franciaflex
article6:
&article6 !article
@@ -365,6 +390,7 @@
description: Ensemble SOLIRIS UNO
fixedLocationsFirst: false
supplier: *supplier2
+ company: *franciaflex
articles:
- *article1
Modified: trunk/magalie-services/src/main/resources/fixtures2.yaml
===================================================================
--- trunk/magalie-services/src/main/resources/fixtures2.yaml 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-services/src/main/resources/fixtures2.yaml 2013-05-31 15:45:03 UTC (rev 228)
@@ -1,3 +1,17 @@
+franciaflex:
+ &franciaflex !company
+ id: frflex
+ name: FranciaFlex
+
+lerheu:
+ &lerheu !company
+ id: lr
+ name: Le Rheu
+
+companies:
+ - *franciaflex
+ - *lerheu
+
alexandre:
&alexandre !user
id: magalie_user_alexandre
@@ -5,6 +19,7 @@
name: Alexandre
accreditationLevel: 9
craneMan: true
+ company: *franciaflex
basile:
&basile !user
@@ -13,6 +28,7 @@
name: Basile
accreditationLevel: 0
craneMan: false
+ company: *franciaflex
cathy:
&cathy !user
@@ -21,6 +37,7 @@
name: Cathy
accreditationLevel: 9
craneMan: false
+ company: *franciaflex
david:
&david !user
@@ -29,6 +46,7 @@
name: David
accreditationLevel: 0
craneMan: false
+ company: *franciaflex
users:
- *alexandre
@@ -40,6 +58,7 @@
&B1 !building
id: building_1
code: B1
+ company: *franciaflex
buildings:
- *B1
@@ -173,6 +192,7 @@
unit: kg
description: very big screws
fixedLocationsFirst: false
+ company: *franciaflex
article2:
&article2 !article
@@ -181,6 +201,7 @@
unit: box
description: little buttons
fixedLocationsFirst: false
+ company: *franciaflex
article3:
&article3 !article
@@ -191,6 +212,7 @@
unit: g
description: magic powder
fixedLocationsFirst: false
+ company: *franciaflex
article4:
&article4 !article
@@ -199,6 +221,7 @@
unit: g
description: lutins malins
fixedLocationsFirst: false
+ company: *franciaflex
articles:
- *article1
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieSession.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieSession.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieSession.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -24,8 +24,10 @@
*/
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.Warehouse;
+import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
import java.io.Serializable;
@@ -69,6 +71,13 @@
this.building = building;
}
+ public Company getCompany() {
+
+ Preconditions.checkNotNull(magalieUser);
+
+ return magalieUser.getCompany();
+ }
+
public Warehouse getLastUsedDestinationWarehouseForKanbans() {
return lastUsedDestinationWarehouseForKanbans;
}
Added: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ChooseCompanyAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ChooseCompanyAction.java (rev 0)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ChooseCompanyAction.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -0,0 +1,33 @@
+package com.franciaflex.magalie.web.action;
+
+import com.franciaflex.magalie.persistence.entity.Company;
+import com.franciaflex.magalie.services.service.CompanyService;
+import com.franciaflex.magalie.web.MagalieActionSupport;
+
+import java.util.List;
+
+/**
+ * @author Bavencoff
+ */
+public class ChooseCompanyAction extends MagalieActionSupport {
+
+ protected CompanyService service;
+
+ protected List<Company> companies;
+
+ public void setService(CompanyService service) {
+ this.service = service;
+ }
+
+ @Override
+ public String execute() throws Exception {
+
+ companies = service.getAllCompanies();
+
+ return SUCCESS;
+ }
+
+ public List<Company> getCompanies() {
+ return companies;
+ }
+}
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
import com.franciaflex.magalie.persistence.entity.Warehouse;
@@ -135,6 +136,8 @@
MagalieUser magalieUser = session.getMagalieUser();
+ Company company = session.getCompany();
+
destinationWarehouse = service.getStore(destinationWarehouseId);
// save used destination warehouse to propose it by default on next kanban
@@ -142,7 +145,7 @@
try {
- article = service.getArticle(articleBarcode);
+ article = service.getArticle(articleBarcode, company);
} catch (InvalidMagalieBarcodeException e) {
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/IndexAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/IndexAction.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/IndexAction.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -29,7 +29,7 @@
import org.apache.struts2.convention.annotation.Results;
@Results({
- @Result(name="success", type="redirectAction", params = { "actionName", "login!input" })
+ @Result(name="success", type="redirectAction", params = { "actionName", "choose-company" })
})
public class IndexAction extends MagalieActionSupport {
}
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/LoginAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/LoginAction.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/LoginAction.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -24,8 +24,10 @@
*/
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.services.service.BuildingsService;
+import com.franciaflex.magalie.services.service.CompanyService;
import com.franciaflex.magalie.services.service.MagalieUsersService;
import com.franciaflex.magalie.web.MagalieActionSupport;
import com.franciaflex.magalie.web.MagalieSession;
@@ -43,14 +45,18 @@
protected BuildingsService buildingsService;
+ protected CompanyService companyService;
+
protected List<MagalieUser> allMagalieUsers;
protected List<Building> allBuildings;
protected MagalieSession session;
- protected String login;
+ protected String companyId;
+ protected String magalieUserId;
+
protected String buildingId;
public void setMagalieUsersService(MagalieUsersService magalieUsersService) {
@@ -61,14 +67,22 @@
this.buildingsService = buildingsService;
}
+ public void setCompanyService(CompanyService companyService) {
+ this.companyService = companyService;
+ }
+
public void setSession(MagalieSession session) {
this.session = session;
}
- public void setLogin(String login) {
- this.login = login;
+ public void setCompanyId(String companyId) {
+ this.companyId = companyId;
}
+ public void setMagalieUserId(String magalieUserId) {
+ this.magalieUserId = magalieUserId;
+ }
+
public void setBuildingId(String buildingId) {
this.buildingId = buildingId;
}
@@ -76,16 +90,18 @@
@Override
public String input() {
- allMagalieUsers = magalieUsersService.getAllMagalieUsers();
+ Company company = companyService.getCompany(companyId);
- allBuildings = buildingsService.getAllBuildings();
+ allMagalieUsers = magalieUsersService.getAllMagalieUsersByCompany(company);
+ allBuildings = buildingsService.getAllBuildingsByCompany(company);
+
return INPUT;
}
- public String getLogin() {
- return login;
+ public String getMagalieUserId() {
+ return magalieUserId;
}
public String getBuildingId() {
@@ -103,7 +119,7 @@
@Override
public String execute() {
- MagalieUser magalieUser = magalieUsersService.getMagalieUser(login);
+ MagalieUser magalieUser = magalieUsersService.getMagalieUser(magalieUserId);
Building building = buildingsService.getBuilding(buildingId);
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java 2013-05-31 15:45:03 UTC (rev 228)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.Company;
import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
import com.franciaflex.magalie.persistence.entity.Warehouse;
import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException;
@@ -134,12 +135,14 @@
destinationWarehouse = fulfilKanbanService.getStore(destinationWarehouseId);
+ Company company = session.getCompany();
+
// save used destination warehouse to propose it by default on next kanban
session.setLastUsedDestinationWarehouseForKanbans(destinationWarehouse);
try {
- article = fulfilKanbanService.getArticle(articleBarcode);
+ article = fulfilKanbanService.getArticle(articleBarcode, company);
} catch (InvalidMagalieBarcodeException e) {
Added: trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-company.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-company.jsp (rev 0)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-company.jsp 2013-05-31 15:45:03 UTC (rev 228)
@@ -0,0 +1,35 @@
+
+
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<head>
+ <title>Entreprise</title>
+</head>
+
+
+<s:iterator value="companies" status="stat">
+ <li>
+ <s:set var="elementCompanyId">companyId<s:property value="#stat.index" /></s:set>
+ <s:url namespace="/" action="login!input" id="loginUrl">
+ <s:param name="companyId" value="%{id}" />
+ </s:url>
+ <s:if test="#stat.index < shortcuts.size()">
+ <script type="text/javascript">
+ $(document).ready(function () {
+ var id = '<s:property value="elementCompanyId" />';
+ bindKey(<s:property value="shortcuts.get(#stat.index)" />, function(){ redirectTo($('#' + id));});
+ });
+ </script>
+ <s:a href="%{loginUrl}" id="%{elementCompanyId}">
+ <s:property value="name" />
+ (<s:property value="shortcuts.get(#stat.index)" />)
+ </s:a>
+ </s:if>
+ <s:else>
+ <s:a href="%{loginUrl}" ><s:property value="name" />
+ </s:a>
+ </s:else>
+ </li>
+</s:iterator>
+
Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/login-input.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/login-input.jsp 2013-05-31 12:40:58 UTC (rev 227)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/login-input.jsp 2013-05-31 15:45:03 UTC (rev 228)
@@ -30,9 +30,9 @@
<s:form>
<s:select label="Utilisateur"
- key="login"
+ key="magalieUserId"
list="allMagalieUsers"
- listKey="login"
+ listKey="id"
listValue="name"
required="true"
/>
1
0
31 May '13
Author: bleny
Date: 2013-05-31 14:40:58 +0200 (Fri, 31 May 2013)
New Revision: 227
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
update file headers
Modified:
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java
trunk/magalie-persistence/src/main/xmi/magalie.properties
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/OrderResumeService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java
trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java
trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.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/prepare-prepared-article-reception-input.jsp
trunk/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp
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
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
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.PreparedArticleReception;
/** @author bleny */
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
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.PreparedArticleReception;
import javax.persistence.EntityManager;
Modified: trunk/magalie-persistence/src/main/xmi/magalie.properties
===================================================================
--- trunk/magalie-persistence/src/main/xmi/magalie.properties 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-persistence/src/main/xmi/magalie.properties 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,3 +1,25 @@
+###
+# #%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%
+###
com.franciaflex.magalie.persistence.entity.Article.attribute.fixedLocations.stereotype=unique
com.franciaflex.magalie.persistence.entity.Article.class.stereotype=notGeneratedValue
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.services;
+/*
+ * #%L
+ * MagaLiE :: Services
+ * $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.StoredArticle;
import com.google.common.base.Preconditions;
import com.google.common.collect.Lists;
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/OrderResumeService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/OrderResumeService.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/OrderResumeService.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -12,12 +12,12 @@
* 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%
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.services.service;
+/*
+ * #%L
+ * MagaLiE :: Services
+ * $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.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.StoredArticles;
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-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,6 +1,29 @@
package com.franciaflex.magalie.services.service;
+/*
+ * #%L
+ * MagaLiE :: Services
+ * $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.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.dao.LocationDao;
import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
Modified: trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java
===================================================================
--- trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.services.service;
+/*
+ * #%L
+ * MagaLiE :: Services
+ * $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.StoredArticles;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.web.action;
+/*
+ * #%L
+ * MagaLiE :: UI
+ * $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.PreparedArticleReception;
import com.franciaflex.magalie.services.service.ReceptionService;
import com.franciaflex.magalie.web.Activity;
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.web.action;
+/*
+ * #%L
+ * MagaLiE :: UI
+ * $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.StorageMovementOrder;
Modified: trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java
===================================================================
--- trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.web.action;
+/*
+ * #%L
+ * MagaLiE :: UI
+ * $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.StoredArticles;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
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-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.web.action;
+/*
+ * #%L
+ * MagaLiE :: UI
+ * $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.Location;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
Modified: 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 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,5 +1,28 @@
package com.franciaflex.magalie.web.action;
+/*
+ * #%L
+ * MagaLiE :: UI
+ * $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.Location;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/prepare-prepared-article-reception-input.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/prepare-prepared-article-reception-input.jsp 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/prepare-prepared-article-reception-input.jsp 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,3 +1,25 @@
+<%--
+ #%L
+ MagaLiE :: UI
+ $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%
+ --%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp
===================================================================
--- trunk/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,3 +1,25 @@
+<%--
+ #%L
+ MagaLiE :: UI
+ $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%
+ --%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
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-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,3 +1,25 @@
+<%--
+ #%L
+ MagaLiE :: UI
+ $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%
+ --%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
Modified: 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 2013-05-31 12:37:06 UTC (rev 226)
+++ trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp 2013-05-31 12:40:58 UTC (rev 227)
@@ -1,3 +1,25 @@
+<%--
+ #%L
+ MagaLiE :: UI
+ $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%
+ --%>
<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
<%@ taglib prefix="s" uri="/struts-tags" %>
1
0
r226 - in trunk: . magalie-persistence magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity
by bleny@users.forge.codelutin.com 31 May '13
by bleny@users.forge.codelutin.com 31 May '13
31 May '13
Author: bleny
Date: 2013-05-31 14:37:06 +0200 (Fri, 31 May 2013)
New Revision: 226
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
clean poms
Removed:
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/AbstractEntity.java
Modified:
trunk/magalie-persistence/pom.xml
trunk/pom.xml
Modified: trunk/magalie-persistence/pom.xml
===================================================================
--- trunk/magalie-persistence/pom.xml 2013-05-31 10:42:59 UTC (rev 225)
+++ trunk/magalie-persistence/pom.xml 2013-05-31 12:37:06 UTC (rev 226)
@@ -32,19 +32,16 @@
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
- <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-entitymanager</artifactId>
- <scope>compile</scope>
</dependency>
<dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
- <scope>runtime</scope>
</dependency>
<dependency>
@@ -133,7 +130,6 @@
<plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate4-maven-plugin</artifactId>
- <version>1.0.1</version>
<executions>
<execution>
<id>executionCreate</id>
@@ -142,7 +138,7 @@
</goals>
<configuration>
<type>CREATE</type>
- <outputFile>${project.build.directory}/generated-sources/Create.sql</outputFile>
+ <outputFile>${project.build.directory}/generated-sources/magalie-create-oracle.sql</outputFile>
</configuration>
</execution>
<execution>
@@ -152,7 +148,7 @@
</goals>
<configuration>
<type>DROP</type>
- <outputFile>${project.build.directory}/generated-sources/Drop.sql</outputFile>
+ <outputFile>${project.build.directory}/generated-sources/magalie-drop-oracle.sql</outputFile>
</configuration>
</execution>
</executions>
@@ -161,37 +157,6 @@
<target>SCRIPT</target>
</configuration>
</plugin>
- <plugin>
- <groupId>de.juplo</groupId>
- <artifactId>hibernate4-maven-plugin</artifactId>
- <version>1.0.1</version>
- <executions>
- <execution>
- <id>executionCreate</id>
- <goals>
- <goal>export</goal>
- </goals>
- <configuration>
- <type>CREATE</type>
- <outputFile>${project.build.directory}/generated-sources/Create.sql</outputFile>
- </configuration>
- </execution>
- <execution>
- <id>executionDrop</id>
- <goals>
- <goal>export</goal>
- </goals>
- <configuration>
- <type>DROP</type>
- <outputFile>${project.build.directory}/generated-sources/Drop.sql</outputFile>
- </configuration>
- </execution>
- </executions>
- <configuration>
- <hibernateDialect>org.hibernate.dialect.Oracle10gDialect</hibernateDialect>
- <target>SCRIPT</target>
- </configuration>
- </plugin>
</plugins>
</build>
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/AbstractEntity.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/AbstractEntity.java 2013-05-31 10:42:59 UTC (rev 225)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/AbstractEntity.java 2013-05-31 12:37:06 UTC (rev 226)
@@ -1,55 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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.google.common.base.Objects;
-import org.apache.commons.lang3.builder.ToStringBuilder;
-
-import java.io.Serializable;
-
-public abstract class AbstractEntity implements Serializable {
-
- public abstract String getId();
-
- @Override
- public boolean equals(Object o) {
- String id = getId();
- if (this == o) return true;
- if (!(o instanceof AbstractEntity)) return false;
- AbstractEntity that = (AbstractEntity) o;
- if (id == null && that.getId() == null) return false;
- if (!id.equals(that.getId())) return false;
- return Objects.equal(id, that.getId());
- }
-
- @Override
- public int hashCode() {
- return Objects.hashCode(getId());
- }
-
- @Override
- public String toString() {
- return ToStringBuilder.reflectionToString(this);
- }
-}
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-05-31 10:42:59 UTC (rev 225)
+++ trunk/pom.xml 2013-05-31 12:37:06 UTC (rev 226)
@@ -134,7 +134,57 @@
<dependencies>
+ <!-- common dependencies (all module) -->
+
<dependency>
+ <groupId>com.h2database</groupId>
+ <artifactId>h2</artifactId>
+ <version>${h2Version}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-utils</artifactId>
+ <version>${nuitonUtilsVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton</groupId>
+ <artifactId>nuiton-config</artifactId>
+ <version>${nuitonUtilsVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.slf4j</groupId>
+ <artifactId>slf4j-jcl</artifactId>
+ <version>${slf4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>org.mockito</groupId>
+ <artifactId>mockito-core</artifactId>
+ <version>${mockitoVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
+ <dependency>
+ <groupId>com.esotericsoftware.yamlbeans</groupId>
+ <artifactId>yamlbeans</artifactId>
+ <version>1.06</version>
+ </dependency>
+
+ <!-- persistence module dependencies -->
+
+ <dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
<version>1.0.1.Final</version>
@@ -158,16 +208,10 @@
<groupId>org.hibernate</groupId>
<artifactId>hibernate-c3p0</artifactId>
<version>${hibernateVersion}</version>
+ <scope>runtime</scope>
</dependency>
<dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>test</scope>
- <version>${h2Version}</version>
- </dependency>
-
- <dependency>
<groupId>org.nuiton.jpa</groupId>
<artifactId>nuiton-jpa-api</artifactId>
<version>${nuitonJpaVersion}</version>
@@ -180,17 +224,13 @@
<scope>test</scope>
</dependency>
- <!-- Nuiton libs -->
- <dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils</artifactId>
- <version>${nuitonUtilsVersion}</version>
- </dependency>
+ <!-- web module -->
<dependency>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-config</artifactId>
- <version>${nuitonUtilsVersion}</version>
+ <groupId>javax.servlet</groupId>
+ <artifactId>servlet-api</artifactId>
+ <version>2.5</version>
+ <scope>provided</scope>
</dependency>
<dependency>
@@ -206,14 +246,6 @@
<version>${nuitonWebVersion}</version>
</dependency>
- <!--dependency>
- <groupId>javassist</groupId>
- <artifactId>javassist</artifactId>
- <version>3.12.1.GA</version>
- </dependency-->
-
- <!-- Struts 2 -->
-
<dependency>
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
@@ -265,51 +297,8 @@
</exclusions>
</dependency>
- <!-- Logging -->
-
- <dependency>
- <groupId>org.slf4j</groupId>
- <artifactId>slf4j-jcl</artifactId>
- <version>${slf4jVersion}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>log4j</groupId>
- <artifactId>log4j</artifactId>
- <version>${log4jVersion}</version>
- <scope>test</scope>
- </dependency>
-
- <!-- Others -->
-
- <dependency>
- <groupId>javax.mail</groupId>
- <artifactId>mail</artifactId>
- <version>1.4.7</version>
- </dependency>
-
- <dependency>
- <groupId>javax.servlet</groupId>
- <artifactId>servlet-api</artifactId>
- <version>2.5</version>
- <scope>provided</scope>
- </dependency>
-
- <dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- <version>${mockitoVersion}</version>
- <scope>test</scope>
- </dependency>
-
- <dependency>
- <groupId>com.esotericsoftware.yamlbeans</groupId>
- <artifactId>yamlbeans</artifactId>
- <version>1.06</version>
- </dependency>
-
</dependencies>
+
</dependencyManagement>
<build>
@@ -329,28 +318,17 @@
</plugin>
<plugin>
- <groupId>org.nuiton.i18n</groupId>
- <artifactId>i18n-maven-plugin</artifactId>
- <version>${nuitonI18nVersion}</version>
- </plugin>
-
- <plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils-maven-report-plugin</artifactId>
- <version>${nuitonUtilsVersion}</version>
- </plugin>
-
- <plugin>
- <artifactId>maven-project-info-reports-plugin</artifactId>
- <version>${projectInfoReportsPluginVersion}</version>
- </plugin>
-
- <plugin>
<groupId>org.nuiton.eugene</groupId>
<artifactId>eugene-maven-plugin</artifactId>
<version>${eugeneVersion}</version>
</plugin>
+ <plugin>
+ <groupId>de.juplo</groupId>
+ <artifactId>hibernate4-maven-plugin</artifactId>
+ <version>1.0.1</version>
+ </plugin>
+
</plugins>
</pluginManagement>
@@ -396,22 +374,6 @@
<reporting>
<plugins>
<plugin>
- <groupId>org.nuiton</groupId>
- <artifactId>nuiton-utils-maven-report-plugin</artifactId>
- <version>${nuitonUtilsVersion}</version>
- <reportSets>
- <reportSet>
- <reports>
- <report>aggregate-application-config-report</report>
- </reports>
- </reportSet>
- </reportSets>
- <configuration>
- <i18nBundleName>${magalieI18nBundle}</i18nBundleName>
- </configuration>
- </plugin>
-
- <plugin>
<artifactId>maven-project-info-reports-plugin</artifactId>
<version>${projectInfoReportsPluginVersion}</version>
<reportSets>
1
0
31 May '13
Author: bleny
Date: 2013-05-31 12:42:59 +0200 (Fri, 31 May 2013)
New Revision: 225
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
merge branch into trunk, now using nuiton-jpa
Added:
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java
trunk/magalie-persistence/src/main/xmi/magalie.properties
Removed:
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Entities.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaUtil.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/Dao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Building.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedList.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedListStatus.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Kanban.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/LocationError.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/MagalieUser.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/PreparedArticleReception.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedArticle.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedList.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StoredArticle.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Supplier.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/UnavailableArticle.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java
trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/JpaEntityManagerRule.java
Modified:
trunk/
trunk/magalie-persistence/pom.xml
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaMagaliePersistenceContext.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/RequestedArticles.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.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/SupplierDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Article.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedArticle.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Location.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovement.java
trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovementOrder.java
trunk/magalie-persistence/src/main/xmi/magalie.zargo
trunk/magalie-services/pom.xml
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java
trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java
trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/AbstractMagalieServiceTest.java
trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java
trunk/magalie-services/src/test/resources/log4j.properties
trunk/magalie-web/pom.xml
trunk/pom.xml
Property changes on: trunk
___________________________________________________________________
Added: svn:mergeinfo
+ /branches/magalie-eugene:191-224
Modified: trunk/magalie-persistence/pom.xml
===================================================================
--- trunk/magalie-persistence/pom.xml 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/pom.xml 2013-05-31 10:42:59 UTC (rev 225)
@@ -9,7 +9,6 @@
<version>0.1-SNAPSHOT</version>
</parent>
- <groupId>com.franciaflex</groupId>
<artifactId>magalie-persistence</artifactId>
<name>MagaLiE :: Persistence</name>
<description>Couche d'accès à la base de données pour MagaLiE</description>
@@ -21,6 +20,11 @@
<dependencies>
<dependency>
+ <groupId>org.nuiton.jpa</groupId>
+ <artifactId>nuiton-jpa-api</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
</dependency>
@@ -44,12 +48,6 @@
</dependency>
<dependency>
- <groupId>com.h2database</groupId>
- <artifactId>h2</artifactId>
- <scope>compile</scope>
- </dependency>
-
- <dependency>
<groupId>org.nuiton</groupId>
<artifactId>nuiton-config</artifactId>
</dependency>
@@ -94,36 +92,45 @@
<build>
<plugins>
- <!--<plugin>-->
- <!--<groupId>org.nuiton.eugene</groupId>-->
- <!--<artifactId>eugene-maven-plugin</artifactId>-->
- <!--<configuration>-->
- <!--<inputs>zargo</inputs>-->
- <!--<resolver>org.nuiton.util.FasterCachedResourceResolver</resolver>-->
- <!--</configuration>-->
- <!--<executions>-->
- <!--<execution>-->
- <!--<id>generate-entities</id>-->
- <!--<phase>generate-sources</phase>-->
- <!--<configuration>-->
- <!--<!– Corresponding to extracted package from zargo file –>-->
- <!--<fullPackagePath>com.franciaflex.magalie.persistence.entities</fullPackagePath>-->
- <!--<!– DefaultPackage used for DAOHelper generation –>-->
- <!--<defaultPackage>com.franciaflex.magalie.persistence.entities</defaultPackage>-->
- <!--<templates>-->
- <!--org.nuiton.eugene.java.JavaInterfaceTransformer,-->
- <!--org.nuiton.eugene.java.JavaBeanTransformer,-->
- <!--org.nuiton.eugene.java.JavaEnumerationTransformer,-->
- <!--org.nuiton.topia.generator.TopiaMetaTransformer-->
- <!--</templates>-->
- <!--</configuration>-->
- <!--<goals>-->
- <!--<goal>generate</goal>-->
- <!--</goals>-->
- <!--</execution>-->
- <!--</executions>-->
- <!--</plugin>-->
<plugin>
+ <groupId>org.nuiton.eugene</groupId>
+ <artifactId>eugene-maven-plugin</artifactId>
+ <configuration>
+ <inputs>zargo</inputs>
+ <resolver>org.nuiton.util.FasterCachedResourceResolver</resolver>
+ </configuration>
+ <executions>
+ <execution>
+ <id>generate-entities</id>
+ <phase>generate-sources</phase>
+ <configuration>
+ <!-- Corresponding to extracted package from zargo file -->
+ <fullPackagePath>
+ com.franciaflex.magalie.persistence.entity
+ </fullPackagePath>
+ <!-- defaultPackage used for generation -->
+ <defaultPackage>
+ com.franciaflex.magalie.persistence
+ </defaultPackage>
+ <templates>
+ org.nuiton.eugene.java.JavaEnumerationTransformer,
+ org.nuiton.jpa.templates.JpaMetaTransformer
+ </templates>
+ </configuration>
+ <goals>
+ <goal>generate</goal>
+ </goals>
+ </execution>
+ </executions>
+ <dependencies>
+ <dependency>
+ <groupId>org.nuiton.jpa</groupId>
+ <artifactId>nuiton-jpa-templates</artifactId>
+ <version>${nuitonJpaVersion}</version>
+ </dependency>
+ </dependencies>
+ </plugin>
+ <plugin>
<groupId>de.juplo</groupId>
<artifactId>hibernate4-maven-plugin</artifactId>
<version>1.0.1</version>
@@ -154,6 +161,37 @@
<target>SCRIPT</target>
</configuration>
</plugin>
+ <plugin>
+ <groupId>de.juplo</groupId>
+ <artifactId>hibernate4-maven-plugin</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <id>executionCreate</id>
+ <goals>
+ <goal>export</goal>
+ </goals>
+ <configuration>
+ <type>CREATE</type>
+ <outputFile>${project.build.directory}/generated-sources/Create.sql</outputFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>executionDrop</id>
+ <goals>
+ <goal>export</goal>
+ </goals>
+ <configuration>
+ <type>DROP</type>
+ <outputFile>${project.build.directory}/generated-sources/Drop.sql</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <hibernateDialect>org.hibernate.dialect.Oracle10gDialect</hibernateDialect>
+ <target>SCRIPT</target>
+ </configuration>
+ </plugin>
</plugins>
</build>
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Entities.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Entities.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Entities.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,66 +0,0 @@
-package com.franciaflex.magalie.persistence;
-
-/*
- * #%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.AbstractEntity;
-import com.google.common.base.Function;
-import com.google.common.base.Predicate;
-import com.google.common.base.Predicates;
-import org.apache.commons.lang3.ObjectUtils;
-
-import java.util.Comparator;
-
-public class Entities {
-
- private Entities() {}
-
- protected static class GetIdFunction implements Function<AbstractEntity, String> {
-
- @Override
- public String apply(AbstractEntity entity) {
- return entity.getId();
- }
- }
-
- protected static class ArbitraryComparator<E extends AbstractEntity> implements Comparator<E> {
-
- @Override
- public int compare(E x, E y) {
- return ObjectUtils.compare(x.getId(), y.getId());
- }
-
- }
-
- public static Function<AbstractEntity, String> getIdFunction() {
- return new GetIdFunction();
- }
-
- public static Predicate<AbstractEntity> entityHasId(String id) {
- return Predicates.compose(Predicates.equalTo(id), getIdFunction());
- }
-
- public static <E extends AbstractEntity> Comparator<E> arbitraryComparator() {
- return new ArbitraryComparator();
- }
-}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaMagaliePersistenceContext.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaMagaliePersistenceContext.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaMagaliePersistenceContext.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -23,161 +23,21 @@
* #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.MagalieUserDao;
-import com.franciaflex.magalie.persistence.dao.PreparedArticleReceptionDao;
-import com.franciaflex.magalie.persistence.dao.RequestedArticleDao;
-import com.franciaflex.magalie.persistence.dao.LocationDao;
-import com.franciaflex.magalie.persistence.dao.LocationErrorDao;
-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.SupplierDao;
-import com.franciaflex.magalie.persistence.dao.UnavailableArticleDao;
-import com.franciaflex.magalie.persistence.dao.WarehouseDao;
-import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
-import com.franciaflex.magalie.persistence.dao.jpa.ArticleJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.BuildingJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.DeliveredRequestedArticleJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.DeliveredRequestedListJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.KanbanJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.LocationErrorJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.LocationJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.MagalieUserJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.PreparedArticleReceptionJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.RequestedArticleJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.RequestedListJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.StorageMovementJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.StorageMovementOrderJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.SupplierJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.UnavailableArticleJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.WarehouseJpaDao;
-import com.franciaflex.magalie.persistence.dao.jpa.StoredArticleJpaDao;
+import org.nuiton.jpa.api.hibernate.HibernateUtil;
import javax.persistence.EntityManager;
-import javax.persistence.EntityTransaction;
-public class JpaMagaliePersistenceContext implements MagaliePersistenceContext {
+public class JpaMagaliePersistenceContext extends AbstractJpaMagaliePersistenceContext implements MagaliePersistenceContext {
- protected EntityManager entityManager;
-
- protected EntityTransaction entityTransaction;
-
public JpaMagaliePersistenceContext(EntityManager entityManager) {
- this.entityManager = entityManager;
- entityTransaction = entityManager.getTransaction();
- if ( ! entityTransaction.isActive()) {
- entityTransaction.begin();
- }
+ super(entityManager);
}
@Override
- public void commit() {
- entityTransaction.commit();
- entityTransaction = entityManager.getTransaction();
- entityTransaction.begin();
- }
-
- @Override
- public void rollback() {
- entityTransaction.rollback();
- entityTransaction = entityManager.getTransaction();
- entityTransaction.begin();
- }
-
- @Override
public void clearDatabase() {
rollback();
- JpaUtil.cleanDatabase(entityManager);
+ HibernateUtil.cleanDatabase(entityManager);
commit();
}
- @Override
- public MagalieUserDao getMagalieUserDao() {
- return new MagalieUserJpaDao(entityManager);
- }
-
- @Override
- public StoredArticleDao getStoredArticleDao() {
- return new StoredArticleJpaDao(entityManager);
- }
-
- @Override
- public RequestedArticleDao getRequestedArticleDao() {
- return new RequestedArticleJpaDao(entityManager);
- }
-
- @Override
- public ArticleDao getArticleDao() {
- return new ArticleJpaDao(entityManager);
- }
-
- @Override
- public StorageMovementDao getStorageMovementDao() {
- return new StorageMovementJpaDao(entityManager);
- }
-
- @Override
- public LocationErrorDao getLocationErrorDao() {
- return new LocationErrorJpaDao(entityManager);
- }
-
- @Override
- public StorageMovementOrderDao getStorageMovementOrderDao() {
- return new StorageMovementOrderJpaDao(entityManager);
- }
-
- @Override
- public LocationDao getLocationDao() {
- return new LocationJpaDao(entityManager);
- }
-
- @Override
- public DeliveredRequestedArticleDao getDeliveredRequestedArticleDao() {
- return new DeliveredRequestedArticleJpaDao(entityManager);
- }
-
- @Override
- public WarehouseDao getWarehouseDao() {
- return new WarehouseJpaDao(entityManager);
- }
-
- @Override
- public BuildingDao getBuildingDao() {
- return new BuildingJpaDao(entityManager);
- }
-
- @Override
- public RequestedListDao getRequestedListDao() {
- return new RequestedListJpaDao(entityManager);
- }
-
- @Override
- public DeliveredRequestedListDao getDeliveredRequestedListDao() {
- return new DeliveredRequestedListJpaDao(entityManager);
- }
-
- @Override
- public KanbanDao getKanbanDao() {
- return new KanbanJpaDao(entityManager);
- }
-
- @Override
- public SupplierDao getSupplierDao() {
- return new SupplierJpaDao(entityManager);
- }
-
- @Override
- public UnavailableArticleDao getUnavailableArticleDao() {
- return new UnavailableArticleJpaDao(entityManager);
- }
-
- @Override
- public PreparedArticleReceptionDao getPreparedArticleReceptionDao() {
- return new PreparedArticleReceptionJpaDao(entityManager);
- }
-}
+} //JpaMagaliePersistenceContext
\ No newline at end of file
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaUtil.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaUtil.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaUtil.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,139 +0,0 @@
-package com.franciaflex.magalie.persistence;
-
-/*
- * #%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.google.common.collect.ImmutableMap;
-import com.google.common.collect.Maps;
-import org.apache.commons.lang3.SystemUtils;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.hibernate.cfg.Configuration;
-import org.hibernate.cfg.Environment;
-import org.hibernate.ejb.AvailableSettings;
-import org.hibernate.ejb.EntityManagerFactoryImpl;
-import org.hibernate.service.ServiceRegistry;
-import org.hibernate.service.internal.SessionFactoryServiceRegistryImpl;
-import org.hibernate.tool.hbm2ddl.SchemaExport;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import javax.persistence.Persistence;
-import java.io.File;
-import java.lang.reflect.Field;
-import java.util.Collections;
-import java.util.Map;
-
-public class JpaUtil {
-
- private static final Log log = LogFactory.getLog(JpaUtil.class);
-
- protected static final ImmutableMap<String, String> JPA_H2_CONFIG =
- ImmutableMap.of(
- AvailableSettings.JDBC_DRIVER, org.h2.Driver.class.getName(),
- AvailableSettings.JDBC_USER, "sa",
- AvailableSettings.JDBC_PASSWORD, "",
- Environment.DIALECT, org.hibernate.dialect.H2Dialect.class.getName(),
- Environment.HBM2DDL_AUTO, "create"
- );
-
- private JpaUtil() {}
-
- public static EntityManagerFactory createTempEntityManagerFactory(String persistenceUnitName, String context) {
-
- EntityManagerFactory tempEntityManagerFactory =
- createTempEntityManagerFactory(
- persistenceUnitName,
- context, Collections.<String, String>emptyMap());
-
- return tempEntityManagerFactory;
-
- }
-
- public static EntityManagerFactory createTempEntityManagerFactory(String persistenceUnitName, String context, Map<String, String> jpaParameters) {
-
- Map<String, String> allJpaParameters = Maps.newHashMap();
-
- allJpaParameters.putAll(jpaParameters);
-
- allJpaParameters.putAll(JPA_H2_CONFIG);
-
- File tempDirFile = SystemUtils.getJavaIoTmpDir();
-
- File databaseFile = new File(tempDirFile, context);
-
- String h2dataPath = databaseFile.getAbsolutePath() + File.separator + "h2data";
-
- String jdbcUrl = "jdbc:h2:file:" + h2dataPath;
-
- allJpaParameters.put(AvailableSettings.JDBC_URL, jdbcUrl);
-
- if (log.isTraceEnabled()) {
- log.trace("will store H2 data in " + h2dataPath);
- log.trace("jdbc url is\n" + jdbcUrl);
- log.trace("allJpaParameters = " + allJpaParameters);
- }
-
- EntityManagerFactory entityManagerFactory = Persistence.createEntityManagerFactory(persistenceUnitName, allJpaParameters);
-
- return entityManagerFactory;
-
- }
-
- public static void cleanDatabase(EntityManager entityManager) {
-
- if (log.isInfoEnabled()) {
- log.info("will clean database");
- }
-
- ServiceRegistry serviceRegistry =
- ((EntityManagerFactoryImpl) entityManager.getEntityManagerFactory())
- .getSessionFactory().getServiceRegistry();
-
- Configuration configuration = null;
- try {
- Field configurationField = SessionFactoryServiceRegistryImpl.class.getDeclaredField("configuration");
- configurationField.setAccessible(true);
- configuration = (Configuration) configurationField.get(serviceRegistry);
- } catch (IllegalAccessException e) {
- if (log.isErrorEnabled()) {
- log.error("should not occur", e);
- }
- } catch (NoSuchFieldException e) {
- if (log.isErrorEnabled()) {
- log.error("should not occur", e);
- }
- }
-
- SchemaExport schemaExport= new SchemaExport(serviceRegistry, configuration);
-
- schemaExport.setHaltOnError(true);
-
- // drop
- schemaExport.execute(true, true, true, false);
-
- // create
- schemaExport.execute(true, true, false, true);
-
- }
-}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -72,7 +72,9 @@
@Override
public int compare(Location location1, Location location2) {
- return Integer.compare(location2.getRequiredAccreditationLevel(), location1.getRequiredAccreditationLevel());
+ return location2.getRequiredAccreditationLevel() - location1.getRequiredAccreditationLevel();
+ //FIXME Jdk 1.7
+// return Integer.compare(location2.getRequiredAccreditationLevel(), location1.getRequiredAccreditationLevel());
}
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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();
}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/RequestedArticles.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/RequestedArticles.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/RequestedArticles.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -28,6 +28,7 @@
import com.google.common.base.Function;
import com.google.common.collect.Lists;
import com.google.common.collect.Ordering;
+import org.nuiton.jpa.api.JpaEntities;
import java.util.Comparator;
import java.util.List;
@@ -56,7 +57,7 @@
new RequestedListComparator(RequestedLists.comparator(requests, affectedRequestedList)),
// we can still have ambiguous or priorities, so to be deterministic, use arbitrary order
- Entities.<RequestedArticle>arbitraryComparator()
+ JpaEntities.<RequestedArticle>arbitraryComparator()
)
);
return comparator;
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -25,10 +25,8 @@
import com.franciaflex.magalie.persistence.entity.Article;
-/**
- * @author bleny
- */
-public interface ArticleDao extends Dao<Article> {
+/** @author bleny */
+public interface ArticleDao {
Article findByCode(String articleCode);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -0,0 +1,44 @@
+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 {
+
+ 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("code", articleCode);
+ return findUniqueOrNull(query);
+ }
+
+}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,33 +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;
-
-/**
- * @author bleny
- */
-public interface BuildingDao extends Dao<Building> {
-
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/Dao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/Dao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/Dao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,44 +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.AbstractEntity;
-
-import java.util.List;
-
-public interface Dao<E extends AbstractEntity> {
-
- E findById(String id);
-
- List<E> findAll();
-
- void persist(E entity);
-
- E merge(E entity);
-
- void remove(E entity);
-
- boolean contains(E entity);
-
-}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -29,10 +29,8 @@
import java.util.List;
-/**
- * @author bleny
- */
-public interface DeliveredRequestedArticleDao extends Dao<DeliveredRequestedArticle> {
+/** @author bleny */
+public interface DeliveredRequestedArticleDao {
DeliveredRequestedArticle find(StorageMovementOrder storageMovementOrder);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 DeliveredRequestedArticleJpaDao extends AbstractDeliveredRequestedArticleJpaDao {
+
+ 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: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -27,10 +27,8 @@
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.RequestedList;
-/**
- * @author bleny
- */
-public interface DeliveredRequestedListDao extends Dao<DeliveredRequestedList> {
+/** @author bleny */
+public interface DeliveredRequestedListDao {
DeliveredRequestedList findByAffectedTo(MagalieUser affectedTo);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedListJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 DeliveredRequestedListJpaDao extends AbstractDeliveredRequestedListJpaDao {
+
+ 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: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -27,10 +27,8 @@
import com.franciaflex.magalie.persistence.entity.Kanban;
import com.franciaflex.magalie.persistence.entity.Warehouse;
-/**
- * @author bleny
- */
-public interface KanbanDao extends Dao<Kanban> {
+/** @author bleny */
+public interface KanbanDao {
public Kanban find(Article article, Warehouse warehouse);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 KanbanJpaDao extends AbstractKanbanJpaDao {
+
+ 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: 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-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -29,7 +29,7 @@
import java.util.List;
-public interface LocationDao extends Dao<Location> {
+public interface LocationDao {
Location find(String code, Warehouse warehouse);
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -29,15 +29,12 @@
import java.util.List;
-/**
- * @author bleny
- */
-public interface LocationErrorDao extends Dao<LocationError> {
+/** @author bleny */
+public interface LocationErrorDao {
LocationError findByLocation(Location location);
List<Location> getAllLocationsInError(Article article);
List<LocationError> findAll();
-
}
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 LocationErrorJpaDao extends AbstractLocationErrorJpaDao {
+
+ 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;
+ }
+}
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -0,0 +1,94 @@
+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 {
+
+ 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);
+ }
+
+ @Override
+ public Location findByBarCode(String barCode, Building building) {
+ TypedQuery<Location> query = createQuery("from Location l " +
+ "where CONCAT(l.warehouse.code, l.code) = :barCode " +
+ "and l.warehouse.building = :building");
+ query.setParameter("barCode", barCode);
+ query.setParameter("building", building);
+ return findUniqueOrNull(query);
+ }
+}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -27,10 +27,8 @@
import java.util.List;
-/**
- * @author bleny
- */
-public interface MagalieUserDao extends Dao<MagalieUser> {
+/** @author bleny */
+public interface MagalieUserDao {
MagalieUser findByLogin(String login);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 MagalieUserJpaDao extends AbstractMagalieUserJpaDao {
+
+ 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: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -2,11 +2,8 @@
import com.franciaflex.magalie.persistence.entity.PreparedArticleReception;
-/**
- * @author bleny
- */
-public interface PreparedArticleReceptionDao extends Dao<PreparedArticleReception> {
+/** @author bleny */
+public interface PreparedArticleReceptionDao {
PreparedArticleReception findByBarcode(String barcode);
-
}
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/PreparedArticleReceptionJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 PreparedArticleReceptionJpaDao extends AbstractPreparedArticleReceptionJpaDao {
+
+ 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: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -30,10 +30,8 @@
import java.util.List;
-/**
- * @author bleny
- */
-public interface RequestedArticleDao extends Dao<RequestedArticle> {
+/** @author bleny */
+public interface RequestedArticleDao {
List<RequestedArticle> findAllUndelivered(Building building, MagalieUser affectedTo, String listType);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 RequestedArticleJpaDao extends AbstractRequestedArticleJpaDao {
+
+ 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: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -23,14 +23,10 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.entity.RequestedList;
-
import java.util.List;
-/**
- * @author bleny
- */
-public interface RequestedListDao extends Dao<RequestedList> {
+/** @author bleny */
+public interface RequestedListDao {
List<String> findAllDistinctListTypes();
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -0,0 +1,41 @@
+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 javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class RequestedListJpaDao extends AbstractRequestedListJpaDao {
+
+ 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: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -30,10 +30,8 @@
import java.util.List;
-/**
- * @author bleny
- */
-public interface StorageMovementDao extends Dao<StorageMovement> {
+/** @author bleny */
+public interface StorageMovementDao {
List<StorageMovement> findAllByArticle(Article article);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -0,0 +1,74 @@
+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 com.franciaflex.magalie.persistence.entity.StoredArticle;
+
+import javax.persistence.EntityManager;
+import javax.persistence.Query;
+import java.util.List;
+
+public class StorageMovementJpaDao extends AbstractStorageMovementJpaDao {
+
+ 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> findAllImpactingStoredArticle(StoredArticle storedArticle) {
+ Query query = entityManager.createQuery("from StorageMovement sm where sm.article = :article and (sm.originLocation = :location or sm.destinationLocation = :location)");
+ query.setParameter("location", storedArticle.getLocation());
+ query.setParameter("article", storedArticle.getArticle());
+ return query.getResultList();
+ }
+
+ @Override
+ public List<StorageMovement> findAll() {
+ Query query = entityManager.createQuery("from StorageMovement sm order by sm.orderDate");
+ return query.getResultList();
+ }
+}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -29,7 +29,7 @@
import java.util.List;
-public interface StorageMovementOrderDao extends Dao<StorageMovementOrder> {
+public interface StorageMovementOrderDao {
public List<StorageMovementOrder> findNotConfirmedByUser(MagalieUser magalieUser, Building building);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 StorageMovementOrderJpaDao extends AbstractStorageMovementOrderJpaDao {
+
+ 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: 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-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -30,7 +30,7 @@
import java.util.List;
-public interface StoredArticleDao extends Dao<StoredArticle> {
+public interface StoredArticleDao {
List<StoredArticle> findAllForArticleInBuilding(Article article, Building building);
@@ -40,6 +40,6 @@
StoredArticle findDetachedById(String storedArticleId);
+ List<StoredArticle> findAllByLocation(Location location);
- List<StoredArticle> findAllByLocation(Location location);
}
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -0,0 +1,96 @@
+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.Location;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class StoredArticleJpaDao extends AbstractStoredArticleJpaDao {
+
+ 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;
+ }
+
+ @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);
+ return storedArticle;
+ }
+}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -28,10 +28,8 @@
import java.util.List;
-/**
- * @author bleny
- */
-public interface SupplierDao extends Dao<Supplier> {
+/** @author bleny */
+public interface SupplierDao {
List<Supplier> findAllWithReceivedArticles(Building building);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -0,0 +1,48 @@
+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.Supplier;
+
+import javax.persistence.EntityManager;
+import javax.persistence.TypedQuery;
+import java.util.List;
+
+public class SupplierJpaDao extends AbstractSupplierJpaDao {
+
+ 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("building", building);
+ query.setParameter("code", Locations.codeForReceptionLocations());
+ return findAll(query);
+ }
+
+}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -27,10 +27,8 @@
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.UnavailableArticle;
-/**
- * @author bleny
- */
-public interface UnavailableArticleDao extends Dao<UnavailableArticle> {
+/** @author bleny */
+public interface UnavailableArticleDao {
UnavailableArticle findByArticle(Building building, Article article);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 UnavailableArticleJpaDao extends AbstractUnavailableArticleJpaDao {
+
+ 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("article", article);
+ query.setParameter("building", building);
+ return findUniqueOrNull(query);
+ }
+}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -28,10 +28,8 @@
import java.util.List;
-/**
- * @author bleny
- */
-public interface WarehouseDao extends Dao<Warehouse> {
+/** @author bleny */
+public interface WarehouseDao {
List<Warehouse> findAllWithoutLocations(Building building);
Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java)
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java (rev 0)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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 WarehouseJpaDao extends AbstractWarehouseJpaDao {
+
+ 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("building", building);
+ query.setParameter("code", Locations.codeForWarehouseWithoutLocations());
+ return query.getResultList();
+ }
+}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Article.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Article.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Article.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -24,72 +24,13 @@
*/
import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToMany;
-import javax.persistence.ManyToOne;
import java.util.Set;
@Entity
-public class Article extends AbstractEntity {
+public class Article extends AbstractJpaArticle {
- @Id
- protected String id;
+ private static final long serialVersionUID = 1L;
- @ManyToMany
- protected Set<Location> fixedLocations;
-
- @ManyToOne
- protected Supplier supplier;
-
- protected String description;
-
- protected String code;
-
- protected String unit;
-
- protected boolean fixedLocationsFirst;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Set<Location> getFixedLocations() {
- return fixedLocations;
- }
-
- public void setFixedLocations(Set<Location> fixedLocations) {
- this.fixedLocations = fixedLocations;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public String getUnit() {
- return unit;
- }
-
- public void setUnit(String unit) {
- this.unit = unit;
- }
-
- public String getDescription() {
- return description;
- }
-
- public void setDescription(String description) {
- this.description = description;
- }
-
public boolean isFixedLocation(Location location) {
boolean isFixedLocation = false;
Set<Location> fixedLocations = getFixedLocations();
@@ -98,20 +39,4 @@
}
return isFixedLocation;
}
-
- public boolean isFixedLocationsFirst() {
- return fixedLocationsFirst;
- }
-
- public void setFixedLocationsFirst(boolean fixedLocationsFirst) {
- this.fixedLocationsFirst = fixedLocationsFirst;
- }
-
- public Supplier getSupplier() {
- return supplier;
- }
-
- public void setSupplier(Supplier supplier) {
- this.supplier = supplier;
- }
-}
+} //Article
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Building.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Building.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Building.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,53 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.Id;
-
-@Entity
-public class Building extends AbstractEntity {
-
- @Id
- protected String id;
-
- protected String code;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedArticle.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedArticle.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedArticle.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -24,45 +24,14 @@
*/
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToOne;
@Entity
-public class DeliveredRequestedArticle extends AbstractEntity {
+public class DeliveredRequestedArticle extends AbstractJpaDeliveredRequestedArticle {
- @Id
- @GeneratedValue
- protected String id;
+ private static final long serialVersionUID = 1L;
- @OneToOne
- protected StorageMovementOrder storageMovementOrder;
-
- @OneToOne
- protected RequestedArticle requestedArticle;
-
- @Override
- public String getId() {
- return id;
- }
-
- public StorageMovementOrder getStorageMovementOrder() {
- return storageMovementOrder;
- }
-
- public void setStorageMovementOrder(StorageMovementOrder storageMovementOrder) {
- this.storageMovementOrder = storageMovementOrder;
- }
-
- public RequestedArticle getRequestedArticle() {
- return requestedArticle;
- }
-
- public void setRequestedArticle(RequestedArticle requestedArticle) {
- this.requestedArticle = requestedArticle;
- }
-
public boolean isConfirmed() {
return getStorageMovementOrder().isConfirmed();
}
-}
+
+} //DeliveredRequestedArticle
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedList.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedList.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedList.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,82 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.EnumType;
-import javax.persistence.Enumerated;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToOne;
-
-@Entity
-public class DeliveredRequestedList extends AbstractEntity {
-
- @Id
- @GeneratedValue
- protected String id;
-
- @OneToOne
- protected RequestedList requestedList;
-
- @OneToOne
- protected MagalieUser affectedTo;
-
- @Enumerated(value = EnumType.STRING)
- protected DeliveredRequestedListStatus status;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public RequestedList getRequestedList() {
- return requestedList;
- }
-
- public void setRequestedList(RequestedList requestedList) {
- this.requestedList = requestedList;
- }
-
- public MagalieUser getAffectedTo() {
- return affectedTo;
- }
-
- public void setAffectedTo(MagalieUser affectedTo) {
- this.affectedTo = affectedTo;
- }
-
- public DeliveredRequestedListStatus getStatus() {
- return status;
- }
-
- public void setStatus(DeliveredRequestedListStatus status) {
- this.status = status;
- }
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedListStatus.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedListStatus.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/DeliveredRequestedListStatus.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,32 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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%
- */
-
-public enum DeliveredRequestedListStatus {
-
- PENDING,
- AFFECTED,
- COMPLETE
-
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Kanban.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Kanban.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Kanban.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,78 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
-@Entity
-public class Kanban extends AbstractEntity {
-
- @Id
- @GeneratedValue
- protected String id;
-
- @ManyToOne
- protected Article article;
-
- @ManyToOne
- protected Warehouse warehouse;
-
- protected double requiredQuantity;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Article getArticle() {
- return article;
- }
-
- public void setArticle(Article article) {
- this.article = article;
- }
-
- public Warehouse getWarehouse() {
- return warehouse;
- }
-
- public void setWarehouse(Warehouse warehouse) {
- this.warehouse = warehouse;
- }
-
- public double getRequiredQuantity() {
- return requiredQuantity;
- }
-
- public void setRequiredQuantity(double requiredQuantity) {
- this.requiredQuantity = requiredQuantity;
- }
-}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Location.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Location.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Location.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -24,78 +24,14 @@
*/
import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
@Entity
-public class Location extends AbstractEntity {
+public class Location extends AbstractJpaLocation {
- @Id
- protected String id;
+ private static final long serialVersionUID = 1L;
- @ManyToOne
- protected Warehouse warehouse;
-
- protected String code;
-
- protected int requiredAccreditationLevel;
-
- protected boolean fullLocation;
-
- protected boolean requiredCraneMan;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Warehouse getWarehouse() {
- return warehouse;
- }
-
- public void setWarehouse(Warehouse warehouse) {
- this.warehouse = warehouse;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public int getRequiredAccreditationLevel() {
- return requiredAccreditationLevel;
- }
-
- public void setRequiredAccreditationLevel(int requiredAccreditationLevel) {
- this.requiredAccreditationLevel = requiredAccreditationLevel;
- }
-
public String getBarcode() {
String barcode = getWarehouse().getCode() + getCode();
return barcode;
}
-
- public boolean isFullLocation() {
- return fullLocation;
- }
-
- public void setFullLocation(boolean fullLocation) {
- this.fullLocation = fullLocation;
- }
-
- public boolean isRequiredCraneMan() {
- return requiredCraneMan;
-}
-
- public void setRequiredCraneMan(boolean requiredCraneMan) {
- this.requiredCraneMan = requiredCraneMan;
- }
-
-}
+} //Location
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/LocationError.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/LocationError.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/LocationError.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,91 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-import java.util.Date;
-
-@Entity
-public class LocationError extends AbstractEntity {
-
- @Id
- @GeneratedValue
- protected String id;
-
- @OneToOne
- protected Location location;
-
- @OneToOne
- protected Article article;
-
- @ManyToOne
- protected MagalieUser magalieUser;
-
- protected Date reportDate;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Location getLocation() {
- return location;
- }
-
- public void setLocation(Location location) {
- this.location = location;
- }
-
- public MagalieUser getMagalieUser() {
- return magalieUser;
- }
-
- public void setMagalieUser(MagalieUser magalieUser) {
- this.magalieUser = magalieUser;
- }
-
- public Date getReportDate() {
- return reportDate;
- }
-
- public void setReportDate(Date reportDate) {
- this.reportDate = reportDate;
- }
-
- public Article getArticle() {
- return article;
- }
-
- public void setArticle(Article article) {
- this.article = article;
- }
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/MagalieUser.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/MagalieUser.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/MagalieUser.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,85 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.Id;
-
-@Entity
-public class MagalieUser extends AbstractEntity {
-
- @Id
- protected String id;
-
- protected String login;
-
- protected String name;
-
- protected int accreditationLevel;
-
- protected boolean craneMan;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getLogin() {
- return login;
- }
-
- public void setLogin(String login) {
- this.login = login;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-
- public int getAccreditationLevel() {
- return accreditationLevel;
- }
-
- public void setAccreditationLevel(int accreditationLevel) {
- this.accreditationLevel = accreditationLevel;
- }
-
-
- public boolean isCraneMan() {
- return craneMan;
- }
-
- public void setCraneMan(boolean craneMan) {
- this.craneMan = craneMan;
- }
-
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/PreparedArticleReception.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/PreparedArticleReception.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/PreparedArticleReception.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,52 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-import javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
-@Entity
-public class PreparedArticleReception extends AbstractEntity {
-
- @Id
- protected String id;
-
- protected String barcode;
-
- @ManyToOne
- protected StoredArticle storedArticle;
-
- protected double quantity;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getBarcode() {
- return barcode;
- }
-
- public void setBarcode(String barcode) {
- this.barcode = barcode;
- }
-
- public StoredArticle getStoredArticle() {
- return storedArticle;
- }
-
- public void setStoredArticle(StoredArticle storedArticle) {
- this.storedArticle = storedArticle;
- }
-
- public double getQuantity() {
- return quantity;
- }
-
- public void setQuantity(double quantity) {
- this.quantity = quantity;
- }
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedArticle.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedArticle.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedArticle.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,88 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import javax.persistence.OneToOne;
-
-@Entity
-public class RequestedArticle extends AbstractEntity {
-
- @Id
- protected String id;
-
- @ManyToOne
- protected Article article;
-
- @ManyToOne
- protected RequestedList requestedList;
-
- @OneToOne
- protected Location destinationLocation;
-
- protected double quantity;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Article getArticle() {
- return article;
- }
-
- public void setArticle(Article article) {
- this.article = article;
- }
-
- public double getQuantity() {
- return quantity;
- }
-
- public void setQuantity(double quantity) {
- this.quantity = quantity;
- }
-
- public RequestedList getRequestedList() {
- return requestedList;
- }
-
- public void setRequestedList(RequestedList requestedList) {
- this.requestedList = requestedList;
- }
-
- public Location getDestinationLocation() {
- return destinationLocation;
- }
-
- public void setDestinationLocation(Location destinationLocation) {
- this.destinationLocation = destinationLocation;
- }
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedList.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedList.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/RequestedList.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,96 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import java.util.Date;
-
-@Entity
-public class RequestedList extends AbstractEntity {
-
- @Id
- protected String id;
-
- @ManyToOne
- protected Building building;
-
- protected String code;
-
- protected Date requestDate;
-
- protected boolean urgent;
-
- protected String listType;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Date getRequestDate() {
- return requestDate;
- }
-
- public void setRequestDate(Date requestDate) {
- this.requestDate = requestDate;
- }
-
- public boolean isUrgent() {
- return urgent;
- }
-
- public void setUrgent(boolean urgent) {
- this.urgent = urgent;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public Building getBuilding() {
- return building;
- }
-
- public void setBuilding(Building building) {
- this.building = building;
- }
-
- public String getListType() {
- return listType;
- }
-
- public void setListType(String listType) {
- this.listType = listType;
- }
-}
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovement.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovement.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovement.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -26,117 +26,18 @@
import com.google.common.base.Objects;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-import java.util.Date;
@Entity
-public class StorageMovement extends AbstractEntity {
+public class StorageMovement extends AbstractJpaStorageMovement {
- @Id
- @GeneratedValue
- protected String id;
+ private static final long serialVersionUID = 1L;
- @ManyToOne
- protected Location originLocation;
-
- @ManyToOne
- protected Location destinationLocation;
-
- @ManyToOne
- protected Article article;
-
- @ManyToOne
- protected MagalieUser magalieUser;
-
- protected double expectedQuantity;
-
- protected Date orderDate;
-
- protected Double actualQuantity;
-
- protected Date confirmDate;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Location getOriginLocation() {
- return originLocation;
- }
-
- public void setOriginLocation(Location originLocation) {
- this.originLocation = originLocation;
- }
-
- public Location getDestinationLocation() {
- return destinationLocation;
- }
-
- public void setDestinationLocation(Location destinationLocation) {
- this.destinationLocation = destinationLocation;
- }
-
- public Article getArticle() {
- return article;
- }
-
- public void setArticle(Article article) {
- this.article = article;
- }
-
- public MagalieUser getMagalieUser() {
- return magalieUser;
- }
-
- public void setMagalieUser(MagalieUser magalieUser) {
- this.magalieUser = magalieUser;
- }
-
- public double getExpectedQuantity() {
- return expectedQuantity;
- }
-
- public void setExpectedQuantity(double expectedQuantity) {
- this.expectedQuantity = expectedQuantity;
- }
-
- public Date getOrderDate() {
- return orderDate;
- }
-
- public void setOrderDate(Date orderDate) {
- this.orderDate = orderDate;
- }
-
- public Date getConfirmDate() {
- return confirmDate;
- }
-
- public void setConfirmDate(Date confirmDate) {
- this.confirmDate = confirmDate;
- }
-
public boolean isConfirmed() {
return confirmDate != null;
}
- public Double getActualQuantity() {
- return actualQuantity;
- }
-
- public void setActualQuantity(Double actualQuantity) {
- this.actualQuantity = actualQuantity;
- }
-
public double getQuantity() {
double quantity = Objects.firstNonNull(actualQuantity, expectedQuantity);
return quantity;
}
-}
+} //StorageMovement
Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovementOrder.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovementOrder.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StorageMovementOrder.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -23,51 +23,22 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.Entities;
import com.franciaflex.magalie.persistence.StorageMovements;
import com.google.common.base.Predicates;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
import com.google.common.collect.Sets;
import org.apache.commons.lang3.builder.ToStringBuilder;
+import org.nuiton.jpa.api.JpaEntities;
-import javax.persistence.CascadeType;
import javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToMany;
-import javax.persistence.OrderColumn;
-import java.util.List;
import java.util.Set;
@Entity
-public class StorageMovementOrder extends AbstractEntity {
+public class StorageMovementOrder extends AbstractJpaStorageMovementOrder {
- @Id
- @GeneratedValue
- protected String id;
+ private static final long serialVersionUID = 1L;
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- @OneToMany(cascade = CascadeType.ALL)
- @OrderColumn
- protected List<StorageMovement> storageMovements;
-
- public List<StorageMovement> getStorageMovements() {
- return storageMovements;
- }
-
- public void setStorageMovements(List<StorageMovement> storageMovements) {
- this.storageMovements = storageMovements;
- }
-
protected Set<Article> getArticles() {
Set<Article> articles =
Sets.newHashSet(
@@ -86,17 +57,17 @@
public double getQuantity() {
double quantity = 0.;
- for (StorageMovement storageMovement : storageMovements) {
+ for (StorageMovement storageMovement : this.storageMovements) {
quantity += storageMovement.getExpectedQuantity();
}
return quantity;
}
public void addStorageMovement(StorageMovement storageMovement) {
- if (storageMovements == null) {
- storageMovements = Lists.newLinkedList();
+ if (this.storageMovements == null) {
+ this.storageMovements= Lists.newLinkedList();
}
- storageMovements.add(storageMovement);
+ super.addStorageMovements(storageMovement);
}
public Set<Location> getLocations() {
@@ -115,7 +86,7 @@
Iterables.find(
getStorageMovements(),
Predicates.compose(
- Entities.entityHasId(locationId),
+ JpaEntities.entityHasId(locationId),
StorageMovements.getOriginFunction()
),
null
@@ -150,5 +121,4 @@
StorageMovements.storageMovementIsConfirmed());
return isConfirmed;
}
-
-}
+} //StorageMovementOrder
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StoredArticle.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StoredArticle.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/StoredArticle.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,76 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
-@Entity
-public class StoredArticle extends AbstractEntity {
-
- @Id
- protected String id;
-
- @ManyToOne
- protected Article article;
-
- @ManyToOne
- protected Location location;
-
- protected double quantity;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Location getLocation() {
- return location;
- }
-
- public void setLocation(Location location) {
- this.location = location;
- }
-
- public Article getArticle() {
- return article;
- }
-
- public void setArticle(Article article) {
- this.article = article;
- }
-
- public double getQuantity() {
- return quantity;
- }
-
- public void setQuantity(double quantity) {
- this.quantity = quantity;
- }
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Supplier.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Supplier.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Supplier.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,53 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.Id;
-
-@Entity
-public class Supplier extends AbstractEntity {
-
- @Id
- protected String id;
-
- protected String name;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public String getName() {
- return name;
- }
-
- public void setName(String name) {
- this.name = name;
- }
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/UnavailableArticle.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/UnavailableArticle.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/UnavailableArticle.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,79 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.GeneratedValue;
-import javax.persistence.Id;
-import javax.persistence.OneToOne;
-import java.util.Date;
-
-@Entity
-public class UnavailableArticle extends AbstractEntity {
-
- @Id
- @GeneratedValue
- protected String id;
-
- @OneToOne
- protected Article article;
-
- @OneToOne
- protected Building building;
-
- protected Date reportDate;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Article getArticle() {
- return article;
- }
-
- public void setArticle(Article article) {
- this.article = article;
- }
-
- public Building getBuilding() {
- return building;
- }
-
- public void setBuilding(Building building) {
- this.building = building;
- }
-
- public void setReportDate(Date reportDate) {
- this.reportDate = reportDate;
- }
-
- public Date getReportDate() {
- return reportDate;
- }
-}
Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java
===================================================================
--- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,75 +0,0 @@
-package com.franciaflex.magalie.persistence.entity;
-
-/*
- * #%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 javax.persistence.Entity;
-import javax.persistence.Id;
-import javax.persistence.ManyToOne;
-
-@Entity
-public class Warehouse extends AbstractEntity {
-
- @Id
- protected String id;
-
- protected String code;
-
- @ManyToOne
- protected Building building;
-
- protected boolean withdrawAllowed;
-
- @Override
- public String getId() {
- return id;
- }
-
- public void setId(String id) {
- this.id = id;
- }
-
- public Building getBuilding() {
- return building;
- }
-
- public void setBuilding(Building building) {
- this.building = building;
- }
-
- public String getCode() {
- return code;
- }
-
- public void setCode(String code) {
- this.code = code;
- }
-
- public boolean isWithdrawAllowed() {
- return withdrawAllowed;
- }
-
- public void setWithdrawAllowed(boolean withdrawAllowed) {
- this.withdrawAllowed = withdrawAllowed;
- }
-}
Copied: trunk/magalie-persistence/src/main/xmi/magalie.properties (from rev 224, branches/magalie-eugene/magalie-persistence/src/main/xmi/magalie.properties)
===================================================================
--- trunk/magalie-persistence/src/main/xmi/magalie.properties (rev 0)
+++ trunk/magalie-persistence/src/main/xmi/magalie.properties 2013-05-31 10:42:59 UTC (rev 225)
@@ -0,0 +1,12 @@
+com.franciaflex.magalie.persistence.entity.Article.attribute.fixedLocations.stereotype=unique
+
+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
Modified: trunk/magalie-persistence/src/main/xmi/magalie.zargo
===================================================================
(Binary files differ)
Modified: trunk/magalie-services/pom.xml
===================================================================
--- trunk/magalie-services/pom.xml 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/pom.xml 2013-05-31 10:42:59 UTC (rev 225)
@@ -9,7 +9,6 @@
<version>0.1-SNAPSHOT</version>
</parent>
- <groupId>com.franciaflex</groupId>
<artifactId>magalie-services</artifactId>
<name>MagaLiE :: Services</name>
<description>Services pour MagaLiE</description>
@@ -21,6 +20,11 @@
<dependencies>
<dependency>
+ <groupId>org.nuiton.jpa</groupId>
+ <artifactId>nuiton-jpa-junit</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>org.hibernate.javax.persistence</groupId>
<artifactId>hibernate-jpa-2.0-api</artifactId>
</dependency>
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -26,11 +26,6 @@
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
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.StorageMovementDao;
-import com.franciaflex.magalie.persistence.dao.StorageMovementOrderDao;
-import com.franciaflex.magalie.persistence.dao.StoredArticleDao;
-import com.franciaflex.magalie.persistence.dao.UnavailableArticleDao;
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Location;
@@ -39,6 +34,11 @@
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.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.services.MagalieService;
import com.franciaflex.magalie.services.MagalieServiceContext;
import com.franciaflex.magalie.services.StorageMovementConfirmation;
@@ -113,7 +113,7 @@
StorageMovementOrder storageMovementOrder = bookArticleResult.getStorageMovementOrder();
- StorageMovementOrderDao dao = persistenceContext.getStorageMovementOrderDao();
+ StorageMovementOrderJpaDao dao = persistenceContext.getStorageMovementOrderDao();
dao.persist(storageMovementOrder);
@@ -127,9 +127,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();
@@ -140,11 +138,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) {
@@ -248,8 +246,8 @@
if (bookArticleRequest.isBestEffortPolicy()) {
log.debug("best effort policy, requested quantity was "
- + requestedQuantity + " but only " + quantity +
- " available");
+ + requestedQuantity + " but only " + quantity +
+ " available");
} else {
@@ -291,7 +289,7 @@
public StorageMovementTask getStorageMovementTask(String storageMovementOrderId) {
- StorageMovementOrderDao dao = serviceContext.getPersistenceContext().getStorageMovementOrderDao();
+ StorageMovementOrderJpaDao dao = serviceContext.getPersistenceContext().getStorageMovementOrderDao();
StorageMovementOrder storageMovementOrder = dao.findById(storageMovementOrderId);
@@ -314,7 +312,7 @@
Location location = storedArticle.getLocation();
- if ( ! locationsInOrder.contains(location)) {
+ if (!locationsInOrder.contains(location)) {
StorageMovement newStorageMovement = new StorageMovement();
@@ -335,9 +333,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();
@@ -422,10 +418,10 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- StorageMovementOrderDao storageMovementOrderDao =
+ StorageMovementOrderJpaDao storageMovementOrderDao =
persistenceContext.getStorageMovementOrderDao();
- LocationDao locationDao = persistenceContext.getLocationDao();
+ LocationJpaDao locationDao = persistenceContext.getLocationDao();
StorageMovementOrder storageMovementOrder =
storageMovementOrderDao.findById(
@@ -497,7 +493,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- StorageMovementOrderDao storageMovementOrderDao =
+ StorageMovementOrderJpaDao storageMovementOrderDao =
persistenceContext.getStorageMovementOrderDao();
StorageMovementOrder storageMovementOrder = storageMovementOrderDao.findById(storageMovementOrderId);
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -26,6 +26,7 @@
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.dao.KanbanDao;
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;
@@ -55,7 +56,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- WarehouseDao warehouseDao = persistenceContext.getWarehouseDao();
+ WarehouseJpaDao warehouseDao = persistenceContext.getWarehouseDao();
Warehouse warehouse = warehouseDao.findById(storeId);
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/LocationErrorsService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/MagalieUsersService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -27,9 +27,12 @@
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
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;
@@ -120,7 +123,7 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- StoredArticleDao storedArticleDao =
+ StoredArticleJpaDao storedArticleDao =
persistenceContext.getStoredArticleDao();
StoredArticle storedArticle =
@@ -245,15 +248,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();
@@ -290,7 +293,7 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- PreparedArticleReceptionDao dao =
+ PreparedArticleReceptionJpaDao dao =
persistenceContext.getPreparedArticleReceptionDao();
PreparedArticleReception preparedArticleReception =
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReportService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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: 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-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -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;
@@ -112,7 +114,7 @@
boolean somethingIsAvailable = false;
- while ( ! success && requestedArticleIterator.hasNext()) {
+ while (!success && requestedArticleIterator.hasNext()) {
requestedArticle = requestedArticleIterator.next();
@@ -126,7 +128,7 @@
bookArticleResult = articleStorageService.bookArticle(bookArticleRequest);
- boolean articleIsAvailable = ! bookArticleResult.isArticleUnavailable();
+ boolean articleIsAvailable = !bookArticleResult.isArticleUnavailable();
if (articleIsAvailable) {
@@ -152,7 +154,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- DeliveredRequestedArticleDao dao = persistenceContext.getDeliveredRequestedArticleDao();
+ DeliveredRequestedArticleJpaDao dao = persistenceContext.getDeliveredRequestedArticleDao();
DeliveredRequestedArticle newDeliveredRequestedArticle = new DeliveredRequestedArticle();
@@ -167,7 +169,7 @@
findOrderToExecuteResult.setStorageMovementOrder(storageMovementOrder);
// deal with affectations
- DeliveredRequestedListDao deliveredRequestedListDao =
+ DeliveredRequestedListJpaDao deliveredRequestedListDao =
persistenceContext.getDeliveredRequestedListDao();
DeliveredRequestedList oldAffectation =
@@ -208,23 +210,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);
@@ -271,7 +273,7 @@
log.info("no order to execute found: everything is unavailable");
}
- Preconditions.checkState( ! driverLicenseRequired);
+ Preconditions.checkState(!driverLicenseRequired);
findOrderToExecuteResult.setEverythingUnavailable(true);
@@ -318,7 +320,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- DeliveredRequestedListDao dao = persistenceContext.getDeliveredRequestedListDao();
+ DeliveredRequestedListJpaDao dao = persistenceContext.getDeliveredRequestedListDao();
List<DeliveredRequestedList> all = dao.findAll();
@@ -339,10 +341,10 @@
RequestedList requestedList = deliveredRequestedList.getRequestedList();
- RequestedArticleDao requestedArticleDao =
+ RequestedArticleJpaDao requestedArticleDao =
persistenceContext.getRequestedArticleDao();
- DeliveredRequestedArticleDao deliveredRequestedArticleDao =
+ DeliveredRequestedArticleJpaDao deliveredRequestedArticleDao =
persistenceContext.getDeliveredRequestedArticleDao();
List<RequestedArticle> requestedArticles =
@@ -352,15 +354,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);
@@ -386,8 +388,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);
@@ -404,7 +406,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- DeliveredRequestedListDao dao = persistenceContext.getDeliveredRequestedListDao();
+ DeliveredRequestedListJpaDao dao = persistenceContext.getDeliveredRequestedListDao();
DeliveredRequestedList deliveredRequestedList = dao.findByAffectedTo(magalieUser);
@@ -424,7 +426,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- RequestedListDao dao = persistenceContext.getRequestedListDao();
+ RequestedListJpaDao dao = persistenceContext.getRequestedListDao();
List<String> allDistinctListTypes = dao.findAllDistinctListTypes();
@@ -432,18 +434,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 =
@@ -459,7 +459,7 @@
RequestedList requestedList =
deliveredRequestedArticle.getRequestedArticle().getRequestedList();
- DeliveredRequestedListDao deliveredRequestedListDao =
+ DeliveredRequestedListJpaDao deliveredRequestedListDao =
persistenceContext.getDeliveredRequestedListDao();
deliveredRequestedList =
@@ -476,7 +476,7 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- DeliveredRequestedArticleDao deliveredRequestedArticleDao =
+ DeliveredRequestedArticleJpaDao deliveredRequestedArticleDao =
persistenceContext.getDeliveredRequestedArticleDao();
DeliveredRequestedArticle deliveredRequestedArticle =
Modified: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java
===================================================================
--- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -4,8 +4,8 @@
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.StoredArticles;
import com.franciaflex.magalie.persistence.dao.LocationDao;
-import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
-import com.franciaflex.magalie.persistence.dao.WarehouseDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementJpaDao;
+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.Location;
@@ -71,7 +71,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- WarehouseDao warehouseDao = persistenceContext.getWarehouseDao();
+ WarehouseJpaDao warehouseDao = persistenceContext.getWarehouseDao();
Date now = serviceContext.getNow();
@@ -113,7 +113,7 @@
// save storage movement
- StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+ StorageMovementJpaDao storageMovementDao = persistenceContext.getStorageMovementDao();
storageMovementDao.persist(storageMovement);
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-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -3,8 +3,11 @@
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
import com.franciaflex.magalie.persistence.dao.LocationDao;
+import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
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.Building;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
@@ -47,7 +50,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- LocationDao locationDao = persistenceContext.getLocationDao();
+ LocationJpaDao locationDao = persistenceContext.getLocationDao();
Location location = locationDao.findById(id);
@@ -84,7 +87,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- StoredArticleDao storedArticleDao = persistenceContext.getStoredArticleDao();
+ StoredArticleJpaDao storedArticleDao = persistenceContext.getStoredArticleDao();
StoredArticle storedArticle = storedArticleDao.findById(storedArticleId);
@@ -95,7 +98,7 @@
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
- StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+ StorageMovementJpaDao storageMovementDao = persistenceContext.getStorageMovementDao();
Date now = serviceContext.getNow();
Modified: trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/AbstractMagalieServiceTest.java
===================================================================
--- trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/AbstractMagalieServiceTest.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/AbstractMagalieServiceTest.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -26,6 +26,7 @@
import com.franciaflex.magalie.MagalieApplicationConfig;
import com.franciaflex.magalie.services.service.FixturesService;
import org.junit.Rule;
+import org.nuiton.jpa.junit.JpaEntityManagerRule;
import javax.persistence.EntityManager;
import java.util.Map;
Deleted: trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/JpaEntityManagerRule.java
===================================================================
--- trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/JpaEntityManagerRule.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/JpaEntityManagerRule.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -1,122 +0,0 @@
-package com.franciaflex.magalie.services;
-
-/*
- * #%L
- * MagaLiE :: Services
- * $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.JpaUtil;
-import com.google.common.base.Joiner;
-import com.google.common.base.Preconditions;
-import org.apache.commons.logging.Log;
-import org.apache.commons.logging.LogFactory;
-import org.junit.rules.TestRule;
-import org.junit.runner.Description;
-import org.junit.runners.model.Statement;
-
-import javax.persistence.EntityManager;
-import javax.persistence.EntityManagerFactory;
-import java.util.Date;
-import java.util.Map;
-
-public class JpaEntityManagerRule implements TestRule {
-
- private static final Log log = LogFactory.getLog(JpaEntityManagerRule.class);
-
- protected String persistenceUnitName;
-
- protected String timestamp = String.valueOf(new Date().getTime());
-
- protected EntityManager entityManager;
-
- protected boolean open = false;
-
- protected Map<String, String> jpaParameters;
-
- public JpaEntityManagerRule(String persistenceUnitName, Map<String, String> jpaParameters) {
- this.persistenceUnitName = persistenceUnitName;
- this.jpaParameters = jpaParameters;
- }
-
- @Override
- public Statement apply(final Statement base, Description description) {
-
- final String testClassName = description.getClassName();
-
- final String testMethodName = description.getMethodName();
-
- if (log.isDebugEnabled()) {
- log.debug("will create entityManager for test class " + testClassName + " and method " + testMethodName);
- }
-
- return new Statement() {
- @Override
- public void evaluate() throws Throwable {
- createEntityManager(testClassName, testMethodName);
- try {
- base.evaluate();
- } finally {
- closeEntityManager();
- }
- }
- };
- }
-
- protected void createEntityManager(String testClassName, String testMethodName) {
-
- String context = Joiner.on('_').join(testClassName, testMethodName, timestamp);
-
- EntityManagerFactory entityManagerFactory = JpaUtil.createTempEntityManagerFactory(persistenceUnitName, context, jpaParameters);
-
- entityManager = entityManagerFactory.createEntityManager();
-
- if (log.isDebugEnabled()) {
- log.debug("created entityManager " + entityManager);
- }
-
- open = true;
-
- }
-
- public EntityManager getEntityManager() {
-
- Preconditions.checkState(open);
-
- return entityManager;
-
- }
-
- /**
- * Override to tear down your specific external resource.
- */
- protected void closeEntityManager() {
-
- if (log.isDebugEnabled()) {
- log.debug("close entityManager " + entityManager);
- }
-
- open = false;
-
- entityManager.close();
-
- }
-
-}
Modified: trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java
===================================================================
--- trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java 2013-05-31 10:42:59 UTC (rev 225)
@@ -24,7 +24,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;
@@ -193,7 +193,7 @@
service.confirmReception(magalieUser, receptionConfirmation);
- StorageMovementDao storageMovementDao = serviceContext.getPersistenceContext().getStorageMovementDao();
+ StorageMovementJpaDao storageMovementDao = serviceContext.getPersistenceContext().getStorageMovementDao();
List<StorageMovement> storageMovements = storageMovementDao.findAll();
Modified: trunk/magalie-services/src/test/resources/log4j.properties
===================================================================
--- trunk/magalie-services/src/test/resources/log4j.properties 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-services/src/test/resources/log4j.properties 2013-05-31 10:42:59 UTC (rev 225)
@@ -29,3 +29,4 @@
# log4j.logger.com.franciaflex.magalie=TRACE
# log4j.logger.org.hibernate.tool.hbm2ddl.SchemaExport=FATAL
+log4j.logger.org.nuiton.jpa.api.hibernate.HibernateUtil=TRACE
Modified: trunk/magalie-web/pom.xml
===================================================================
--- trunk/magalie-web/pom.xml 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/magalie-web/pom.xml 2013-05-31 10:42:59 UTC (rev 225)
@@ -90,7 +90,6 @@
<dependency>
<groupId>javax.servlet</groupId>
<artifactId>servlet-api</artifactId>
- <scope>provided</scope>
</dependency>
<dependency>
@@ -121,11 +120,13 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
+ <scope>runtime</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
+ <scope>runtime</scope>
</dependency>
<dependency>
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-05-31 09:59:59 UTC (rev 224)
+++ trunk/pom.xml 2013-05-31 10:42:59 UTC (rev 225)
@@ -6,7 +6,7 @@
<parent>
<groupId>org.nuiton</groupId>
<artifactId>mavenpom4redmine</artifactId>
- <version>3.4.8</version>
+ <version>3.4.11</version>
</parent>
<groupId>com.franciaflex</groupId>
@@ -101,6 +101,8 @@
<projectId>franciaflex-magalie</projectId>
<!-- versions -->
+ <nuitonJpaVersion>0.1-SNAPSHOT</nuitonJpaVersion>
+
<nuitonWebVersion>1.13</nuitonWebVersion>
<nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
<h2Version>1.3.172</h2Version>
@@ -115,7 +117,7 @@
<seleniumVersion>2.28.0</seleniumVersion>
<mockitoVersion>1.9.5</mockitoVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
- <eugeneVersion>2.5.6.1</eugeneVersion>
+ <eugeneVersion>2.6.3</eugeneVersion>
<!-- license to use -->
<license.licenseName>agpl_v3</license.licenseName>
@@ -161,10 +163,23 @@
<dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <scope>provided</scope>
+ <scope>test</scope>
<version>${h2Version}</version>
</dependency>
+ <dependency>
+ <groupId>org.nuiton.jpa</groupId>
+ <artifactId>nuiton-jpa-api</artifactId>
+ <version>${nuitonJpaVersion}</version>
+ </dependency>
+
+ <dependency>
+ <groupId>org.nuiton.jpa</groupId>
+ <artifactId>nuiton-jpa-junit</artifactId>
+ <version>${nuitonJpaVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
<!-- Nuiton libs -->
<dependency>
<groupId>org.nuiton</groupId>
@@ -203,7 +218,6 @@
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2Version}</version>
- <scope>compile</scope>
</dependency>
<dependency>
@@ -257,14 +271,14 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>${slf4jVersion}</version>
- <scope>runtime</scope>
+ <scope>test</scope>
</dependency>
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
<version>${log4jVersion}</version>
- <scope>runtime</scope>
+ <scope>test</scope>
</dependency>
<!-- Others -->
1
0
Author: bleny
Date: 2013-05-31 11:59:59 +0200 (Fri, 31 May 2013)
New Revision: 224
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
merge trunk into branch
Modified:
branches/magalie-eugene/
Property changes on: branches/magalie-eugene
___________________________________________________________________
Modified: svn:mergeinfo
- /trunk:191-222
+ /trunk:191-223
1
0
31 May '13
Author: bleny
Date: 2013-05-31 11:59:28 +0200 (Fri, 31 May 2013)
New Revision: 223
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
merge trunk into branch
Added:
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java
branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java
branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java
branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/prepare-withdraw-item-input.jsp
branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp
branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp
branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp
Removed:
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java
branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp
Modified:
branches/magalie-eugene/
branches/magalie-eugene/magalie-persistence/pom.xml
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java
branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/StoredArticles.java
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/KanbanJpaDao.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/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/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/StorageMovementDao.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/StoredArticleDao.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
branches/magalie-eugene/magalie-persistence/src/main/resources/magalie.properties
branches/magalie-eugene/magalie-services/pom.xml
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/FulfilKanbanService.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/RequestedArticleService.java
branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java
branches/magalie-eugene/magalie-services/src/test/resources/log4j.properties
branches/magalie-eugene/magalie-web/pom.xml
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/Activity.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java
branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ReceiveArticleAction.java
branches/magalie-eugene/magalie-web/src/main/resources/struts.properties
branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp
branches/magalie-eugene/magalie-web/src/main/webapp/css/magalie-ck3x.css
branches/magalie-eugene/magalie-web/src/main/webapp/js/magalie.js
branches/magalie-eugene/pom.xml
Property changes on: branches/magalie-eugene
___________________________________________________________________
Added: svn:mergeinfo
+ /trunk:191-222
Modified: branches/magalie-eugene/magalie-persistence/pom.xml
===================================================================
--- branches/magalie-eugene/magalie-persistence/pom.xml 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/pom.xml 2013-05-31 09:59:28 UTC (rev 223)
@@ -29,7 +29,7 @@
<artifactId>hibernate-jpa-2.0-api</artifactId>
</dependency>
- <!--dependency>
+ <dependency>
<groupId>org.hibernate</groupId>
<artifactId>hibernate-core</artifactId>
<scope>compile</scope>
@@ -42,10 +42,14 @@
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-c3p0</artifactId>
+ </dependency>
+
+ <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <scope>compile</scope>
- </dependency-->
+ </dependency>
<dependency>
<groupId>org.nuiton</groupId>
@@ -80,7 +84,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <scope>test</scope>
</dependency>
<!-- Test dependencies -->
@@ -131,6 +134,37 @@
</dependency>
</dependencies>
</plugin>
+ <plugin>
+ <groupId>de.juplo</groupId>
+ <artifactId>hibernate4-maven-plugin</artifactId>
+ <version>1.0.1</version>
+ <executions>
+ <execution>
+ <id>executionCreate</id>
+ <goals>
+ <goal>export</goal>
+ </goals>
+ <configuration>
+ <type>CREATE</type>
+ <outputFile>${project.build.directory}/generated-sources/Create.sql</outputFile>
+ </configuration>
+ </execution>
+ <execution>
+ <id>executionDrop</id>
+ <goals>
+ <goal>export</goal>
+ </goals>
+ <configuration>
+ <type>DROP</type>
+ <outputFile>${project.build.directory}/generated-sources/Drop.sql</outputFile>
+ </configuration>
+ </execution>
+ </executions>
+ <configuration>
+ <hibernateDialect>org.hibernate.dialect.Oracle10gDialect</hibernateDialect>
+ <target>SCRIPT</target>
+ </configuration>
+ </plugin>
</plugins>
</build>
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/Locations.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -25,6 +25,7 @@
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.google.common.base.Function;
import com.google.common.base.Predicate;
import com.google.common.base.Predicates;
import com.google.common.collect.Lists;
@@ -77,6 +78,14 @@
}
}
+ protected static class GetBarcode implements Function<Location, String> {
+
+ @Override
+ public String apply(Location location) {
+ return location.getBarcode();
+ }
+ }
+
public static Predicate<Location> accessibleLocationPredicate(MagalieUser magalieUser) {
return new AccessibleLocationPredicate(magalieUser);
}
@@ -119,4 +128,13 @@
);
return isAcceptableForReception;
}
+
+ public static Predicate<Location> barcodeEquals(String originLocationBarcode) {
+ return Predicates.compose(Predicates.equalTo(originLocationBarcode), getBarcodeFunction());
+ }
+
+ public static Function<Location, String> getBarcodeFunction() {
+ return new GetBarcode();
+ }
+
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/StoredArticles.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/StoredArticles.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/StoredArticles.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -172,4 +172,8 @@
return Functions.compose(Articles.getSupplierFunction(), getArticleFunction());
}
+ public static Predicate<StoredArticle> locationBarcodeEquals(String originLocationBarcode) {
+ return Predicates.compose(Locations.barcodeEquals(originLocationBarcode), getLocationFunction());
+ }
+
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/ArticleJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -35,9 +35,10 @@
}
@Override
- public Article findByCode(String articleCode) {
+ public Article findByCode(String articleCode) {
TypedQuery<Article> query = createQuery("from Article a where a.code = :code");
- query.setParameter(Article.PROPERTY_CODE, articleCode);
+ query.setParameter("code", articleCode);
return findUniqueOrNull(query);
}
+
}
Deleted: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/BuildingDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -1,31 +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;
-
-/** @author bleny */
-public interface BuildingDao {
-
-}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/DeliveredRequestedArticleJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -40,8 +40,8 @@
@Override
public DeliveredRequestedArticle find(StorageMovementOrder storageMovementOrder) {
TypedQuery<DeliveredRequestedArticle> query =
- createQuery(
- "from DeliveredRequestedArticle dra where dra.storageMovementOrder = :storageMovementOrder");
+ entityManager.createQuery(
+ "from DeliveredRequestedArticle dra where dra.storageMovementOrder = :storageMovementOrder", getEntityClass());
query.setParameter("storageMovementOrder", storageMovementOrder);
return findUniqueOrNull(query);
}
@@ -49,8 +49,8 @@
@Override
public List<DeliveredRequestedArticle> findAll(RequestedList requestedList) {
TypedQuery<DeliveredRequestedArticle> query =
- createQuery(
- "from DeliveredRequestedArticle dra where dra.requestedArticle.requestedList = :requestedList");
+ 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/KanbanJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/KanbanJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -38,7 +38,7 @@
@Override
public Kanban find(Article article, Warehouse warehouse) {
- TypedQuery<Kanban> query = createQuery("from Kanban k where k.article = :article and k.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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -36,4 +36,6 @@
List<Location> findAllWithoutReception(Building building);
List<Location> findAllWithoutReception(Warehouse warehouse);
+
+ Location findByBarCode(String barCode, Building building);
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationErrorJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -28,6 +28,7 @@
import com.franciaflex.magalie.persistence.entity.LocationError;
import javax.persistence.EntityManager;
+import javax.persistence.Query;
import javax.persistence.TypedQuery;
import java.util.List;
@@ -46,8 +47,7 @@
@Override
public List<Location> getAllLocationsInError(Article article) {
- TypedQuery<Location> query = createQuery(Location.class,
- "select se.location from LocationError se where se.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;
@@ -55,7 +55,7 @@
@Override
public List<LocationError> findAll() {
- TypedQuery<LocationError> query = createQuery("from LocationError se order by se.reportDate");
+ Query query = entityManager.createQuery("from LocationError se order by se.reportDate");
List<LocationError> all = query.getResultList();
return all;
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -56,11 +56,11 @@
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);
+ 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);
}
@@ -81,4 +81,14 @@
public List<Location> findAllWithoutReception(Warehouse warehouse) {
return findAllWithoutReception(null, warehouse);
}
+
+ @Override
+ public Location findByBarCode(String barCode, Building building) {
+ TypedQuery<Location> query = createQuery("from Location l " +
+ "where CONCAT(l.warehouse.code, l.code) = :barCode " +
+ "and l.warehouse.building = :building");
+ query.setParameter("barCode", barCode);
+ query.setParameter("building", building);
+ return findUniqueOrNull(query);
+ }
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/MagalieUserJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -30,7 +30,7 @@
import javax.persistence.TypedQuery;
import java.util.List;
-public class MagalieUserJpaDao extends AbstractMagalieUserJpaDao {
+public class MagalieUserJpaDao extends AbstractMagalieUserJpaDao {
public MagalieUserJpaDao(EntityManager entityManager) {
super(entityManager);
@@ -45,7 +45,7 @@
@Override
public List<MagalieUser> findAll() {
- TypedQuery<MagalieUser> query = createQuery("from MagalieUser mu order by mu.login");
+ 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/RequestedArticleJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedArticleJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -42,11 +42,11 @@
@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)");
+ "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);
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/RequestedListJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -23,8 +23,6 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.entity.RequestedList;
-
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import java.util.List;
@@ -37,7 +35,7 @@
@Override
public List<String> findAllDistinctListTypes() {
- TypedQuery<String> query = createQuery(String.class, "select distinct rl.listType from RequestedList rl");
+ 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -26,6 +26,7 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.StorageMovement;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
import java.util.List;
@@ -37,4 +38,6 @@
List<StorageMovement> findAll();
List<StorageMovement> findAllInReception(Building building);
+
+ List<StorageMovement> findAllImpactingStoredArticle(StoredArticle storedArticle);
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -27,9 +27,10 @@
import com.franciaflex.magalie.persistence.entity.Article;
import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.StorageMovement;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
+import javax.persistence.Query;
import java.util.List;
public class StorageMovementJpaDao extends AbstractStorageMovementJpaDao {
@@ -40,14 +41,14 @@
@Override
public List<StorageMovement> findAllByArticle(Article article) {
- TypedQuery<StorageMovement> query = createQuery("from StorageMovement sm where sm.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) {
- TypedQuery<StorageMovement> query = createQuery(
+ Query query = entityManager.createQuery(
" from StorageMovement sm" +
" where sm.originLocation.code = :codeForReceptionLocations and sm.originLocation.warehouse.building = :building" +
" or " +
@@ -58,8 +59,16 @@
}
@Override
+ public List<StorageMovement> findAllImpactingStoredArticle(StoredArticle storedArticle) {
+ Query query = entityManager.createQuery("from StorageMovement sm where sm.article = :article and (sm.originLocation = :location or sm.destinationLocation = :location)");
+ query.setParameter("location", storedArticle.getLocation());
+ query.setParameter("article", storedArticle.getArticle());
+ return query.getResultList();
+ }
+
+ @Override
public List<StorageMovement> findAll() {
- TypedQuery<StorageMovement> query = createQuery("from StorageMovement sm order by sm.orderDate");
+ 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/StorageMovementOrderJpaDao.java
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StorageMovementOrderJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -28,10 +28,10 @@
import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
import javax.persistence.EntityManager;
-import javax.persistence.TypedQuery;
+import javax.persistence.Query;
import java.util.List;
-public class StorageMovementOrderJpaDao extends AbstractStorageMovementOrderJpaDao{
+public class StorageMovementOrderJpaDao extends AbstractStorageMovementOrderJpaDao {
public StorageMovementOrderJpaDao(EntityManager entityManager) {
super(entityManager);
@@ -39,13 +39,13 @@
@Override
public List<StorageMovementOrder> findNotConfirmedByUser(MagalieUser magalieUser, Building building) {
- TypedQuery<StorageMovementOrder> query = createQuery(
+ 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");
+ " 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -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;
@@ -36,4 +37,9 @@
List<StoredArticle> findAllReceivedForAllSupplier(Building building);
List<StoredArticle> findAllReceivedForSupplier(Building building, String supplierId);
+
+ StoredArticle findDetachedById(String storedArticleId);
+
+ List<StoredArticle> findAllByLocation(Location location);
+
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoredArticleJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -26,6 +26,7 @@
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.Location;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import javax.persistence.EntityManager;
@@ -74,4 +75,22 @@
}
return resultList;
}
+
+ @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);
+ return storedArticle;
+ }
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/SupplierJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -25,9 +25,7 @@
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;
@@ -42,8 +40,8 @@
@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());
+ query.setParameter("building", building);
+ query.setParameter("code", Locations.codeForReceptionLocations());
return findAll(query);
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/UnavailableArticleJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -39,8 +39,8 @@
@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);
+ query.setParameter("article", article);
+ query.setParameter("building", building);
return findUniqueOrNull(query);
}
}
Modified: 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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseJpaDao.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -39,9 +39,9 @@
@Override
public List<Warehouse> findAllWithoutLocations(Building building) {
- TypedQuery<Warehouse> 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());
+ 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("building", building);
+ query.setParameter("code", Locations.codeForWarehouseWithoutLocations());
return query.getResultList();
}
}
Modified: branches/magalie-eugene/magalie-persistence/src/main/resources/magalie.properties
===================================================================
--- branches/magalie-eugene/magalie-persistence/src/main/resources/magalie.properties 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-persistence/src/main/resources/magalie.properties 2013-05-31 09:59:28 UTC (rev 223)
@@ -29,3 +29,7 @@
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
+hibernate.c3p0.min_size=5
+hibernate.c3p0.max_size=20
+hibernate.c3p0.timeout=1800
+hibernate.c3p0.max_statements=50
Modified: branches/magalie-eugene/magalie-services/pom.xml
===================================================================
--- branches/magalie-eugene/magalie-services/pom.xml 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-services/pom.xml 2013-05-31 09:59:28 UTC (rev 223)
@@ -35,11 +35,6 @@
</dependency>
<dependency>
- <groupId>org.mockito</groupId>
- <artifactId>mockito-core</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
</dependency>
@@ -83,7 +78,6 @@
<dependency>
<groupId>log4j</groupId>
<artifactId>log4j</artifactId>
- <scope>test</scope>
</dependency>
<!-- Test dependencies -->
Copied: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java (from rev 222, trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java)
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java (rev 0)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/SimpleWithdrawItemTask.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,36 @@
+package com.franciaflex.magalie.services;
+
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+import com.google.common.base.Preconditions;
+import com.google.common.collect.Lists;
+
+import java.util.List;
+
+public class SimpleWithdrawItemTask {
+
+ protected List<StoredArticle> storedArticles;
+
+ protected boolean driverLicenseRequired;
+
+ protected boolean articleUnavailable;
+
+ public SimpleWithdrawItemTask(Iterable<StoredArticle> storedArticles, boolean driverLicenseRequired, boolean articleUnavailable) {
+ this.storedArticles = Lists.newArrayList(storedArticles);
+ this.driverLicenseRequired = driverLicenseRequired;
+ this.articleUnavailable = articleUnavailable;
+ }
+
+ public List<StoredArticle> getStoredArticles() {
+ return storedArticles;
+ }
+
+ public boolean isDriverLicenseRequired() {
+ Preconditions.checkState( ! articleUnavailable);
+ return driverLicenseRequired;
+ }
+
+ public boolean isArticleUnavailable() {
+ Preconditions.checkState( ! driverLicenseRequired);
+ return articleUnavailable;
+ }
+}
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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -24,6 +24,7 @@
*/
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
+import com.franciaflex.magalie.persistence.StorageMovements;
import com.franciaflex.magalie.persistence.StoredArticles;
import com.franciaflex.magalie.persistence.dao.LocationJpaDao;
import com.franciaflex.magalie.persistence.dao.StorageMovementDao;
@@ -43,10 +44,10 @@
import com.franciaflex.magalie.services.StorageMovementConfirmation;
import com.franciaflex.magalie.services.StorageMovementTask;
import com.google.common.base.Preconditions;
-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.Multimap;
+import com.google.common.collect.Multimaps;
import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
import org.apache.commons.collections.CollectionUtils;
@@ -326,6 +327,8 @@
}
}
+ // TODO brendan 27/05/13 add extra info about the locations
+
return storageMovementTask;
}
@@ -340,61 +343,75 @@
// first get all stored articles in the building at known quantities
Iterable<StoredArticle> storedArticles = storedArticleDao.findAllForArticleInBuilding(article, building);
- ImmutableMap<Location, StoredArticle> storedArticlesByLocation =
- Maps.uniqueIndex(
- storedArticles,
- StoredArticles.getLocationFunction()
- );
+ StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+ List<StorageMovement> storageMovementsForArticle = storageMovementDao.findAllByArticle(article);
+
// consider storage movements and compute actually available quantities
+ storedArticles = computeActualQuantities(storedArticles, storageMovementsForArticle);
- StorageMovementDao storageMovementDao = persistenceContext.getStorageMovementDao();
+ // exclude storageMovements on a location reported in error
+ LocationErrorsService locationErrorsService = serviceContext.newService(LocationErrorsService.class);
- // consider all storage movements, adding quantities when someone added some stock and
- // removing quantities if someone has withdraw quantities
- List<StorageMovement> storageMovements = storageMovementDao.findAllByArticle(article);
+ List<Location> allLocationsInError = locationErrorsService.getAllLocationsInError(article);
- for (StorageMovement storageMovement : storageMovements) {
+ storedArticles = Iterables.filter(storedArticles, StoredArticles.articleNotStoredInLocationReportedInError(allLocationsInError));
- Location originLocation = storageMovement.getOriginLocation();
+ return storedArticles;
- StoredArticle storedArticle = storedArticlesByLocation.get(originLocation);
+ }
- if (storedArticle != null) {
+ /**
+ * This method take some storedArticles and update the quantities according
+ * to given storage movements (adding or removing quantities depending if it's
+ * a movement from the location or to the location)
+ */
+ protected Iterable<StoredArticle> computeActualQuantities(Iterable<StoredArticle> storedArticles, Iterable<StorageMovement> storageMovements) {
- double actualQuantity = storedArticle.getQuantity() - storageMovement.getQuantity();
+ Multimap<Article, StoredArticle> storedArticlesByArticles =
+ Multimaps.index(storedArticles, StoredArticles.getArticleFunction());
- storedArticle.setQuantity(actualQuantity);
- }
+ Multimap<Article, StorageMovement> allStorageMovementsInReceptionByArticle =
+ Multimaps.index(storageMovements, StorageMovements.getArticleFunction());
- Location destinationLocation = storageMovement.getDestinationLocation();
+ for (Map.Entry<Article, StoredArticle> articleStored : storedArticlesByArticles.entries()) {
- storedArticle = storedArticlesByLocation.get(destinationLocation);
+ Article article = articleStored.getKey();
- if (storedArticle != null) {
+ StoredArticle storedArticle = articleStored.getValue();
- double actualQuantity = storedArticle.getQuantity() + storageMovement.getQuantity();
+ Location location = storedArticle.getLocation();
- storedArticle.setQuantity(actualQuantity);
+ for (StorageMovement storageMovement : allStorageMovementsInReceptionByArticle.get(article)) {
- }
+ if (storageMovement.getOriginLocation().equals(location)) {
- }
+ double actualQuantity = storedArticle.getQuantity() - storageMovement.getQuantity();
- // don't mention location if stored quantity is 0.
+ storedArticle.setQuantity(actualQuantity);
- storedArticles = Iterables.filter(storedArticles, StoredArticles.notEmpty());
+ }
- // exclude storageMovements on a location reported in error
+ if (storageMovement.getDestinationLocation().equals(location)) {
- LocationErrorsService locationErrorsService = serviceContext.newService(LocationErrorsService.class);
+ double actualQuantity = storedArticle.getQuantity() + storageMovement.getQuantity();
- List<Location> allLocationsInError = locationErrorsService.getAllLocationsInError(article);
+ storedArticle.setQuantity(actualQuantity);
- storedArticles = Iterables.filter(storedArticles, StoredArticles.articleNotStoredInLocationReportedInError(allLocationsInError));
+ }
- return storedArticles;
+ }
+ }
+
+ // Warning :
+ // this function don't add a new StoredArticle
+ // if exist a storage movement with new article in location
+
+ Iterable<StoredArticle> result = Iterables.filter(storedArticles, StoredArticles.notEmpty());
+
+ return result;
+
}
public void confirmStorageMovement(StorageMovementConfirmation confirmation, MagalieUser magalieUser) {
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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -23,10 +23,8 @@
* #L%
*/
-import com.franciaflex.magalie.persistence.Locations;
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
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;
@@ -92,8 +90,12 @@
Building building = destinationWarehouse.getBuilding();
- Location destinationLocation = getDestinationLocation(destinationWarehouse);
+ SimpleWithdrawItemService simpleWithdrawItemService =
+ serviceContext.newService(SimpleWithdrawItemService.class);
+ Location destinationLocation =
+ simpleWithdrawItemService.getDestinationLocation(destinationWarehouse);
+
BookArticleRequest bookArticleRequest =
new BookArticleRequest(
magalieUser, building, article,
@@ -106,18 +108,6 @@
}
- protected Location getDestinationLocation(Warehouse destinationWarehouse) {
-
- MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
-
- LocationDao locationDao = persistenceContext.getLocationDao();
-
- Location location = locationDao.find(Locations.codeForWarehouseWithoutLocations(), destinationWarehouse);
-
- return location;
-
- }
-
public List<Warehouse> getDestinationWarehouses(Building building) {
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ReceptionService.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -25,7 +25,6 @@
import com.franciaflex.magalie.persistence.Locations;
import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
-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.LocationJpaDao;
@@ -47,8 +46,6 @@
import com.franciaflex.magalie.services.MagalieServiceContext;
import com.google.common.collect.Iterables;
import com.google.common.collect.Lists;
-import com.google.common.collect.Multimap;
-import com.google.common.collect.Multimaps;
import com.google.common.collect.Ordering;
import com.google.common.collect.Sets;
@@ -112,36 +109,11 @@
List<StorageMovement> allStorageMovementsInReception =
storageMovementDao.findAllInReception(building);
- Multimap<Article, StoredArticle> storedArticlesByArticles =
- Multimaps.index(receivedArticles, StoredArticles.getArticleFunction());
+ ArticleStorageService articleStorageService =
+ serviceContext.newService(ArticleStorageService.class);
- Multimap<Article, StorageMovement> allStorageMovementsInReceptionByArticle =
- Multimaps.index(allStorageMovementsInReception, StorageMovements.getArticleFunction());
+ receivedArticles = articleStorageService.computeActualQuantities(receivedArticles, allStorageMovementsInReception);
- for (Map.Entry<Article, StoredArticle> articleStored : storedArticlesByArticles.entries()) {
-
- Article article = articleStored.getKey();
-
- StoredArticle storedArticle = articleStored.getValue();
-
- Location location = storedArticle.getLocation();
-
- for (StorageMovement storageMovement : allStorageMovementsInReceptionByArticle.get(article)) {
-
- if (storageMovement.getOriginLocation().equals(location)) {
-
- double actualQuantity = storedArticle.getQuantity() - storageMovement.getQuantity();
-
- storedArticle.setQuantity(actualQuantity);
-
- }
-
- }
-
- }
-
- receivedArticles = Iterables.filter(receivedArticles, StoredArticles.notEmpty());
-
return Lists.newArrayList(receivedArticles);
}
@@ -151,15 +123,30 @@
MagaliePersistenceContext persistenceContext =
serviceContext.getPersistenceContext();
- StoredArticleJpaDao storedArticleDao = persistenceContext.getStoredArticleDao();
+ StoredArticleJpaDao storedArticleDao =
+ persistenceContext.getStoredArticleDao();
StoredArticle storedArticle =
- storedArticleDao.findById(storedArticleId);
+ storedArticleDao.findDetachedById(storedArticleId);
- // FIXME brendan 23/05/13 déduire de la quantité les mouvements de stocks
+ StorageMovementDao storageMovementDao =
+ persistenceContext.getStorageMovementDao();
- double quantity = storedArticle.getQuantity();
+ List<StorageMovement> allStorageMovementsImpactingStoredArticle =
+ storageMovementDao.findAllImpactingStoredArticle(storedArticle);
+ ArticleStorageService articleStorageService =
+ serviceContext.newService(ArticleStorageService.class);
+
+ Iterable<StoredArticle> storedArticleSingleton = Lists.newArrayList(storedArticle);
+
+ storedArticleSingleton =
+ articleStorageService.computeActualQuantities(
+ storedArticleSingleton,
+ allStorageMovementsImpactingStoredArticle);
+
+ double quantity = Iterables.getOnlyElement(storedArticleSingleton).getQuantity();
+
ReceptionTask receptionTask = buildReceptionTask(storedArticle, quantity);
return receptionTask;
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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -62,6 +62,7 @@
protected MagalieServiceContext serviceContext;
+ @Override
public void setServiceContext(MagalieServiceContext serviceContext) {
this.serviceContext = serviceContext;
}
Copied: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java (from rev 222, trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java)
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java (rev 0)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemService.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,136 @@
+package com.franciaflex.magalie.services.service;
+
+import com.franciaflex.magalie.persistence.Locations;
+import com.franciaflex.magalie.persistence.MagaliePersistenceContext;
+import com.franciaflex.magalie.persistence.StoredArticles;
+import com.franciaflex.magalie.persistence.dao.LocationDao;
+import com.franciaflex.magalie.persistence.dao.StorageMovementJpaDao;
+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.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.persistence.entity.Warehouse;
+import com.franciaflex.magalie.services.MagalieService;
+import com.franciaflex.magalie.services.MagalieServiceContext;
+import com.franciaflex.magalie.services.SimpleWithdrawItemTask;
+import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+
+import java.util.Date;
+
+public class SimpleWithdrawItemService implements MagalieService {
+
+ private static final Log log = LogFactory.getLog(SimpleWithdrawItemService.class);
+
+ protected MagalieServiceContext serviceContext;
+
+ @Override
+ public void setServiceContext(MagalieServiceContext serviceContext) {
+ this.serviceContext = serviceContext;
+ }
+
+ public SimpleWithdrawItemTask getSimpleWithdrawItemTask(Building building, MagalieUser magalieUser, String articleBarcode) throws InvalidMagalieBarcodeException {
+
+ ArticleStorageService articleStorageService =
+ serviceContext.newService(ArticleStorageService.class);
+
+ MagalieBarcodeService magalieBarcodeService =
+ serviceContext.newService(MagalieBarcodeService.class);
+
+ Article article = magalieBarcodeService.getArticle(articleBarcode);
+
+ Iterable<StoredArticle> storedArticles =
+ articleStorageService.getStoredArticles(building, article);
+
+ Predicate<StoredArticle> articleStoredInAccessibleLocationPredicate =
+ StoredArticles.articleStoredInAccessibleLocationPredicate(magalieUser);
+
+ boolean articleIsAccessible =
+ Iterables.any(
+ storedArticles,
+ articleStoredInAccessibleLocationPredicate);
+
+ boolean articleUnavailable = Iterables.isEmpty(storedArticles);
+
+ storedArticles = Iterables.filter(storedArticles, articleStoredInAccessibleLocationPredicate);
+
+ SimpleWithdrawItemTask simpleWithdrawItemTask =
+ new SimpleWithdrawItemTask(storedArticles, ! articleIsAccessible, articleUnavailable);
+
+ return simpleWithdrawItemTask;
+
+ }
+
+ public void confirmStorageMovement(MagalieUser magalieUser, String destinationWarehouseId, StoredArticle storedArticle) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ WarehouseJpaDao warehouseDao = persistenceContext.getWarehouseDao();
+
+ Date now = serviceContext.getNow();
+
+ // principle is taking a stored article and get everything (all quantity)
+
+ Location originLocation = storedArticle.getLocation();
+
+ Article article = storedArticle.getArticle();
+
+ double quantity = storedArticle.getQuantity();
+
+ if (log.isInfoEnabled()) {
+ log.info("user " + magalieUser.getLogin() + " took " +
+ quantity + " " + article.getUnit() + " from " +
+ originLocation.getBarcode());
+ }
+
+ // find actual destination location
+
+ Warehouse destinationWarehouse = warehouseDao.findById(destinationWarehouseId);
+
+ Location destinationLocation = getDestinationLocation(destinationWarehouse);
+
+ // create new storage movement
+
+ StorageMovement storageMovement = new StorageMovement();
+
+ storageMovement.setOriginLocation(originLocation);
+
+ storageMovement.setDestinationLocation(destinationLocation);
+
+ storageMovement.setMagalieUser(magalieUser);
+
+ storageMovement.setArticle(article);
+
+ storageMovement.setActualQuantity(quantity);
+
+ storageMovement.setConfirmDate(now);
+
+ // save storage movement
+
+ StorageMovementJpaDao storageMovementDao = persistenceContext.getStorageMovementDao();
+
+ storageMovementDao.persist(storageMovement);
+
+ persistenceContext.commit();
+
+ }
+
+ protected Location getDestinationLocation(Warehouse destinationWarehouse) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ LocationDao locationDao = persistenceContext.getLocationDao();
+
+ Location location = locationDao.find(Locations.codeForWarehouseWithoutLocations(), destinationWarehouse);
+
+ return location;
+
+ }
+
+}
Copied: branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java (from rev 222, trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java)
===================================================================
--- branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java (rev 0)
+++ branches/magalie-eugene/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,125 @@
+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.LocationJpaDao;
+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.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.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;
+
+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, Building building) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ LocationDao locationDao = persistenceContext.getLocationDao();
+
+ Location location = locationDao.findByBarCode(barCode, building);
+
+ return location;
+ }
+
+ public Location getLocationById(String id) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ LocationJpaDao 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) {
+
+ Preconditions.checkArgument(storedArticleId != null);
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ StoredArticleJpaDao storedArticleDao = persistenceContext.getStoredArticleDao();
+
+ StoredArticle storedArticle = storedArticleDao.findById(storedArticleId);
+
+ return storedArticle;
+ }
+
+ public void confirmStorageTransfer(MagalieUser magalieUser, StoredArticle storedArticle, double quantity, Location destinationLocation) {
+
+ MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
+
+ StorageMovementJpaDao 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();
+ }
+}
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-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ReceptionServiceTest.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -24,12 +24,12 @@
*/
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;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.PreparedArticleReception;
import com.franciaflex.magalie.persistence.entity.StorageMovement;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import com.franciaflex.magalie.persistence.entity.Supplier;
@@ -202,7 +202,7 @@
}
@Test
- public void testWeCannotReceiveTheSameItemMultipleTime() throws Exception {
+ public void testWeCannotReceiveTheSameItemMultipleTime() {
testConfirmReception();
@@ -220,4 +220,20 @@
Assert.assertTrue(suppliers.isEmpty());
}
+
+ @Test
+ public void testReceivePreparedReception() {
+
+ PreparedArticleReception preparedArticleReception =
+ service.getPreparedArticleReception("PAR2");
+
+ Assert.assertNotNull(preparedArticleReception);
+
+ ReceptionTask receptionTask =
+ service.getReceptionTaskForPreparedArticleReception("PAR2");
+
+ Assert.assertEquals(4., receptionTask.getQuantity(), DELTA);
+
+ }
+
}
Copied: branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java (from rev 222, trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java)
===================================================================
--- branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java (rev 0)
+++ branches/magalie-eugene/magalie-services/src/test/java/com/franciaflex/magalie/services/service/SimpleWithdrawItemServiceTest.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,97 @@
+package com.franciaflex.magalie.services.service;
+
+import com.franciaflex.magalie.persistence.StoredArticles;
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+import com.franciaflex.magalie.services.AbstractMagalieServiceTest;
+import com.franciaflex.magalie.services.SimpleWithdrawItemTask;
+import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException;
+import com.google.common.base.Predicate;
+import com.google.common.collect.Iterables;
+import org.apache.commons.logging.Log;
+import org.apache.commons.logging.LogFactory;
+import org.junit.Assert;
+import org.junit.Before;
+import org.junit.Test;
+
+import java.text.ParseException;
+import java.util.Date;
+import java.util.List;
+
+public class SimpleWithdrawItemServiceTest extends AbstractMagalieServiceTest {
+
+ private static final Log log = LogFactory.getLog(SimpleWithdrawItemServiceTest.class);
+
+ protected SimpleWithdrawItemService service;
+
+ protected MagalieUser magalieUser;
+
+ protected Building building;
+
+ @Before
+ public void setUp() throws ParseException {
+
+ loadFixtures("fixtures");
+
+ service = newService(SimpleWithdrawItemService.class);
+
+ serviceContext.setDate(new Date(1363948427576l));
+
+ magalieUser = fixture("bruno");
+
+ building = fixture("B1");
+ }
+
+ @Test
+ public void testSimpleWithdraw() throws InvalidMagalieBarcodeException {
+
+ Article article = fixture("article2");
+
+ SimpleWithdrawItemTask simpleWithdrawItemTask =
+ service.getSimpleWithdrawItemTask(building, magalieUser, article.getCode());
+
+ Assert.assertFalse(simpleWithdrawItemTask.isDriverLicenseRequired());
+
+ Assert.assertFalse(simpleWithdrawItemTask.isArticleUnavailable());
+
+ List<StoredArticle> storedArticles = simpleWithdrawItemTask.getStoredArticles();
+
+ Predicate<StoredArticle> articleStoredInAccessibleLocationPredicate =
+ StoredArticles.articleStoredInAccessibleLocationPredicate(magalieUser);
+
+ Assert.assertTrue(Iterables.all(storedArticles, articleStoredInAccessibleLocationPredicate));
+
+ Assert.assertEquals(3, storedArticles.size());
+
+ }
+
+ @Test
+ public void testSimpleWithdrawWithoutDriverLicense() throws InvalidMagalieBarcodeException {
+
+ magalieUser = fixture("corinne");
+
+ Article article = fixture("article1");
+
+ SimpleWithdrawItemTask simpleWithdrawItemTask =
+ service.getSimpleWithdrawItemTask(building, magalieUser, article.getCode());
+
+ Assert.assertFalse(simpleWithdrawItemTask.isDriverLicenseRequired());
+
+ Assert.assertFalse(simpleWithdrawItemTask.isArticleUnavailable());
+
+ List<StoredArticle> storedArticles = simpleWithdrawItemTask.getStoredArticles();
+
+ Predicate<StoredArticle> articleStoredInAccessibleLocationPredicate =
+ StoredArticles.articleStoredInAccessibleLocationPredicate(magalieUser);
+
+ Assert.assertTrue(
+ "all given locations must be accessible for user",
+ Iterables.all(storedArticles, articleStoredInAccessibleLocationPredicate));
+
+ Assert.assertEquals(1, storedArticles.size());
+
+ }
+
+}
Modified: branches/magalie-eugene/magalie-services/src/test/resources/log4j.properties
===================================================================
--- branches/magalie-eugene/magalie-services/src/test/resources/log4j.properties 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-services/src/test/resources/log4j.properties 2013-05-31 09:59:28 UTC (rev 223)
@@ -29,3 +29,4 @@
# log4j.logger.com.franciaflex.magalie=TRACE
# log4j.logger.org.hibernate.tool.hbm2ddl.SchemaExport=FATAL
+log4j.logger.org.nuiton.jpa.api.hibernate.HibernateUtil=TRACE
Modified: branches/magalie-eugene/magalie-web/pom.xml
===================================================================
--- branches/magalie-eugene/magalie-web/pom.xml 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/pom.xml 2013-05-31 09:59:28 UTC (rev 223)
@@ -122,6 +122,7 @@
<dependency>
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
+ <scope>runtime</scope>
</dependency>
<dependency>
@@ -130,13 +131,7 @@
<scope>runtime</scope>
</dependency>
- <!-- Test dependencies -->
<dependency>
- <groupId>junit</groupId>
- <artifactId>junit</artifactId>
- </dependency>
-
- <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>runtime</scope>
Modified: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/Activity.java
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/Activity.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/Activity.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -32,6 +32,9 @@
public enum Activity {
REQUESTED_LISTS,
- KANBANS
+ KANBANS,
+ SIMPLE_WITHDRAW,
+ RECEPTIONS,
+ PREPARED_RECEPTIONS
}
Modified: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -44,6 +44,7 @@
@Results({
+ @Result(name="input", type = "dispatcher", location = "/WEB-INF/content/prepare-withdraw-item-input.jsp"),
@Result(name="success", type="redirectAction", params = { "actionName", "withdraw-item!input", "storageMovementOrderId", "${storageMovementOrderId}" })
})
public class FulfilKanbanAction extends MagalieActionSupport implements Preparable {
Modified: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareArticleReceptionAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -27,6 +27,7 @@
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import com.franciaflex.magalie.services.service.ReceptionService;
import com.franciaflex.magalie.services.service.SuppliersToReceive;
+import com.franciaflex.magalie.web.Activity;
import com.franciaflex.magalie.web.MagalieActionSupport;
import com.franciaflex.magalie.web.MagalieSession;
@@ -59,6 +60,8 @@
@Override
public String input() {
+ session.setActivity(Activity.RECEPTIONS);
+
Building building = session.getBuilding();
suppliersToReceive = service.getReceivedSuppliers(building);
Modified: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PreparePreparedArticleReceptionAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -2,7 +2,9 @@
import com.franciaflex.magalie.persistence.entity.PreparedArticleReception;
import com.franciaflex.magalie.services.service.ReceptionService;
+import com.franciaflex.magalie.web.Activity;
import com.franciaflex.magalie.web.MagalieActionSupport;
+import com.franciaflex.magalie.web.MagalieSession;
import org.apache.struts2.convention.annotation.Result;
import org.apache.struts2.convention.annotation.Results;
@@ -15,6 +17,12 @@
protected String barcode;
+ protected MagalieSession session;
+
+ public void setSession(MagalieSession session) {
+ this.session = session;
+ }
+
public void setReceptionService(ReceptionService receptionService) {
this.receptionService = receptionService;
}
@@ -26,6 +34,8 @@
@Override
public String execute() {
+ session.setActivity(Activity.PREPARED_RECEPTIONS);
+
PreparedArticleReception preparedArticleReception =
receptionService.getPreparedArticleReception(barcode);
Copied: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java (from rev 222, trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/PrepareWithdrawItemAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,156 @@
+package com.franciaflex.magalie.web.action;
+
+import com.franciaflex.magalie.persistence.entity.Article;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.StorageMovementOrder;
+import com.franciaflex.magalie.persistence.entity.Warehouse;
+import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException;
+import com.franciaflex.magalie.services.service.FulfilKanbanService;
+import com.franciaflex.magalie.services.service.SimpleWithdrawItemService;
+import com.franciaflex.magalie.web.Activity;
+import com.franciaflex.magalie.web.MagalieActionSupport;
+import com.franciaflex.magalie.web.MagalieSession;
+import com.opensymphony.xwork2.Preparable;
+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;
+
+@Results({
+ @Result(name="success", type="redirectAction", params = { "actionName", "simple-withdraw-item!input", "articleBarcode", "${articleBarcode}", "destinationWarehouseId", "${destinationWarehouseId}"})
+})
+public class PrepareWithdrawItemAction extends MagalieActionSupport implements Preparable {
+
+ private static final Log log = LogFactory.getLog(PrepareWithdrawItemAction.class);
+
+ protected MagalieSession session;
+
+ protected String articleBarcode;
+
+ protected StorageMovementOrder storageMovementOrder;
+
+ protected List<Warehouse> destinationWarehouses;
+
+ protected String destinationWarehouseId;
+
+ protected Double quantity;
+
+ protected boolean askQuantity;
+
+ protected Article article;
+
+ protected Warehouse destinationWarehouse;
+
+ protected FulfilKanbanService fulfilKanbanService;
+
+ protected SimpleWithdrawItemService simpleWithdrawItemService;
+
+ public void setSession(MagalieSession session) {
+ this.session = session;
+ }
+
+ public void setFulfilKanbanService(FulfilKanbanService fulfilKanbanService) {
+ this.fulfilKanbanService = fulfilKanbanService;
+ }
+
+ public void setSimpleWithdrawItemService(SimpleWithdrawItemService simpleWithdrawItemService) {
+ this.simpleWithdrawItemService = simpleWithdrawItemService;
+ }
+
+ @Override
+ public void prepare() {
+
+ Building building = session.getBuilding();
+
+ destinationWarehouses = fulfilKanbanService.getDestinationWarehouses(building);
+
+ // let's help user by selecting by default the previously used destination warehouse
+
+ Warehouse lastUsedDestinationWarehouseForKanbans = session.getLastUsedDestinationWarehouseForKanbans();
+
+ if (lastUsedDestinationWarehouseForKanbans != null) {
+
+ destinationWarehouseId = lastUsedDestinationWarehouseForKanbans.getId();
+
+ }
+
+ }
+
+ public boolean isAskQuantity() {
+ return askQuantity;
+ }
+
+ public String getDestinationWarehouseId() {
+ return destinationWarehouseId;
+ }
+
+ public List<Warehouse> getDestinationWarehouses() {
+ return destinationWarehouses;
+ }
+
+ public void setArticleBarcode(String articleBarcode) {
+ this.articleBarcode = articleBarcode;
+ }
+
+ public void setDestinationWarehouseId(String destinationWarehouseId) {
+ this.destinationWarehouseId = destinationWarehouseId;
+ }
+
+ public void setQuantity(Double quantity) {
+ this.quantity = quantity;
+ }
+
+ @Override
+ public void validate() {
+
+ if (log.isDebugEnabled()) {
+ log.debug("article barcode is " + articleBarcode);
+ }
+
+ destinationWarehouse = fulfilKanbanService.getStore(destinationWarehouseId);
+
+ // save used destination warehouse to propose it by default on next kanban
+ session.setLastUsedDestinationWarehouseForKanbans(destinationWarehouse);
+
+ try {
+
+ article = fulfilKanbanService.getArticle(articleBarcode);
+
+ } catch (InvalidMagalieBarcodeException e) {
+
+ addFieldError("articleBarcode", "Le code barre n'est pas un code valide");
+
+ }
+
+ if (quantity != null) {
+
+ addFieldError("quantity", "Il ne faut pas préciser la quantité");
+
+ }
+
+ }
+
+ @Override
+ public String execute() {
+
+ session.setActivity(Activity.SIMPLE_WITHDRAW);
+
+ return SUCCESS;
+
+ }
+
+ public Article getArticle() {
+ return article;
+ }
+
+ public String getArticleBarcode() {
+ return articleBarcode;
+ }
+
+ public String getStorageMovementOrderId() {
+ return storageMovementOrder.getId();
+ }
+
+}
Modified: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ReceiveArticleAction.java
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ReceiveArticleAction.java 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/ReceiveArticleAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -42,7 +42,8 @@
import java.util.Map;
@Results({
- @Result(name="success", type="redirectAction", params = { "actionName", "prepare-article-reception!input" })
+ @Result(name= "RECEPTIONS", type="redirectAction", params = { "actionName", "prepare-article-reception!input" }),
+ @Result(name= "PREPARED_RECEPTIONS", type="redirectAction", params = { "actionName", "prepare-prepared-article-reception!input" })
})
public class ReceiveArticleAction extends MagalieActionSupport {
@@ -130,7 +131,7 @@
service.confirmReception(magalieUser, confirmation);
- return SUCCESS;
+ return session.getActivity().name();
}
Copied: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java (from rev 222, trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/SimpleWithdrawItemAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,150 @@
+package com.franciaflex.magalie.web.action;
+
+import com.franciaflex.magalie.persistence.StoredArticles;
+import com.franciaflex.magalie.persistence.entity.Building;
+import com.franciaflex.magalie.persistence.entity.MagalieUser;
+import com.franciaflex.magalie.persistence.entity.StoredArticle;
+import com.franciaflex.magalie.services.SimpleWithdrawItemTask;
+import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException;
+import com.franciaflex.magalie.services.service.SimpleWithdrawItemService;
+import com.franciaflex.magalie.web.MagalieActionSupport;
+import com.franciaflex.magalie.web.MagalieSession;
+import com.google.common.base.Optional;
+import com.google.common.collect.Iterables;
+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;
+
+@Results({
+ @Result(name="success", type="redirectAction", params = { "actionName", "prepare-withdraw-item!input" }),
+ @Result(name="error", type="redirectAction", params = { "actionName", "prepare-withdraw-item!input" })
+})
+public class SimpleWithdrawItemAction extends MagalieActionSupport {
+
+ private static final Log log = LogFactory.getLog(SimpleWithdrawItemAction.class);
+
+ protected SimpleWithdrawItemService service;
+
+ protected String storedArticleId;
+
+ protected String articleBarcode;
+
+ protected MagalieSession session;
+
+ protected SimpleWithdrawItemTask simpleWithdrawItemTask;
+
+ protected String destinationWarehouseId;
+
+ protected String originLocationBarcode;
+
+ public void setSession(MagalieSession session) {
+ this.session = session;
+ }
+
+ public void setArticleBarcode(String articleBarcode) {
+ this.articleBarcode = articleBarcode;
+ }
+
+ public void setDestinationWarehouseId(String destinationWarehouseId) {
+ this.destinationWarehouseId = destinationWarehouseId;
+ }
+
+ public void setService(SimpleWithdrawItemService service) {
+ this.service = service;
+ }
+
+ @Override
+ public String input() {
+
+ Building building = session.getBuilding();
+
+ MagalieUser magalieUser = session.getMagalieUser();
+
+ try {
+
+ simpleWithdrawItemTask = service.getSimpleWithdrawItemTask(building, magalieUser, articleBarcode);
+
+ } catch (InvalidMagalieBarcodeException e) {
+
+ log.error("should never occur, barcode is validated before arriving in this action", e);
+
+ session.addMessage("Le code barre " + articleBarcode + " n'est pas un code valide");
+
+ return ERROR;
+
+ }
+
+ if (simpleWithdrawItemTask.isDriverLicenseRequired()) {
+
+ session.addMessage("Un permis est requis pour accéder à cet article");
+
+ return ERROR;
+
+ }
+
+ if (simpleWithdrawItemTask.isArticleUnavailable()) {
+
+ session.addMessage("Cet article n'est pas disponible");
+
+ return ERROR;
+
+ }
+
+ return INPUT;
+
+ }
+
+ public String getDestinationWarehouseId() {
+ return destinationWarehouseId;
+ }
+
+ public String getArticleBarcode() {
+ return articleBarcode;
+ }
+
+ public SimpleWithdrawItemTask getSimpleWithdrawItemTask() {
+ return simpleWithdrawItemTask;
+ }
+
+ public void setStoredArticleId(String storedArticleId) {
+ this.storedArticleId = storedArticleId;
+ }
+
+ public void setOriginLocationBarcode(String originLocationBarcode) {
+ this.originLocationBarcode = originLocationBarcode;
+ }
+
+ @Override
+ public String execute() throws InvalidMagalieBarcodeException {
+
+ MagalieUser magalieUser = session.getMagalieUser();
+
+ Building building = session.getBuilding();
+
+ simpleWithdrawItemTask = service.getSimpleWithdrawItemTask(building, magalieUser, articleBarcode);
+
+ Optional<StoredArticle> storedArticleOptional =
+ Iterables.tryFind(
+ simpleWithdrawItemTask.getStoredArticles(),
+ StoredArticles.locationBarcodeEquals(originLocationBarcode));
+
+ if (storedArticleOptional.isPresent()) {
+
+ service.confirmStorageMovement(
+ magalieUser, destinationWarehouseId,
+ storedArticleOptional.get());
+
+ } else {
+
+ addFieldError("originLocationBarcode", "Ce n'est pas le code-barre d'un emplacement valide");
+
+ return INPUT;
+
+ }
+
+ return SUCCESS;
+
+ }
+
+}
Copied: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java (from rev 222, trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,162 @@
+package com.franciaflex.magalie.web.action;
+
+import com.franciaflex.magalie.persistence.entity.Building;
+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-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 StoredArticle storedArticle;
+
+ 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() {
+
+ if (log.isDebugEnabled()) {
+ log.debug("originId : " + originId + "\n" +
+ "storedArticleId : " + storedArticleId);
+ }
+
+ origin = service.getLocationById(originId);
+
+ storedArticles = service.getStoredArticlesInLocation(origin);
+
+ if (storedArticleId != null) {
+ storedArticle = service.findStoredArticle(storedArticleId);
+ quantity = storedArticle.getQuantity();
+ }
+
+ return INPUT;
+ }
+
+ public Location getOrigin() {
+ return origin;
+ }
+
+ public List<StoredArticle> getStoredArticles() {
+ return storedArticles;
+ }
+
+ public String getStoredArticleId() {
+ return storedArticleId;
+ }
+
+ public StoredArticle getStoredArticle() {
+ return storedArticle;
+ }
+
+ public double getQuantity() {
+ return quantity;
+ }
+
+ public String getDestinationBarCode (){
+ return destinationBarCode;
+ }
+
+ 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);
+
+ 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;
+ }
+
+ Building building = session.getBuilding();
+
+ Location destination = service.getLocationByBarCode(destinationBarCode, building);
+
+ 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;
+ }
+
+}
Copied: branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java (from rev 222, trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,80 @@
+package com.franciaflex.magalie.web.action;
+
+import com.franciaflex.magalie.persistence.entity.Building;
+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);
+ }
+
+ Building building = session.getBuilding();
+
+ origin = service.getLocationByBarCode(originBarCode, building);
+
+ 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: branches/magalie-eugene/magalie-web/src/main/resources/struts.properties
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/resources/struts.properties 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/resources/struts.properties 2013-05-31 09:59:28 UTC (rev 223)
@@ -24,13 +24,13 @@
struts.ognl.allowStaticMethodAccess=true
# Help debugging
-struts.devMode=true
-struts.ognl.logMissingProperties=true
-struts.el.throwExceptionOnFailure=true
-struts.i18n.reload=true
+struts.devMode=${devMode}
+struts.ognl.logMissingProperties=${devMode}
+struts.el.throwExceptionOnFailure=${devMode}
+struts.i18n.reload=${devMode}
struts.custom.i18n.resources=resources
-struts.configuration.xml.reload=true
-struts.convention.classes.reload=true
+struts.configuration.xml.reload=${devMode}
+struts.convention.classes.reload=${devMode}
# Performance tuning
# see http://struts.apache.org/2.2.3/docs/performance-tuning.html
Modified: branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp 2013-05-31 09:59:28 UTC (rev 223)
@@ -33,8 +33,10 @@
bindKey('2', function(){ redirectTo($('#deliverRequestedArticleLink'));});
bindKey('3', function(){ redirectTo($('#prepareArticleReceptionLink'));});
bindKey('4', function(){ redirectTo($('#preparePreparedArticleReceptionLink'));});
+ bindKey('5', function(){ redirectTo($('#storageTransferLink'));});
+ bindKey('6', function(){ redirectTo($('#prepareWithdrawItemLink'));});
<s:if test="movementOrderResume" >
- bindKey('5', function(){ redirectTo($('#movementOrderResumeLink'));});
+ bindKey('7', function(){ redirectTo($('#movementOrderResumeLink'));});
</s:if>
bindKey('Esc', function(){ redirectTo($('#logoutLink'));});
});
@@ -62,11 +64,17 @@
<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:url namespace="/" action="prepare-withdraw-item!input" id="prepareWithdrawItemUrl"/>
+<s:a href="%{prepareWithdrawItemUrl}" cssClass="btn btn-block" id="prepareWithdrawItemLink" >Prélèvement immédiat (6)</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 (7)</s:a>
</s:if>
<s:url namespace="/" action="logout" id="logoutUrl"/>
Deleted: branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp 2013-05-31 09:59:28 UTC (rev 223)
@@ -1,57 +0,0 @@
-<%--
- #%L
- MagaLiE :: UI
- $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%
- --%>
-<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
-<%@ taglib prefix="s" uri="/struts-tags" %>
-
-<head>
- <title>Traitement des kanbans</title>
- <script type="text/javascript">
- $(document).ready(function () {
- $("#fulfil-kanban_articleBarcode").focus();
- bindKey('Esc', function(){ redirectTo($('#chooseActivityLink'));});
- });
- </script>
-</head>
-
-<s:url namespace="/" action="choose-activity" id="chooseActivityUrl"/>
-
-<s:form>
- <s:textfield key="articleBarcode" label="Article" inputAppendIcon="barcode" cssClass="input-medium" />
-
- <s:select label="Magasin destination"
- key="destinationWarehouseId"
- list="destinationWarehouses"
- listKey="id"
- listValue="code"
- required="true"
- />
-
- <s:if test="askQuantity">
- <s:textfield name="quantity" label="Qté" inputAppend="%{article.unit}" cssClass="input-mini" />
- </s:if>
-
- <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
Copied: branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/prepare-withdraw-item-input.jsp (from rev 222, trunk/magalie-web/src/main/webapp/WEB-INF/content/prepare-withdraw-item-input.jsp)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/prepare-withdraw-item-input.jsp (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/prepare-withdraw-item-input.jsp 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,57 @@
+<%--
+ #%L
+ MagaLiE :: UI
+ $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%
+ --%>
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<head>
+ <title>Traitement des kanbans</title>
+ <script type="text/javascript">
+ $(document).ready(function () {
+ $("#fulfil-kanban_articleBarcode").focus();
+ bindKey('Esc', function(){ redirectTo($('#chooseActivityLink'));});
+ });
+ </script>
+</head>
+
+<s:url namespace="/" action="choose-activity" id="chooseActivityUrl"/>
+
+<s:form>
+ <s:textfield key="articleBarcode" label="Article" inputAppendIcon="barcode" cssClass="input-medium" />
+
+ <s:select label="Magasin destination"
+ key="destinationWarehouseId"
+ list="destinationWarehouses"
+ listKey="id"
+ listValue="code"
+ required="true"
+ />
+
+ <s:if test="askQuantity">
+ <s:textfield name="quantity" label="Qté" inputAppend="%{article.unit}" cssClass="input-mini" />
+ </s:if>
+
+ <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
Copied: branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp (from rev 222, trunk/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/simple-withdraw-item-input.jsp 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,33 @@
+<%@ page language="java" contentType="text/html; charset=utf-8" pageEncoding="utf-8" %>
+<%@ taglib prefix="s" uri="/struts-tags" %>
+
+<head>
+ <title>Prélèvement immédiat</title>
+ <link rel="stylesheet" href="<s:url value='/css/magalie-ck3x-reduced.css' />"/>
+</head>
+
+<s:url namespace="/" action="choose-activity" id="cancelUrl" />
+
+<s:form>
+
+ <ul>
+
+ <s:iterator value="simpleWithdrawItemTask.storedArticles">
+
+ <li><s:property value="location.barcode" /></li>
+ </s:iterator>
+
+ </ul>
+
+ <s:textfield key="originLocationBarcode" label="Emplacement prélevé" inputAppendIcon="barcode" cssClass="input-medium" />
+
+ <s:hidden name="destinationWarehouseId" value="%{destinationWarehouseId}" />
+
+ <s:hidden name="articleBarcode" value="%{articleBarcode}" />
+
+ <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>
Copied: branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp (from rev 222, trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-input.jsp 2013-05-31 09:59:28 UTC (rev 223)
@@ -0,0 +1,89 @@
+
+<%@ 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 () {
+ bindKey("Esc", function(){ redirectTo($('#CancelLink'));});
+ <s:if test="storedArticle != null" >
+ $('#storage-transfer_destinationBarCode').focus();
+ </s:if>
+ });
+
+
+ </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>
+ <s:if test="storedArticle != null" >
+ <dt>Article</dt>
+ <dd><s:property value="storedArticle.article.description" /></dd>
+ <dt>Réf</dt>
+ <dd><s:property value="storedArticle.article.code" /></dd>
+ <dt>Qté disponible</dt>
+ <dd><s:property value="storedArticle.quantity + ' ' + storedArticle.article.unit" /></dd>
+ </s:if>
+ </dl>
+</header>
+
+
+<s:if test="storedArticle == null" >
+ <s:iterator value="storedArticles" status="stat">
+ <li>
+ <s:set var="elementStoredArticleId">storedArticleId<s:property value="#stat.index" /></s:set>
+ <s:url namespace="/" action="storage-transfer!input" id="storageTransferNextStepUrl">
+ <s:param name="originId" value="%{origin.id}" />
+ <s:param name="storedArticleId" value="%{id}" />
+ </s:url>
+ <s:if test="#stat.index < shortcuts.size()">
+ <script type="text/javascript">
+ $(document).ready(function () {
+ var id = '<s:property value="elementStoredArticleId" />';
+ bindKey(<s:property value="shortcuts.get(#stat.index)" />, function(){ redirectTo($('#' + id));});
+ });
+ </script>
+ <s:a href="%{storageTransferNextStepUrl}" id="%{elementStoredArticleId}">
+ <s:property value="article.description" />
+ (<s:property value="article.code" />)
+ (<s:property value="quantity" />
+ <s:property value="article.unit" />)
+ (<s:property value="shortcuts.get(#stat.index)" />)
+ </s:a>
+ </s:if>
+ <s:else>
+ <s:a href="%{storageTransferNextStepUrl}" >
+ <s:property value="article.description" />
+ (<s:property value="article.code" />)
+ (<s:property value="quantity" />
+ <s:property value="article.unit" />)
+ </s:a>
+ </s:else>
+ </li>
+ </s:iterator>
+
+ <s:a href="%{cancelUrl}" cssClass="btn" id="CancelLink" >Quitter (Esc)</s:a>
+
+</s:if>
+<s:else>
+ <s:form cssClass="form-horizontal">
+ <s:hidden name="originId" value="%{origin.id}" />
+ <s:hidden name="storedArticleId" value="%{storedArticle.id}" />
+
+ <s:textfield name="quantity" label="Qté" inputAppend="%{storedArticle.article.unit}" type="number" step="any" min="0" cssClass="input-mini" />
+
+ <s:textfield key="destinationBarCode" label="Destination" inputAppendIcon="barcode" cssClass="input-small" />
+
+ <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>
+</s:else>
Copied: branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp (from rev 222, trunk/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp)
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp (rev 0)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/WEB-INF/content/storage-transfer-location-input.jsp 2013-05-31 09:59:28 UTC (rev 223)
@@ -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: branches/magalie-eugene/magalie-web/src/main/webapp/css/magalie-ck3x.css
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/css/magalie-ck3x.css 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/css/magalie-ck3x.css 2013-05-31 09:59:28 UTC (rev 223)
@@ -45,6 +45,25 @@
margin-left: 110px;
}
+.control-group.radio > .controls {
+ margin-left: 0px;
+}
+
+label.radio {
+position:relative;
+
+}
+
+input.radio {
+ position:inherit;
+ margin-top: 0px;
+ height:auto;
+}
+
+/*.controls {
+ margin-left: 30px;
+}
+*/
.btn-group {
margin-top: 3px;
position: absolute;
Modified: branches/magalie-eugene/magalie-web/src/main/webapp/js/magalie.js
===================================================================
--- branches/magalie-eugene/magalie-web/src/main/webapp/js/magalie.js 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/magalie-web/src/main/webapp/js/magalie.js 2013-05-31 09:59:28 UTC (rev 223)
@@ -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(key) >= 0)) {
event.preventDefault();
handler();
}
Modified: branches/magalie-eugene/pom.xml
===================================================================
--- branches/magalie-eugene/pom.xml 2013-05-31 07:46:32 UTC (rev 222)
+++ branches/magalie-eugene/pom.xml 2013-05-31 09:59:28 UTC (rev 223)
@@ -79,6 +79,17 @@
<role>technical writer</role>
</roles>
</developer>
+ <developer>
+ <id>sbavencoff</id>
+ <name>Sylvain Bavencoff</name>
+ <email>bavencoff at codelutin.com</email>
+ <organization>CodeLutin</organization>
+ <organizationUrl>http://www.codelutin.com</organizationUrl>
+ <timezone>+2</timezone>
+ <roles>
+ <role>developer</role>
+ </roles>
+ </developer>
</developers>
<packaging>pom</packaging>
@@ -94,19 +105,18 @@
<nuitonWebVersion>1.13</nuitonWebVersion>
<nuitonUtilsVersion>2.6.12</nuitonUtilsVersion>
- <h2Version>1.3.170</h2Version>
+ <h2Version>1.3.172</h2Version>
<postgresqlVersion>9.1-901-1.jdbc4</postgresqlVersion>
- <struts2Version>2.3.8</struts2Version>
+ <struts2Version>2.3.14.2</struts2Version>
<jqueryPluginVersion>3.5.1</jqueryPluginVersion>
<bootstrapPluginVersion>1.6.0</bootstrapPluginVersion>
<shiroVersion>1.2.1</shiroVersion>
- <slf4jVersion>1.7.2</slf4jVersion>
+ <slf4jVersion>1.7.5</slf4jVersion>
<jettyVersion>${jettyPluginVersion}</jettyVersion>
- <hibernateVersion>4.1.9.Final</hibernateVersion>
+ <hibernateVersion>4.2.2.Final</hibernateVersion>
<seleniumVersion>2.28.0</seleniumVersion>
<mockitoVersion>1.9.5</mockitoVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
- <topiaVersion>2.7.1</topiaVersion>
<eugeneVersion>2.6.3</eugeneVersion>
<!-- license to use -->
@@ -115,6 +125,9 @@
<!--Site configuration -->
<locales>fr</locales>
+ <!-- configuration -->
+ <devMode>true</devMode>
+
</properties>
<dependencyManagement>
@@ -142,9 +155,14 @@
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-c3p0</artifactId>
+ <version>${hibernateVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
- <scope>test</scope>
<version>${h2Version}</version>
</dependency>
@@ -199,6 +217,7 @@
<groupId>org.apache.struts</groupId>
<artifactId>struts2-core</artifactId>
<version>${struts2Version}</version>
+ <scope>compile</scope>
</dependency>
<dependency>
@@ -252,15 +271,22 @@
<groupId>org.slf4j</groupId>
<artifactId>slf4j-jcl</artifactId>
<version>${slf4jVersion}</version>
- <scope>runtime</scope>
+ <scope>test</scope>
</dependency>
+ <dependency>
+ <groupId>log4j</groupId>
+ <artifactId>log4j</artifactId>
+ <version>${log4jVersion}</version>
+ <scope>test</scope>
+ </dependency>
+
<!-- Others -->
<dependency>
<groupId>javax.mail</groupId>
<artifactId>mail</artifactId>
- <version>1.4.6</version>
+ <version>1.4.7</version>
</dependency>
<dependency>
@@ -426,6 +452,20 @@
</properties>
</profile>
+
+ <profile>
+ <id>disableDevModeProfile</id>
+ <activation>
+ <property>
+ <name>performRelease</name>
+ <value>true</value>
+ </property>
+ </activation>
+ <properties>
+ <devMode>false</devMode>
+ </properties>
+ </profile>
+
</profiles>
</project>
\ No newline at end of file
1
0
r222 - 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
by Bavencoff@users.forge.codelutin.com 31 May '13
by Bavencoff@users.forge.codelutin.com 31 May '13
31 May '13
Author: Bavencoff
Date: 2013-05-31 09:46:32 +0200 (Fri, 31 May 2013)
New Revision: 222
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
refs #2164 : when scan location barcode, check building
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/jpa/LocationJpaDao.java
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
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-30 15:11:54 UTC (rev 221)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-05-31 07:46:32 UTC (rev 222)
@@ -37,5 +37,5 @@
List<Location> findAllWithoutReception(Warehouse warehouse);
- Location findByBarCode(String barCode);
+ Location findByBarCode(String barCode, Building building);
}
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-30 15:11:54 UTC (rev 221)
+++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/LocationJpaDao.java 2013-05-31 07:46:32 UTC (rev 222)
@@ -89,9 +89,12 @@
}
@Override
- public Location findByBarCode(String barCode) {
- TypedQuery<Location> query = createQuery("from Location l where CONCAT(l.warehouse.code, l.code) = :barCode");
+ public Location findByBarCode(String barCode, Building building) {
+ TypedQuery<Location> query = createQuery("from Location l " +
+ "where CONCAT(l.warehouse.code, l.code) = :barCode " +
+ "and l.warehouse.building = :building");
query.setParameter("barCode", barCode);
+ query.setParameter("building", building);
return findUniqueOrNull(query);
}
}
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-30 15:11:54 UTC (rev 221)
+++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StorageTransferService.java 2013-05-31 07:46:32 UTC (rev 222)
@@ -5,6 +5,7 @@
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.Building;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.MagalieUser;
import com.franciaflex.magalie.persistence.entity.StorageMovement;
@@ -31,13 +32,13 @@
this.serviceContext = serviceContext;
}
- public Location getLocationByBarCode(String barCode) {
+ public Location getLocationByBarCode(String barCode, Building building) {
MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext();
LocationDao locationDao = persistenceContext.getLocationDao();
- Location location = locationDao.findByBarCode(barCode);
+ Location location = locationDao.findByBarCode(barCode, building);
return location;
}
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-30 15:11:54 UTC (rev 221)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferAction.java 2013-05-31 07:46:32 UTC (rev 222)
@@ -1,5 +1,6 @@
package com.franciaflex.magalie.web.action;
+import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import com.franciaflex.magalie.services.service.StorageTransferService;
@@ -139,8 +140,10 @@
return INPUT;
}
- Location destination = service.getLocationByBarCode(destinationBarCode);
+ Building building = session.getBuilding();
+ Location destination = service.getLocationByBarCode(destinationBarCode, building);
+
if (destination == null) {
addFieldError("destinationBarCode", "Le code barre n'est pas un code valide");
return INPUT;
Modified: 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 2013-05-30 15:11:54 UTC (rev 221)
+++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/StorageTransferLocationAction.java 2013-05-31 07:46:32 UTC (rev 222)
@@ -1,5 +1,6 @@
package com.franciaflex.magalie.web.action;
+import com.franciaflex.magalie.persistence.entity.Building;
import com.franciaflex.magalie.persistence.entity.Location;
import com.franciaflex.magalie.persistence.entity.StoredArticle;
import com.franciaflex.magalie.services.service.StorageTransferService;
@@ -50,8 +51,10 @@
log.debug("origin BarCode : " + originBarCode);
}
- origin = service.getLocationByBarCode(originBarCode);
+ Building building = session.getBuilding();
+ origin = service.getLocationByBarCode(originBarCode, building);
+
if (origin == null) {
addFieldError("originBarCode", "Le code barre n'est pas un code valide");
return INPUT;
1
0
r221 - in trunk: . magalie-persistence magalie-persistence/src/main/resources
by Bavencoff@users.forge.codelutin.com 30 May '13
by Bavencoff@users.forge.codelutin.com 30 May '13
30 May '13
Author: Bavencoff
Date: 2013-05-30 17:11:54 +0200 (Thu, 30 May 2013)
New Revision: 221
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
Prepare release : hibernate c3p0
Modified:
trunk/magalie-persistence/pom.xml
trunk/magalie-persistence/src/main/resources/magalie.properties
trunk/pom.xml
Modified: trunk/magalie-persistence/pom.xml
===================================================================
--- trunk/magalie-persistence/pom.xml 2013-05-30 15:09:57 UTC (rev 220)
+++ trunk/magalie-persistence/pom.xml 2013-05-30 15:11:54 UTC (rev 221)
@@ -38,6 +38,12 @@
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-c3p0</artifactId>
+ <scope>runtime</scope>
+ </dependency>
+
+ <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>compile</scope>
Modified: trunk/magalie-persistence/src/main/resources/magalie.properties
===================================================================
--- trunk/magalie-persistence/src/main/resources/magalie.properties 2013-05-30 15:09:57 UTC (rev 220)
+++ trunk/magalie-persistence/src/main/resources/magalie.properties 2013-05-30 15:11:54 UTC (rev 221)
@@ -29,3 +29,7 @@
hibernate.show_sql=false
hibernate.format_sql=true
hibernate.ejb.naming_strategy=org.hibernate.cfg.ImprovedNamingStrategy
+hibernate.c3p0.min_size=5
+hibernate.c3p0.max_size=20
+hibernate.c3p0.timeout=1800
+hibernate.c3p0.max_statements=50
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-05-30 15:09:57 UTC (rev 220)
+++ trunk/pom.xml 2013-05-30 15:11:54 UTC (rev 221)
@@ -153,6 +153,12 @@
</dependency>
<dependency>
+ <groupId>org.hibernate</groupId>
+ <artifactId>hibernate-c3p0</artifactId>
+ <version>${hibernateVersion}</version>
+ </dependency>
+
+ <dependency>
<groupId>com.h2database</groupId>
<artifactId>h2</artifactId>
<scope>provided</scope>
1
0
Author: bleny
Date: 2013-05-30 17:09:57 +0200 (Thu, 30 May 2013)
New Revision: 220
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
actually hibernate can be used if you clean the h2 database
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-05-30 13:47:47 UTC (rev 219)
+++ trunk/pom.xml 2013-05-30 15:09:57 UTC (rev 220)
@@ -111,13 +111,7 @@
<shiroVersion>1.2.1</shiroVersion>
<slf4jVersion>1.7.5</slf4jVersion>
<jettyVersion>${jettyPluginVersion}</jettyVersion>
-
- <!-- FIXME bleny 30/05/13
- updating hibernate to 4.2.1 break the app when running in tomcat
- and making a first http request, changelog doesn't show anything
- meaningful. 4.2.2 doesn't fix it. -->
- <hibernateVersion>4.2.0.Final</hibernateVersion>
-
+ <hibernateVersion>4.2.2.Final</hibernateVersion>
<seleniumVersion>2.28.0</seleniumVersion>
<mockitoVersion>1.9.5</mockitoVersion>
<nuitonI18nVersion>2.5</nuitonI18nVersion>
1
0
Author: bleny
Date: 2013-05-30 15:47:47 +0200 (Thu, 30 May 2013)
New Revision: 219
Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revision…
Log:
rename profile
Modified:
trunk/pom.xml
Modified: trunk/pom.xml
===================================================================
--- trunk/pom.xml 2013-05-30 13:46:32 UTC (rev 218)
+++ trunk/pom.xml 2013-05-30 13:47:47 UTC (rev 219)
@@ -440,7 +440,7 @@
</profile>
<profile>
- <id>admin-release</id>
+ <id>disableDevModeProfile</id>
<activation>
<property>
<name>performRelease</name>
1
0