View Javadoc

1   /*
2    * Copyright 2004 Carlos Sanchez.
3    *
4    * Licensed under the Apache License, Version 2.0 (the "License");
5    * you may not use this file except in compliance with the License.
6    * You may obtain a copy of the License at
7    *
8    *      http://www.apache.org/licenses/LICENSE-2.0
9    *
10   * Unless required by applicable law or agreed to in writing, software
11   * distributed under the License is distributed on an "AS IS" BASIS,
12   * WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
13   * See the License for the specific language governing permissions and
14   * limitations under the License.
15   */
16  package net.sf.oness.inventory.model.facade;
17  
18  import java.util.Collection;
19  import java.util.List;
20  import java.util.Map;
21  
22  import net.sf.oness.common.model.util.PaginatedList;
23  import net.sf.oness.inventory.model.product.bo.Model;
24  import net.sf.oness.inventory.model.product.bo.Product;
25  
26  /***
27   * Facade that models the service of inventory management
28   * 
29   * @author Carlos Sanchez
30   * @version $Revision: 1.12 $
31   */
32  public interface InventoryFacadeDelegate {
33  
34      /***
35       * Create a model and a product for each size and color.
36       * 
37       * @param model
38       * @param sizeGroupId
39       * @param colorIds
40       * @return The model created
41       * @throws org.springframework.dao.DataAccessException
42       */
43      public Model createModel(final Model model, final Long sizeGroupId,
44              final Collection colorIds);
45  
46      /***
47       * 
48       * @param model
49       * @return the model updated
50       * @throws org.springframework.dao.DataAccessException
51       */
52      public Model updateModel(final Model model);
53  
54      /***
55       * 
56       * @param id
57       * @throws org.springframework.dao.DataRetrievalFailureException
58       * @throws org.springframework.dao.DataAccessException
59       */
60      public void deleteModel(final Long id);
61  
62      /***
63       * Find a model without its products nor sizes of its sizeGroup
64       * 
65       * @param id
66       * @return the model
67       * @throws org.springframework.dao.DataRetrievalFailureException
68       * @throws org.springframework.dao.DataAccessException
69       */
70      public Model findModel(final Long id);
71  
72      /***
73       * Find a model with all its products and sizes of its sizeGroup
74       * 
75       * @param id
76       * @return the model
77       * @throws org.springframework.dao.DataRetrievalFailureException
78       * @throws org.springframework.dao.DataAccessException
79       */
80      public Model findModelWithDetails(final Long id);
81  
82      /***
83       * Find a product with all its stocks and prices
84       * 
85       * @param id
86       * @return the product
87       * @throws org.springframework.dao.DataRetrievalFailureException
88       * @throws org.springframework.dao.DataAccessException
89       */
90      public Product findProductWithDetails(Long id);
91  
92      /***
93       * Find a model without products
94       * 
95       * @param model
96       * @param firstElement
97       * @param maxElements
98       * @return List of Model objects
99       * @throws org.springframework.dao.DataAccessException
100      */
101     public PaginatedList findModel(final Model model, final int firstElement,
102             final int maxElements);
103 
104     /***
105      * Get all size groups with its sizes
106      * 
107      * @return List of SizeGroup objects
108      */
109     public List getAllSizeGroups();
110 
111     /***
112      * Get all colors
113      * 
114      * @return List of Color objects
115      */
116     public List getAllColors();
117 
118     /***
119      * Get all Warehouses
120      * 
121      * @return List of Warehouse objects
122      */
123     public List getAllWarehouses();
124 
125     /***
126      * Get all fares
127      * 
128      * @return List of Fare objects
129      */
130     public List getAllFares();
131 
132     /***
133      * Get a model for editing its prices
134      * 
135      * @param modelId
136      *            id of the model
137      * @return the model with all products and prices
138      * @throws org.springframework.dao.DataAccessException
139      */
140     public Model editPrices(final Long modelId);
141 
142     /***
143      * Update the prices for some products. Prices that already don't exist for
144      * a fare and product will be created, else they will be updated if the
145      * amount has been modified or deleted if amount is null. All products must
146      * be from the same model.
147      * 
148      * @param productPrices
149      *            Map with product ids as keys and a map (fare id, price amount
150      *            as BigDecimal) as value.
151      * @return the model with prices updated
152      * @throws org.springframework.dao.DataAccessException
153      */
154     public Model updatePrices(final Map productPrices);
155 
156     /***
157      * Find products by ids
158      * 
159      * @param productIds
160      * @return Map with product ids as keys
161      * @throws org.springframework.dao.DataAccessException
162      */
163     public Map findProducts(final Collection productIds);
164 
165 }