View Javadoc
1   package com.srv4pos.server.api;
2   
3   import com.srv4pos.server.api.activation.ActivationService;
4   import com.srv4pos.server.api.activation.DeviceService;
5   import com.srv4pos.server.api.activation.SignatureHelper;
6   import com.srv4pos.server.api.auth.AuthService;
7   import com.srv4pos.server.api.booking.BookingService;
8   import com.srv4pos.server.api.buildinfo.BuildInfoService;
9   import com.srv4pos.server.api.category.CategoryService;
10  import com.srv4pos.server.api.commodity.CommodityService;
11  import com.srv4pos.server.api.customization.CustomizationGroupService;
12  import com.srv4pos.server.api.customization.CustomizationItemService;
13  import com.srv4pos.server.api.day.DayService;
14  import com.srv4pos.server.api.ejournal.EJournalService;
15  import com.srv4pos.server.api.email.EmailService;
16  import com.srv4pos.server.api.hairdresser.HairdresserService;
17  import com.srv4pos.server.api.infrastructure.credentials.Credentials;
18  import com.srv4pos.server.api.infrastructure.http.Transport;
19  import com.srv4pos.server.api.integration.dibs.DibsIntegrationService;
20  import com.srv4pos.server.api.kdfacet.KdFacetService;
21  import com.srv4pos.server.api.keyboard.KeyboardService;
22  import com.srv4pos.server.api.keyboardentry.KeyboardEntryService;
23  import com.srv4pos.server.api.order.OrderService;
24  import com.srv4pos.server.api.posplus.PosPlusService;
25  import com.srv4pos.server.api.precept.PreceptService;
26  import com.srv4pos.server.api.product.ProductService;
27  import com.srv4pos.server.api.receiptSettings.ReceiptSettingsService;
28  import com.srv4pos.server.api.registration.RegistrationService;
29  import com.srv4pos.server.api.restaurant.RestaurantService;
30  import com.srv4pos.server.api.sale.SaleService;
31  import com.srv4pos.server.api.sale.SaleSlotService;
32  import com.srv4pos.server.api.sale.TripService;
33  import com.srv4pos.server.api.seller.SellerService;
34  import com.srv4pos.server.api.seller.UserService;
35  import com.srv4pos.server.api.server.ServerService;
36  import com.srv4pos.server.api.softwareVendor.SoftwareVendorService;
37  import com.srv4pos.server.api.tax.TaxService;
38  import com.srv4pos.server.api.treasurer.TreasurerService;
39  
40  import java.net.URL;
41  
42  /**
43   * Main class where you can find links to every service.
44   * User: Kirill
45   * Date: 27.07.13 12:01
46   */
47  public class ServiceFactory {
48      private final ServerService serverService;
49      private final ActivationService activationService;
50      private AuthService authService;
51      private SellerService sellerService;
52      private TaxService taxService;
53      private ProductService productService;
54      private OrderService orderService;
55      private CategoryService categoryService;
56      private CommodityService commodityService;
57      private PosPlusService posPlusService;
58      private KeyboardService keyboardService;
59      private KeyboardEntryService keyboardEntryService;
60      private RegistrationService registrationService;
61      private TreasurerService treasurerService;
62      private RestaurantService restaurantService;
63      private SignatureHelper signatureHelper;
64      private BookingService bookingService;
65      private SaleService saleService;
66      private CustomizationItemService customizationItemService;
67      private CustomizationGroupService customizationGroupService;
68      private SaleSlotService saleSlotService;
69      private SoftwareVendorService softwareVendorService;
70      private BuildInfoService buildInfoService;
71      private KdFacetService kdFacetService;
72      private UserService userService;
73      private ReceiptSettingsService receiptSettingsService;
74      private PreceptService preceptService;
75      private DeviceService deviceService;
76      private HairdresserService hairdresserService;
77      private DayService dayService;
78      private EmailService emailService;
79      private EJournalService eJournalService;
80      private DibsIntegrationService dibsIntegrationService;
81      private TripService tripService;
82  
83      /**
84       * Creates the factory.
85       *
86       * @param url         specify url of the server (usually https://a.srv4pos.com/api/v{versionNumber})
87       * @param credentials specify username and password to connect to or null if you want to connect to public methods
88       * @param transport   specify a mecanism to make api calls, see {@link Transport} for more info.
89       */
90      public ServiceFactory(URL url, Credentials credentials, Transport transport) {
91          authService = new AuthService(url, credentials, transport);
92          sellerService = new SellerService(url, credentials, transport);
93          taxService = new TaxService(url, credentials, transport);
94          productService = new ProductService(url, credentials, transport);
95          orderService = new OrderService(url, credentials, transport);
96          categoryService = new CategoryService(url, credentials, transport);
97          commodityService = new CommodityService(url, credentials, transport);
98          serverService = new ServerService(url, credentials, transport);
99          activationService = new ActivationService(url, credentials, transport);
100         posPlusService = new PosPlusService(url, credentials, transport);
101         keyboardService = new KeyboardService(url, credentials, transport);
102         keyboardEntryService = new KeyboardEntryService(url, credentials, transport);
103         registrationService = new RegistrationService(url, credentials, transport);
104         treasurerService = new TreasurerService(url, credentials, transport);
105         restaurantService = new RestaurantService(url, credentials, transport);
106         bookingService = new BookingService(url, credentials, transport);
107         saleService = new SaleService(url, credentials, transport);
108         signatureHelper = new SignatureHelper();
109         customizationItemService = new CustomizationItemService(url, credentials, transport);
110         customizationGroupService = new CustomizationGroupService(url, credentials, transport);
111         saleSlotService = new SaleSlotService(url, credentials, transport);
112         softwareVendorService = new SoftwareVendorService(url, credentials, transport);
113         buildInfoService = new BuildInfoService(url, credentials, transport);
114         kdFacetService = new KdFacetService(url, credentials, transport);
115         userService = new UserService(url, credentials, transport);
116         receiptSettingsService = new ReceiptSettingsService(url, credentials, transport);
117         preceptService = new PreceptService(url, credentials, transport);
118         deviceService = new DeviceService(url, credentials, transport);
119         hairdresserService = new HairdresserService(url, credentials, transport);
120         dayService =  new DayService(url, credentials, transport);
121         emailService = new EmailService(url, credentials, transport);
122         eJournalService = new EJournalService(url, credentials, transport);
123         dibsIntegrationService = new DibsIntegrationService(url, credentials, transport);
124         tripService = new TripService(url, credentials, transport);
125     }
126 
127     /**
128      * Common aggregation for utility methods requires authentication.
129      *
130      * @return authService
131      */
132     public AuthService getAuthService() {
133         return authService;
134     }
135 
136     /**
137      * Exchange data for SellerLog entity related to currently authentcated seller.
138      *
139      * @return sellerService
140      */
141     public SellerService getSellerService() {
142         return sellerService;
143     }
144 
145     /**
146      * Exchange data for TaxLog entity.
147      *
148      * @return taxService
149      */
150     public TaxService getTaxService() {
151         return taxService;
152     }
153 
154     /**
155      * Exchange data for ProductLog entity.
156      *
157      * @return productService
158      */
159     public ProductService getProductService() {
160         return productService;
161     }
162 
163     /**
164      * Sending order.
165      *
166      * @return orderService
167      */
168     public OrderService getOrderService() {
169         return orderService;
170     }
171 
172     /**
173      * Exchange data for CategoryLog entity.
174      *
175      * @return categoryService
176      */
177     public CategoryService getCategoryService() {
178         return categoryService;
179     }
180 
181     /**
182      * Exchange data for Commodity entity.
183      *
184      * @return commodityService
185      */
186     public CommodityService getCommodityService() {
187         return commodityService;
188     }
189 
190     /**
191      * Setup server.
192      *
193      * @return serverService
194      */
195     public ServerService getServerService() {
196         return serverService;
197     }
198 
199     /**
200      * Server for activating andoird applications.
201      *
202      * @return activationService
203      */
204     public ActivationService getActivationService() {
205         return activationService;
206     }
207 
208     /**
209      * To send data to control unit connected to the server.
210      *
211      * @return posPlusService
212      */
213     public PosPlusService getPosPlusService() {
214         return posPlusService;
215     }
216 
217     /**
218      * Exchange data for KeyboardLog entity.
219      *
220      * @return keyboardService
221      */
222     public KeyboardService getKeyboardService() {
223         return keyboardService;
224     }
225 
226     /**
227      * Exchange data for KeyboardEntryLog entity.
228      *
229      * @return keyboardEntryService
230      */
231     public KeyboardEntryService getKeyboardEntryService() {
232         return keyboardEntryService;
233     }
234 
235     /**
236      * Exchange data for Registration entity.
237      *
238      * @return registrationService
239      */
240     public RegistrationService getRegistrationService() {
241         return registrationService;
242     }
243 
244     /**
245      * Exchange data for Treasurer entity.
246      *
247      * @return treasurerService
248      */
249     public TreasurerService getTreasurerService() {
250         return treasurerService;
251     }
252 
253     /**
254      * Exchange data for Restaurant entity.
255      *
256      * @return treasurerService
257      */
258     public RestaurantService getRestaurantService() {
259         return restaurantService;
260     }
261 
262     /**
263      * Helper to work with digital signatures. For instance verification.
264      *
265      * @return signatureHelper
266      */
267     public SignatureHelper getSignatureHelper() {
268         return signatureHelper;
269     }
270 
271     /**
272      * Exchange data for Booking entity.
273      *
274      * @return bookingService
275      */
276     public BookingService getBookingService() {
277         return bookingService;
278     }
279 
280     /**
281      * Exchange data for Sale service entity.
282      *
283      * @return saleService
284      */
285     public SaleService getSaleService() {
286         return saleService;
287     }
288 
289     /**
290      * Exchange data for customization item service entity.
291      *
292      * @return customizationItemService
293      */
294     public CustomizationItemService getCustomizationItemService() {
295         return customizationItemService;
296     }
297 
298     /**
299      * Exchange data for customization group entity.
300      *
301      * @return customizationGroupService
302      */
303     public CustomizationGroupService getCustomizationGroupService() {
304         return customizationGroupService;
305     }
306 
307     /**
308      * Exchange data for sale slot entity.
309      *
310      * @return saleSlotService
311      */
312     public SaleSlotService getSaleSlotService() {
313         return saleSlotService;
314     }
315 
316     /**
317      * Exchange data for software vendor entity.
318      * @return softwareVendorService
319      */
320     public SoftwareVendorService getSoftwareVendorService() {
321         return softwareVendorService;
322     }
323 
324     /**
325      * Exchange data for build info entity.
326      * @return buildInfoService
327      */
328     public BuildInfoService getBuildInfoService() {
329         return buildInfoService;
330     }
331 
332     /**
333      * Manage kdFacet entity.
334      *
335      * @return kdFacetService
336      */
337     public KdFacetService getKdFacetService() {
338         return kdFacetService;
339     }
340 
341     /**
342      * Manage users.
343      *
344      * @return userService
345      */
346     public UserService getUserService() {
347         return userService;
348     }
349 
350     /**
351      * Manage date for receipt settings entity.
352      *
353      * @return ReceiptSettingsService
354      */
355     public ReceiptSettingsService getReceiptSettingsService() {
356         return receiptSettingsService;
357     }
358 
359     /**
360      * Sending precept.
361      *
362      * @return preceptService
363      */
364     public PreceptService getPreceptService() {
365         return preceptService;
366     }
367 
368     /**
369      * Sends devices info.
370      *
371      * @return deviceService
372      */
373     public DeviceService getDeviceService() {
374         return deviceService;
375     }
376 
377     /**
378      * Exchange data for Hairdresser entity.
379      *
380      * @return hairdresserService
381      */
382     public HairdresserService getHairdresserService() {
383         return hairdresserService;
384     }
385 
386     /**
387      * Exchange data for day entity.
388      *
389      * @return dayService
390      */
391     public DayService getDayService() {
392         return dayService;
393     }
394 
395     /**
396      * Sends e-mails.
397      *
398      * @return emailService
399      */
400     public EmailService getEmailService() {
401         return emailService;
402     }
403 
404     // TODO RI: javadoc
405     public EJournalService getEJournalService() {
406         return eJournalService;
407     }
408 
409     /**
410      * @return dibsIntegrationService
411      */
412     public DibsIntegrationService getDibsIntegrationService() {
413         return dibsIntegrationService;
414     }
415 
416     public TripService getTripService() {
417         return tripService;
418     }
419 }