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