Author: bleny Date: 2013-04-11 22:24:53 +0200 (Thu, 11 Apr 2013) New Revision: 88 Url: http://forge.codelutin.com/projects/franciaflex-magalie/repository/revisions... Log: replace Building.name by Building.code Added: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/WarehouseJpaDao.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java Removed: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoreDao.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoreJpaDao.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Store.java trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StoreService.java Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaMagaliePersistenceContext.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.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/jpa/LocationJpaDao.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Building.java trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Location.java trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/MagalieFixtures.java trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.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/RequestedArticleService.java trunk/magalie-services/src/main/resources/fixtures.yaml trunk/magalie-services/src/main/resources/fixtures2.yaml trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ArticleStorageServiceTest.java 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/LoginAction.java trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp trunk/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp trunk/magalie-web/src/main/webapp/WEB-INF/content/login-input.jsp trunk/magalie-web/src/main/webapp/WEB-INF/content/report.jsp trunk/magalie-web/src/main/webapp/WEB-INF/content/withdraw-item-input.jsp trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/JpaMagaliePersistenceContext.java 2013-04-11 20:24:53 UTC (rev 88) @@ -9,7 +9,7 @@ import com.franciaflex.magalie.persistence.dao.LocationErrorDao; import com.franciaflex.magalie.persistence.dao.StorageMovementDao; import com.franciaflex.magalie.persistence.dao.StorageMovementOrderDao; -import com.franciaflex.magalie.persistence.dao.StoreDao; +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; @@ -20,7 +20,7 @@ import com.franciaflex.magalie.persistence.dao.jpa.RequestedArticleJpaDao; import com.franciaflex.magalie.persistence.dao.jpa.StorageMovementJpaDao; import com.franciaflex.magalie.persistence.dao.jpa.StorageMovementOrderJpaDao; -import com.franciaflex.magalie.persistence.dao.jpa.StoreJpaDao; +import com.franciaflex.magalie.persistence.dao.jpa.WarehouseJpaDao; import com.franciaflex.magalie.persistence.dao.jpa.StoredArticleJpaDao; import javax.persistence.EntityManager; @@ -86,8 +86,8 @@ } @Override - public StoreDao getStoreDao() { - return new StoreJpaDao(entityManager); + public WarehouseDao getWarehouseDao() { + return new WarehouseJpaDao(entityManager); } @Override 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/MagaliePersistenceContext.java 2013-04-11 20:24:53 UTC (rev 88) @@ -9,7 +9,7 @@ import com.franciaflex.magalie.persistence.dao.LocationErrorDao; import com.franciaflex.magalie.persistence.dao.StorageMovementDao; import com.franciaflex.magalie.persistence.dao.StorageMovementOrderDao; -import com.franciaflex.magalie.persistence.dao.StoreDao; +import com.franciaflex.magalie.persistence.dao.WarehouseDao; import com.franciaflex.magalie.persistence.dao.StoredArticleDao; /** @@ -43,5 +43,5 @@ BuildingDao getBuildingDao(); - StoreDao getStoreDao(); + WarehouseDao getWarehouseDao(); } 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/LocationDao.java 2013-04-11 20:24:53 UTC (rev 88) @@ -2,10 +2,6 @@ import com.franciaflex.magalie.persistence.entity.Location; -import java.util.List; - public interface LocationDao extends Dao<Location> { - List<String> getAllStoreCodes(); - } Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoreDao.java =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoreDao.java 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoreDao.java 2013-04-11 20:24:53 UTC (rev 88) @@ -1,10 +0,0 @@ -package com.franciaflex.magalie.persistence.dao; - -import com.franciaflex.magalie.persistence.entity.Store; - -/** - * @author bleny - */ -public interface StoreDao extends Dao<Store> { - -} Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java (from rev 86, trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/StoreDao.java) =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java (rev 0) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/WarehouseDao.java 2013-04-11 20:24:53 UTC (rev 88) @@ -0,0 +1,10 @@ +package com.franciaflex.magalie.persistence.dao; + +import com.franciaflex.magalie.persistence.entity.Warehouse; + +/** + * @author bleny + */ +public interface WarehouseDao extends Dao<Warehouse> { + +} 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/LocationJpaDao.java 2013-04-11 20:24:53 UTC (rev 88) @@ -18,10 +18,4 @@ return Location.class; } - @Override - public List<String> getAllStoreCodes() { - Query query = entityManager.createQuery("select distinct s.storeCode from Location s order by s.storeCode"); - List<String> resultList = query.getResultList(); - return resultList; - } } Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoreJpaDao.java =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoreJpaDao.java 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoreJpaDao.java 2013-04-11 20:24:53 UTC (rev 88) @@ -1,18 +0,0 @@ -package com.franciaflex.magalie.persistence.dao.jpa; - -import com.franciaflex.magalie.persistence.dao.StoreDao; -import com.franciaflex.magalie.persistence.entity.Store; - -import javax.persistence.EntityManager; - -public class StoreJpaDao extends AbstractJpaDao<Store> implements StoreDao { - - public StoreJpaDao(EntityManager entityManager) { - super(entityManager); - } - - @Override - protected Class<Store> getEntityClass() { - return Store.class; - } -} Modified: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoredArticleJpaDao.java 2013-04-11 20:24:53 UTC (rev 88) @@ -22,7 +22,7 @@ @Override public List<StoredArticle> findAllForArticleInBuilding(Article article, Building building) { - Query query = entityManager.createQuery("from StoredArticle sa where sa.article = :article and sa.location.store.building = :building"); + Query query = entityManager.createQuery("from StoredArticle sa where sa.article = :article and sa.location.warehouse.building = :building"); query.setParameter("article", article); query.setParameter("building", building); List<StoredArticle> resultList = query.getResultList(); Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/WarehouseJpaDao.java (from rev 86, trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/StoreJpaDao.java) =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/WarehouseJpaDao.java (rev 0) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/dao/jpa/WarehouseJpaDao.java 2013-04-11 20:24:53 UTC (rev 88) @@ -0,0 +1,18 @@ +package com.franciaflex.magalie.persistence.dao.jpa; + +import com.franciaflex.magalie.persistence.dao.WarehouseDao; +import com.franciaflex.magalie.persistence.entity.Warehouse; + +import javax.persistence.EntityManager; + +public class WarehouseJpaDao extends AbstractJpaDao<Warehouse> implements WarehouseDao { + + public WarehouseJpaDao(EntityManager entityManager) { + super(entityManager); + } + + @Override + protected Class<Warehouse> getEntityClass() { + return Warehouse.class; + } +} Modified: 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Building.java 2013-04-11 20:24:53 UTC (rev 88) @@ -9,7 +9,7 @@ @Id protected String id; - protected String name; + protected String code; @Override public String getId() { @@ -20,11 +20,11 @@ this.id = id; } - public String getName() { - return name; + public String getCode() { + return code; } - public void setName(String name) { - this.name = name; + public void setCode(String code) { + this.code = code; } } 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Location.java 2013-04-11 20:24:53 UTC (rev 88) @@ -11,9 +11,9 @@ protected String id; @ManyToOne - protected Store store; + protected Warehouse warehouse; - protected String locationCode; + protected String code; protected int requiredAccreditationLevel; @@ -26,20 +26,20 @@ this.id = id; } - public Store getStore() { - return store; + public Warehouse getWarehouse() { + return warehouse; } - public void setStore(Store store) { - this.store = store; + public void setWarehouse(Warehouse warehouse) { + this.warehouse = warehouse; } - public String getLocationCode() { - return locationCode; + public String getCode() { + return code; } - public void setLocationCode(String locationCode) { - this.locationCode = locationCode; + public void setCode(String code) { + this.code = code; } public int getRequiredAccreditationLevel() { @@ -51,7 +51,7 @@ } public String getBarcode() { - String barcode = getStoreCode() + getLocationCode(); + String barcode = getWarehouse().getCode() + getCode(); return barcode; } @@ -59,7 +59,4 @@ return requiredAccreditationLevel == 9; } - public String getStoreCode() { - return getStore().getName(); - } } Deleted: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Store.java =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Store.java 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Store.java 2013-04-11 20:24:53 UTC (rev 88) @@ -1,42 +0,0 @@ -package com.franciaflex.magalie.persistence.entity; - -import javax.persistence.Entity; -import javax.persistence.Id; -import javax.persistence.ManyToOne; - -@Entity -public class Store extends AbstractEntity { - - @Id - protected String id; - - protected String name; - - @ManyToOne - protected Building building; - - @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 getName() { - return name; - } - - public void setName(String name) { - this.name = name; - } -} Copied: trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java (from rev 86, trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Store.java) =================================================================== --- trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java (rev 0) +++ trunk/magalie-persistence/src/main/java/com/franciaflex/magalie/persistence/entity/Warehouse.java 2013-04-11 20:24:53 UTC (rev 88) @@ -0,0 +1,42 @@ +package com.franciaflex.magalie.persistence.entity; + +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; + + @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; + } +} 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/MagalieFixtures.java 2013-04-11 20:24:53 UTC (rev 88) @@ -8,7 +8,7 @@ import com.franciaflex.magalie.persistence.entity.MagalieUser; import com.franciaflex.magalie.persistence.entity.RequestedArticle; import com.franciaflex.magalie.persistence.entity.Location; -import com.franciaflex.magalie.persistence.entity.Store; +import com.franciaflex.magalie.persistence.entity.Warehouse; import com.franciaflex.magalie.persistence.entity.StoredArticle; import org.apache.commons.io.Charsets; import org.apache.commons.io.IOUtils; @@ -32,7 +32,7 @@ } YamlReader reader = new YamlReader(yaml); reader.getConfig().setClassTag("building", Building.class); - reader.getConfig().setClassTag("store", Store.class); + reader.getConfig().setClassTag("warehouse", Warehouse.class); reader.getConfig().setClassTag("article", Article.class); reader.getConfig().setClassTag("stored-article", StoredArticle.class); reader.getConfig().setClassTag("user", MagalieUser.class); 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/ArticleStorageService.java 2013-04-11 20:24:53 UTC (rev 88) @@ -190,7 +190,7 @@ Set<Location> locationsInOrder = storageMovementOrder.getLocations(); // we suppose the order concerns movement in the same building - Building building = Iterables.get(locationsInOrder, 0).getStore().getBuilding(); + Building building = Iterables.get(locationsInOrder, 0).getWarehouse().getBuilding(); List<StoredArticle> storedArticles = getStoredArticles(building, article); Copied: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java (from rev 86, trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StoreService.java) =================================================================== --- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java (rev 0) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/BuildingsService.java 2013-04-11 20:24:53 UTC (rev 88) @@ -0,0 +1,35 @@ +package com.franciaflex.magalie.services.service; + +import com.franciaflex.magalie.persistence.dao.BuildingDao; +import com.franciaflex.magalie.persistence.entity.Building; +import com.franciaflex.magalie.services.MagalieService; +import com.franciaflex.magalie.services.MagalieServiceContext; + +import java.util.List; + +public class BuildingsService implements MagalieService { + + protected MagalieServiceContext serviceContext; + + @Override + public void setServiceContext(MagalieServiceContext serviceContext) { + this.serviceContext = serviceContext; + } + + public List<Building> getAllBuildings() { + + BuildingDao dao = serviceContext.getPersistenceContext().getBuildingDao(); + + return dao.findAll(); + + } + + public Building getBuilding(String buildingId) { + + BuildingDao 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FixturesService.java 2013-04-11 20:24:53 UTC (rev 88) @@ -6,14 +6,14 @@ import com.franciaflex.magalie.persistence.dao.MagalieUserDao; import com.franciaflex.magalie.persistence.dao.RequestedArticleDao; import com.franciaflex.magalie.persistence.dao.LocationDao; -import com.franciaflex.magalie.persistence.dao.StoreDao; +import com.franciaflex.magalie.persistence.dao.WarehouseDao; import com.franciaflex.magalie.persistence.dao.StoredArticleDao; import com.franciaflex.magalie.persistence.entity.Article; import com.franciaflex.magalie.persistence.entity.Building; import com.franciaflex.magalie.persistence.entity.MagalieUser; import com.franciaflex.magalie.persistence.entity.RequestedArticle; import com.franciaflex.magalie.persistence.entity.Location; -import com.franciaflex.magalie.persistence.entity.Store; +import com.franciaflex.magalie.persistence.entity.Warehouse; import com.franciaflex.magalie.persistence.entity.StoredArticle; import com.franciaflex.magalie.services.MagalieFixtures; import com.franciaflex.magalie.services.MagalieService; @@ -97,13 +97,13 @@ } - StoreDao storeDao = persistenceContext.getStoreDao(); + WarehouseDao warehouseDao = persistenceContext.getWarehouseDao(); - Collection<Store> stores = fixtures.fixture("stores"); + Collection<Warehouse> warehouses = fixtures.fixture("warehouses"); - for (Store store : stores) { + for (Warehouse warehouse : warehouses) { - storeDao.persist(store); + warehouseDao.persist(warehouse); } 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/FulfilKanbanService.java 2013-04-11 20:24:53 UTC (rev 88) @@ -1,13 +1,13 @@ package com.franciaflex.magalie.services.service; import com.franciaflex.magalie.persistence.MagaliePersistenceContext; -import com.franciaflex.magalie.persistence.dao.StoreDao; +import com.franciaflex.magalie.persistence.dao.WarehouseDao; 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.StorageMovementOrder; -import com.franciaflex.magalie.persistence.entity.Store; +import com.franciaflex.magalie.persistence.entity.Warehouse; import com.franciaflex.magalie.services.MagalieService; import com.franciaflex.magalie.services.MagalieServiceContext; import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException; @@ -29,15 +29,15 @@ this.serviceContext = serviceContext; } - public Store getStore(String storeId) { + public Warehouse getStore(String storeId) { MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext(); - StoreDao storeDao = persistenceContext.getStoreDao(); + WarehouseDao warehouseDao = persistenceContext.getWarehouseDao(); - Store store = storeDao.findById(storeId); + Warehouse warehouse = warehouseDao.findById(storeId); - return store; + return warehouse; } @@ -62,13 +62,13 @@ ArticleStorageService articleStorageService = serviceContext.newService(ArticleStorageService.class); - StoreDao storeDao = serviceContext.getPersistenceContext().getStoreDao(); + WarehouseDao warehouseDao = serviceContext.getPersistenceContext().getWarehouseDao(); - Store destinationStore = storeDao.findById(destinationStoreId); + Warehouse destinationWarehouse = warehouseDao.findById(destinationStoreId); - Building building = destinationStore.getBuilding(); + Building building = destinationWarehouse.getBuilding(); - Location destinationLocation = getDestinationLocation(destinationStore); + Location destinationLocation = getDestinationLocation(destinationWarehouse); StorageMovementOrder storageMovementOrder = articleStorageService.bookArticleWithBestEffortPolicy( @@ -82,23 +82,23 @@ } - protected Location getDestinationLocation(Store destinationStore) { + protected Location getDestinationLocation(Warehouse destinationWarehouse) { - // TODO brendan 10/04/13 how to define destination for store, something like "INC" ? + // TODO brendan 10/04/13 how to define destination for warehouse, something like "INC" ? return null; } - public List<Store> getDestinationStores(Building building) { + public List<Warehouse> getDestinationStores(Building building) { MagaliePersistenceContext persistenceContext = serviceContext.getPersistenceContext(); - StoreDao storeDao = persistenceContext.getStoreDao(); + WarehouseDao warehouseDao = persistenceContext.getWarehouseDao(); // FIXME brendan 10/04/13 consider building - return storeDao.findAll(); + return warehouseDao.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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/RequestedArticleService.java 2013-04-11 20:24:53 UTC (rev 88) @@ -84,10 +84,10 @@ List<RequestedArticle> allRequestedArticles = requestedArticleDao.findAllUndelivered(building); if (log.isInfoEnabled()) { - log.info(allRequestedArticles.size() + " articles requested in building " + building.getName()); + log.info(allRequestedArticles.size() + " articles requested in building " + building.getCode()); } - // TODO brendan 05/04/13 consider storeCode + // TODO brendan 05/04/13 consider warehouse.code return allRequestedArticles; Deleted: trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StoreService.java =================================================================== --- trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StoreService.java 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/java/com/franciaflex/magalie/services/service/StoreService.java 2013-04-11 20:24:53 UTC (rev 88) @@ -1,35 +0,0 @@ -package com.franciaflex.magalie.services.service; - -import com.franciaflex.magalie.persistence.dao.BuildingDao; -import com.franciaflex.magalie.persistence.entity.Building; -import com.franciaflex.magalie.services.MagalieService; -import com.franciaflex.magalie.services.MagalieServiceContext; - -import java.util.List; - -public class StoreService implements MagalieService { - - protected MagalieServiceContext serviceContext; - - @Override - public void setServiceContext(MagalieServiceContext serviceContext) { - this.serviceContext = serviceContext; - } - - public List<Building> getAllBuildings() { - - BuildingDao dao = serviceContext.getPersistenceContext().getBuildingDao(); - - return dao.findAll(); - - } - - public Building getBuilding(String buildingId) { - - BuildingDao dao = serviceContext.getPersistenceContext().getBuildingDao(); - - return dao.findById(buildingId); - - } - -} Modified: trunk/magalie-services/src/main/resources/fixtures.yaml =================================================================== --- trunk/magalie-services/src/main/resources/fixtures.yaml 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/resources/fixtures.yaml 2013-04-11 20:24:53 UTC (rev 88) @@ -35,42 +35,42 @@ B1: &B1 !building id: building_1 - name: B1 + code: B1 buildings: - *B1 U01: - &U01 !store - id: store_u01 - name: U01 + &U01 !warehouse + id: warehouse_u01 + code: U01 building: *B1 U02: - &U02 !store - id: store_u02 - name: U02 + &U02 !warehouse + id: warehouse_u02 + code: U02 building: *B1 U03: - &U03 !store - id: store_u03 - name: U03 + &U03 !warehouse + id: warehouse_u03 + code: U03 building: *B1 U04: - &U04 !store - id: store_u04 - name: U04 + &U04 !warehouse + id: warehouse_u04 + code: U04 building: *B1 SOM: - &SOM !store - id: store_som - name: SOM + &SOM !warehouse + id: warehouse_som + code: SOM building: *B1 -stores: +warehouses: - *U01 - *U02 - *U03 @@ -80,92 +80,92 @@ location1: &location1 !location id: location1 - store: *U01 - locationCode: A01 + warehouse: *U01 + code: A01 requiredAccreditationLevel: 0 location2: &location2 !location id: location2 - store: *U01 - locationCode: B02 + warehouse: *U01 + code: B02 requiredAccreditationLevel: 9 location3: &location3 !location id: location3 - store: *U01 - locationCode: C03 + warehouse: *U01 + code: C03 requiredAccreditationLevel: 0 location4: &location4 !location id: location4 - store: *U01 - locationCode: D04 + warehouse: *U01 + code: D04 requiredAccreditationLevel: 9 location5: &location5 !location id: location5 - store: *U02 - locationCode: F01 + warehouse: *U02 + code: F01 requiredAccreditationLevel: 0 location6: &location6 !location id: location6 - store: *U02 - locationCode: G02 + warehouse: *U02 + code: G02 requiredAccreditationLevel: 0 location7: &location7 !location id: location7 - store: *U02 - locationCode: H03 + warehouse: *U02 + code: H03 requiredAccreditationLevel: 9 location8: &location8 !location id: location8 - store: *U04 - locationCode: A010 + warehouse: *U04 + code: A010 requiredAccreditationLevel: 0 location9: &location9 !location id: location9 - store: *SOM - locationCode: B10 + warehouse: *SOM + code: B10 requiredAccreditationLevel: 0 location10: &location10 !location id: location10 - store: *SOM - locationCode: B24 + warehouse: *SOM + code: B24 requiredAccreditationLevel: 0 location11: &location11 !location id: location11 - store: *SOM - locationCode: B77 + warehouse: *SOM + code: B77 requiredAccreditationLevel: 0 location12: &location12 !location id: location12 - store: *SOM - locationCode: C12 + warehouse: *SOM + code: C12 requiredAccreditationLevel: 0 location13: &location13 !location id: location13 - store: *U01 - locationCode: REC + warehouse: *U01 + code: REC requiredAccreditationLevel: 0 locations: Modified: trunk/magalie-services/src/main/resources/fixtures2.yaml =================================================================== --- trunk/magalie-services/src/main/resources/fixtures2.yaml 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/main/resources/fixtures2.yaml 2013-04-11 20:24:53 UTC (rev 88) @@ -35,42 +35,42 @@ B1: &B1 !building id: building_1 - name: B1 + code: B1 buildings: - *B1 U01: - &U01 !store - id: store_u01 - name: U01 + &U01 !warehouse + id: warehouse_u01 + code: U01 building: *B1 U02: - &U02 !store - id: store_u02 - name: U02 + &U02 !warehouse + id: warehouse_u02 + code: U02 building: *B1 U03: - &U03 !store - id: store_u03 - name: U03 + &U03 !warehouse + id: warehouse_u03 + code: U03 building: *B1 U04: - &U04 !store - id: store_u04 - name: U04 + &U04 !warehouse + id: warehouse_u04 + code: U04 building: *B1 SOM: - &SOM !store - id: store_som - name: SOM + &SOM !warehouse + id: warehouse_som + code: SOM building: *B1 -stores: +warehouses: - *U01 - *U02 - *U03 @@ -80,36 +80,36 @@ location1: &location1 !location id: location1 - store: *U01 - locationCode: A1 + warehouse: *U01 + code: A1 requiredAccreditationLevel: 0 location2: &location2 !location id: location2 - store: *U01 - locationCode: B2 + warehouse: *U01 + code: B2 requiredAccreditationLevel: 9 location3: &location3 !location id: location3 - store: *U01 - locationCode: C3 + warehouse: *U01 + code: C3 requiredAccreditationLevel: 0 location4: &location4 !location id: location4 - store: *U01 - locationCode: D4 + warehouse: *U01 + code: D4 requiredAccreditationLevel: 9 location5: &location5 !location id: location5 - store: *U02 - locationCode: A1 + warehouse: *U02 + code: A1 requiredAccreditationLevel: 0 locations: Modified: trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ArticleStorageServiceTest.java =================================================================== --- trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ArticleStorageServiceTest.java 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-services/src/test/java/com/franciaflex/magalie/services/service/ArticleStorageServiceTest.java 2013-04-11 20:24:53 UTC (rev 88) @@ -159,10 +159,10 @@ Assert.assertEquals(2, storageMovementOrder.getStorageMovements().size()); StorageMovement storageMovement1 = Iterables.get(storageMovementOrder.getStorageMovements(), 0, null); Assert.assertEquals(20., storageMovement1.getExpectedQuantity(), DELTA); - Assert.assertEquals("B2", storageMovement1.getOriginLocation().getLocationCode()); + Assert.assertEquals("B2", storageMovement1.getOriginLocation().getCode()); StorageMovement storageMovement2 = Iterables.get(storageMovementOrder.getStorageMovements(), 1, null); Assert.assertEquals(10., storageMovement2.getExpectedQuantity(), DELTA); - Assert.assertEquals("A1", storageMovement2.getOriginLocation().getLocationCode()); + Assert.assertEquals("A1", storageMovement2.getOriginLocation().getCode()); } catch (RequiredDriverLicenceException e) { if (log.isDebugEnabled()) { log.debug("exception raised = " + e); @@ -183,7 +183,7 @@ Assert.assertEquals(1, storageMovementOrder.getStorageMovements().size()); StorageMovement storageMovement = Iterables.get(storageMovementOrder.getStorageMovements(), 0, null); Assert.assertEquals(30., storageMovement.getExpectedQuantity(), DELTA); - Assert.assertEquals("A1", storageMovement.getOriginLocation().getLocationCode()); + Assert.assertEquals("A1", storageMovement.getOriginLocation().getCode()); } catch (RequiredDriverLicenceException e) { if (log.isDebugEnabled()) { log.debug("exception raised = " + e); 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/MagalieSession.java 2013-04-11 20:24:53 UTC (rev 88) @@ -2,7 +2,7 @@ import com.franciaflex.magalie.persistence.entity.Building; import com.franciaflex.magalie.persistence.entity.MagalieUser; -import com.franciaflex.magalie.persistence.entity.Store; +import com.franciaflex.magalie.persistence.entity.Warehouse; import java.io.Serializable; @@ -21,7 +21,7 @@ protected MagalieUser magalieUser; protected Building building; - private Store lastUsedDestinationStoreForKanbans; + private Warehouse lastUsedDestinationWarehouseForKanbans; public MagalieUser getMagalieUser() { return magalieUser; @@ -39,11 +39,11 @@ this.building = building; } - public Store getLastUsedDestinationStoreForKanbans() { - return lastUsedDestinationStoreForKanbans; + public Warehouse getLastUsedDestinationWarehouseForKanbans() { + return lastUsedDestinationWarehouseForKanbans; } - public void setLastUsedDestinationStoreForKanbans(Store lastUsedDestinationStoreForKanbans) { - this.lastUsedDestinationStoreForKanbans = lastUsedDestinationStoreForKanbans; + public void setLastUsedDestinationWarehouseForKanbans(Warehouse lastUsedDestinationWarehouseForKanbans) { + this.lastUsedDestinationWarehouseForKanbans = lastUsedDestinationWarehouseForKanbans; } } 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/FulfilKanbanAction.java 2013-04-11 20:24:53 UTC (rev 88) @@ -3,7 +3,7 @@ import com.franciaflex.magalie.persistence.entity.Building; import com.franciaflex.magalie.persistence.entity.MagalieUser; import com.franciaflex.magalie.persistence.entity.StorageMovementOrder; -import com.franciaflex.magalie.persistence.entity.Store; +import com.franciaflex.magalie.persistence.entity.Warehouse; import com.franciaflex.magalie.services.exception.InvalidMagalieBarcodeException; import com.franciaflex.magalie.services.exception.RequiredDriverLicenceException; import com.franciaflex.magalie.services.exception.UnavailableArticleException; @@ -33,9 +33,9 @@ protected StorageMovementOrder storageMovementOrder; - protected List<Store> destinationStores; + protected List<Warehouse> destinationWarehouses; - protected String destinationStoreId; + protected String destinationWarehouseId; public void setService(FulfilKanbanService service) { this.service = service; @@ -50,15 +50,15 @@ Building building = session.getBuilding(); - destinationStores = service.getDestinationStores(building); + destinationWarehouses = service.getDestinationStores(building); - // let's help user by selecting by default the previously used destination store + // let's help user by selecting by default the previously used destination warehouse - Store lastUsedDestinationStoreForKanbans = session.getLastUsedDestinationStoreForKanbans(); + Warehouse lastUsedDestinationWarehouseForKanbans = session.getLastUsedDestinationWarehouseForKanbans(); - if (lastUsedDestinationStoreForKanbans != null) { + if (lastUsedDestinationWarehouseForKanbans != null) { - destinationStoreId = lastUsedDestinationStoreForKanbans.getId(); + destinationWarehouseId = lastUsedDestinationWarehouseForKanbans.getId(); } @@ -66,20 +66,20 @@ } - public String getDestinationStoreId() { - return destinationStoreId; + public String getDestinationWarehouseId() { + return destinationWarehouseId; } - public List<Store> getDestinationStores() { - return destinationStores; + public List<Warehouse> getDestinationWarehouses() { + return destinationWarehouses; } public void setArticleBarcode(String articleBarcode) { this.articleBarcode = articleBarcode; } - public void setDestinationStoreId(String destinationStoreId) { - this.destinationStoreId = destinationStoreId; + public void setDestinationWarehouseId(String destinationWarehouseId) { + this.destinationWarehouseId = destinationWarehouseId; } @Override @@ -91,14 +91,14 @@ MagalieUser magalieUser = session.getMagalieUser(); - Store destinationStore = service.getStore(destinationStoreId); + Warehouse destinationWarehouse = service.getStore(destinationWarehouseId); - // save used destination store to propose it by default on next kanban - session.setLastUsedDestinationStoreForKanbans(destinationStore); + // save used destination warehouse to propose it by default on next kanban + session.setLastUsedDestinationWarehouseForKanbans(destinationWarehouse); try { - storageMovementOrder = service.fulfilKanbanTask(articleBarcode, magalieUser, destinationStoreId); + storageMovementOrder = service.fulfilKanbanTask(articleBarcode, magalieUser, destinationWarehouseId); } catch (InvalidMagalieBarcodeException e) { 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/java/com/franciaflex/magalie/web/action/LoginAction.java 2013-04-11 20:24:53 UTC (rev 88) @@ -2,8 +2,8 @@ import com.franciaflex.magalie.persistence.entity.Building; import com.franciaflex.magalie.persistence.entity.MagalieUser; +import com.franciaflex.magalie.services.service.BuildingsService; import com.franciaflex.magalie.services.service.MagalieUsersService; -import com.franciaflex.magalie.services.service.StoreService; import com.franciaflex.magalie.web.MagalieActionSupport; import com.franciaflex.magalie.web.MagalieSession; import org.apache.struts2.convention.annotation.Result; @@ -18,7 +18,7 @@ protected MagalieUsersService magalieUsersService; - protected StoreService storeService; + protected BuildingsService buildingsService; protected List<MagalieUser> allMagalieUsers; @@ -34,8 +34,8 @@ this.magalieUsersService = magalieUsersService; } - public void setStoreService(StoreService storeService) { - this.storeService = storeService; + public void setBuildingsService(BuildingsService buildingsService) { + this.buildingsService = buildingsService; } public void setSession(MagalieSession session) { @@ -55,7 +55,7 @@ allMagalieUsers = magalieUsersService.getAllMagalieUsers(); - allBuildings = storeService.getAllBuildings(); + allBuildings = buildingsService.getAllBuildings(); return INPUT; @@ -82,7 +82,7 @@ MagalieUser magalieUser = magalieUsersService.getMagalieUser(login); - Building building = storeService.getBuilding(buildingId); + Building building = buildingsService.getBuilding(buildingId); session.setMagalieUser(magalieUser); Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp =================================================================== --- trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/webapp/WEB-INF/content/choose-activity.jsp 2013-04-11 20:24:53 UTC (rev 88) @@ -35,7 +35,7 @@ <dt>Identifiant</dt> <dd><s:property value="magalieUser.name" /> (<s:property value="magalieUser.login" />)</dd> <dt>Bâtiment</dt> - <dd><s:property value="building.name" /></dd> + <dd><s:property value="building.code" /></dd> </dl> </header> Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp =================================================================== --- trunk/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/webapp/WEB-INF/content/fulfil-kanban-input.jsp 2013-04-11 20:24:53 UTC (rev 88) @@ -9,10 +9,10 @@ <s:textfield name="articleBarcode" label="Article" inputAppendIcon="barcode" cssClass="input-medium" /> <s:select label="Magasin destination" - key="destinationStoreId" - list="destinationStores" + key="destinationWarehouseId" + list="destinationWarehouses" listKey="id" - listValue="name" + listValue="code" required="true" /> 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-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/webapp/WEB-INF/content/login-input.jsp 2013-04-11 20:24:53 UTC (rev 88) @@ -19,7 +19,7 @@ key="buildingId" list="allBuildings" listKey="id" - listValue="name" + listValue="code" required="true" /> Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/report.jsp =================================================================== --- trunk/magalie-web/src/main/webapp/WEB-INF/content/report.jsp 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/webapp/WEB-INF/content/report.jsp 2013-04-11 20:24:53 UTC (rev 88) @@ -48,15 +48,15 @@ <s:property value="id" /> </td> <td> - <s:property value="originLocation.storeCode" /> + <s:property value="originLocation.warehouse.code" /> - - <s:property value="originLocation.locationCode" /> + <s:property value="originLocation.code" /> </td> <td> <s:if test="destinationLocation"> - <s:property value="destinationLocation.storeCode" /> + <s:property value="destinationLocation.warehouse.code" /> - - <s:property value="destinationLocation.locationCode" /> + <s:property value="destinationLocation.code" /> </s:if> </td> <td> @@ -120,15 +120,15 @@ <s:property value="id" /> </td> <td> - <s:property value="originLocation.storeCode" /> + <s:property value="originLocation.warehouse.code" /> - - <s:property value="originLocation.locationCode" /> + <s:property value="originLocation.code" /> </td> <td> <s:if test="destinationLocation"> - <s:property value="destinationLocation.storeCode" /> + <s:property value="destinationLocation.warehouse.code" /> - - <s:property value="destinationLocation.locationCode" /> + <s:property value="destinationLocation.code" /> </s:if> </td> <td> @@ -186,10 +186,10 @@ <s:property value="id" /> </td> <td> - <s:property value="location.storeCode" /> + <s:property value="location.warehouse.code" /> </td> <td> - <s:property value="location.locationCode" /> + <s:property value="location.code" /> </td> <td> <s:property value="magalieUser.name" /> Modified: trunk/magalie-web/src/main/webapp/WEB-INF/content/withdraw-item-input.jsp =================================================================== --- trunk/magalie-web/src/main/webapp/WEB-INF/content/withdraw-item-input.jsp 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/webapp/WEB-INF/content/withdraw-item-input.jsp 2013-04-11 20:24:53 UTC (rev 88) @@ -111,7 +111,7 @@ <div id="storageMovementTemplate" class="template"> <dl class="dl-horizontal"> <dt>Empl.</dt> - <dd><span data="originLocation.store.name"></span> <span data="originLocation.locationCode"></span></dd> + <dd><span data="originLocation.warehouse.code"></span> <span data="originLocation.code"></span></dd> <dt>Prélev.</dt> <dd><span data="withdrawn">0</span> / <span data="expectedQuantity"></span> <s:property value="storageMovementTask.article.unit" /></dd> </dl> Modified: trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js =================================================================== --- trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js 2013-04-11 19:44:51 UTC (rev 87) +++ trunk/magalie-web/src/main/webapp/js/withdraw-item-input.js 2013-04-11 20:24:53 UTC (rev 88) @@ -111,7 +111,7 @@ } else { var storageMovement = this.storageMovements[this.storageMovementsIndex]; if (storageMovement.expectedQuantity == 0.) { - console.debug("will use extra location " + storageMovement.originLocation.locationCode); + console.debug("will use extra location " + storageMovement.originLocation.code); var remainingQuantity = this.quantity - this.withdrawn(); storageMovement.expectedQuantity = remainingQuantity; // var availableQuantityInLocation = storageMovement.availableQuantity;