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.order.model.facade;
17  
18  import java.util.Collection;
19  import java.util.Map;
20  
21  import net.sf.oness.common.model.util.PaginatedList;
22  import net.sf.oness.order.model.bo.DeliveryDocket;
23  import net.sf.oness.order.model.bo.Invoice;
24  import net.sf.oness.order.model.bo.Order;
25  import net.sf.oness.order.model.bo.OrderItem;
26  import net.sf.oness.order.model.to.DeliveryDocketWithParty;
27  import net.sf.oness.order.model.to.InvoiceWithParty;
28  import net.sf.oness.order.model.to.OrderWithParty;
29  
30  /***
31   * Facade that models the service of order management
32   * 
33   * @author Carlos Sanchez
34   * @version $Revision: 1.10 $
35   */
36  public interface OrderFacadeDelegate {
37  
38      /***
39       * Find an order.
40       * 
41       * @param id
42       * @return The order with items
43       * @throws org.springframework.dao.DataAccessException
44       */
45      public OrderWithParty findOrderWithDetails(final Long id);
46  
47      /***
48       * Create an order.
49       * 
50       * @param order
51       * @return The order created
52       * @throws org.springframework.dao.DataAccessException
53       */
54      public OrderWithParty createOrder(final Order order);
55  
56      /***
57       * Update an order.
58       * 
59       * @param order
60       * @param items
61       * @return The order updated
62       * @throws org.springframework.dao.DataAccessException
63       */
64      public OrderWithParty updateOrder(final Order order, final Collection items);
65  
66      /***
67       * Find orders
68       * 
69       * @param order
70       * @param firstElement
71       * @param maxElements
72       * @return List of OrderWithParty objects
73       * @throws org.springframework.dao.DataAccessException
74       */
75      public PaginatedList findOrder(final Order order, final int firstElement,
76              final int maxElements);
77  
78      /***
79       * Delete an order
80       * 
81       * @param id
82       * @throws org.springframework.dao.DataRetrievalFailureException
83       * @throws org.springframework.dao.DataAccessException
84       */
85      public void deleteOrder(final Long id);
86  
87      /***
88       * Add an order item to an order. If the product is already in the order the
89       * quantity is added.
90       * 
91       * @param orderItem
92       * @param orderId
93       * @return The order updated
94       * @throws org.springframework.dao.DataAccessException
95       */
96      public OrderWithParty createOrderItem(final OrderItem orderItem,
97              final Long orderId);
98  
99      /***
100      * Add order items to an order. If the product is already in the order the
101      * quantity is added.
102      * 
103      * @param orderItems
104      *            Can't contain two items of the same product.
105      * @param orderId
106      * @return The order updated
107      * @throws org.springframework.dao.DataAccessException
108      */
109     public OrderWithParty createOrderItems(final Collection orderItems,
110             final Long orderId);
111 
112     /***
113      * Create a delivery docket.
114      * 
115      * @param deliveryDocket
116      * @param items
117      *            orderItem id as key and deliveryDocket as value
118      * @return The deliveryDocket created
119      * @throws org.springframework.dao.DataAccessException
120      */
121     public DeliveryDocketWithParty createDeliveryDocket(
122             final DeliveryDocket deliveryDocket, Map item);
123 
124     /***
125      * Find a delivery docket.
126      * 
127      * @param id
128      * @return The deliveryDocket with items
129      * @throws org.springframework.dao.DataAccessException
130      */
131     public DeliveryDocketWithParty findDeliveryDocketWithDetails(final Long id);
132 
133     /***
134      * Add delivery docket items to a delivery docket.
135      * 
136      * @param deliveryDocketItems
137      *            orderItem id as key and deliveryDocket as value
138      * @param deliveryDocketId
139      * @return The delivery docket updated
140      * @throws org.springframework.dao.DataAccessException
141      */
142     public DeliveryDocketWithParty createDeliveryDocketItems(
143             final Map deliveryDocketItems, final Long deliveryDocketId);
144 
145     /***
146      * Find delivery dockets
147      * 
148      * @param deliveryDocket
149      * @param firstElement
150      * @param maxElements
151      * @return List of DeliveryDocketWithParty objects
152      * @throws org.springframework.dao.DataAccessException
153      */
154     public PaginatedList findDeliveryDocket(
155             final DeliveryDocket deliveryDocket, final int firstElement,
156             final int maxElements);
157 
158     /***
159      * Update a delivery docket.
160      * 
161      * @param deliveryDocket
162      * @param items
163      * @return The deliveryDocket updated
164      * @throws org.springframework.dao.DataAccessException
165      */
166     public DeliveryDocketWithParty updateDeliveryDocket(
167             final DeliveryDocket deliveryDocket, final Collection items);
168 
169     /***
170      * Delete a delivery docket
171      * 
172      * @param id
173      * @throws org.springframework.dao.DataRetrievalFailureException
174      * @throws org.springframework.dao.DataAccessException
175      */
176     public void deleteDeliveryDocket(final Long id);
177 
178     /***
179      * Create invoices.
180      * 
181      * @param deliveryDocketIds
182      * @throws org.springframework.dao.DataAccessException
183      */
184     public void createInvoices(final Collection deliveryDocketIds);
185 
186     /***
187      * Find an invoice.
188      * 
189      * @param id
190      * @return The invoice with items
191      * @throws org.springframework.dao.DataAccessException
192      */
193     public InvoiceWithParty findInvoiceWithDetails(final Long id);
194 
195     /***
196      * Find invoices
197      * 
198      * @param invoice
199      * @param firstElement
200      * @param maxElements
201      * @return List of InvoiceWithParty objects
202      * @throws org.springframework.dao.DataAccessException
203      */
204     public PaginatedList findInvoice(final Invoice invoice,
205             final int firstElement, final int maxElements);
206 
207 }