KickJava   Java API By Example, From Geeks To Geeks.

Java > Open Source Codes > sellwin > server > RMIBizServices


1 package sellwin.server;
2
3 import sellwin.domain.*;
4 import sellwin.db.*;
5 import sellwin.utils.*;
6
7 import java.rmi.*;
8 import java.rmi.server.*;
9 import java.sql.*;
10 import java.util.*;
11
12 // SellWin http://sourceforge.net/projects/sellwincrm
13
//Contact support@open-app.com for commercial help with SellWin
14
//This software is provided "AS IS", without a warranty of any kind.
15

16 /**
17  * This class is an RMI wrapper around the business services offered
18  * by the BizServices class. Using RMI requires this wrapper technique
19  * since RMI servers have to extend the UnicastRemoteObject RMI class.;
20  */

21 public class RMIBizServices extends UnicastRemoteObject
22     implements ServerInterface {
23
24     //some security state info for a given user session is
25
//stored in 'login'
26
private Login login;
27
28     private BizServices biz;
29
30     public RMIBizServices(String JavaDoc serverName)
31         throws RemoteException {
32
33         super();
34         try {
35             Naming.rebind(serverName, this);
36
37             String JavaDoc dbType = Prefs.getDatabaseType();
38             if ((dbType == null) || (!dbType.equals("ORACLE") && !dbType.equals("MYSQL")))
39                 raiseError("Please specify DATABASE_HOST property. ORACLE or MYSQL");
40
41             if (dbType.equals("ORACLE"))
42                 biz = new BizServices(Prefs.ORACLE);
43             else
44             if (dbType.equals("MYSQL"))
45                 biz = new BizServices(Prefs.MYSQL);
46
47             String JavaDoc dbHost = Prefs.getDatabaseHost();
48             if (dbHost == null)
49                 raiseError("Please specify DATABASE_HOST property");
50
51             String JavaDoc dbPort = Prefs.getDatabasePort();
52             if (dbPort == null)
53                 raiseError("Please specify DATABASE_PORT property");
54
55             String JavaDoc dbName = Prefs.getDatabaseName();
56             if (dbName == null)
57                 raiseError("Please specify DATABASE_NAME property");
58
59
60             String JavaDoc dbID = Prefs.getDatabaseID();
61             if (dbID == null)
62                 raiseError("Please specify DATABASE_ID property");
63
64             String JavaDoc dbPassword = Prefs.getDatabasePassword();
65             if (dbPassword == null)
66                 raiseError("Please specify DATABASE_PASSWORD property");
67
68             String JavaDoc jdbcurl;
69
70             if (dbType.equals("ORACLE")) {
71                 jdbcurl = "jdbc:oracle:thin:@" + dbHost + ":" + dbPort + ":" + dbName;
72                 System.out.println("JDBC URL: " + jdbcurl);
73                 biz.init2Tier(jdbcurl, dbID, dbPassword);
74             } else {
75                 jdbcurl ="jdbc:mysql://"+ dbHost + "/" + dbName;
76                 System.out.println("JDBC URL: " + jdbcurl);
77                 biz.init2Tier(jdbcurl, dbID, dbPassword);
78             }
79         } catch (Exception JavaDoc e) {
80             e.printStackTrace();
81         }
82     }
83
84     /**
85      * update a Lead in the database
86      * @param campPK a Campaign primary key that is the
87      * container of this Lead
88      * @param l the Lead we are updating
89      * @exception AngError thrown when an app error occurs
90      */

91     public void updateLead(long campPK, Lead l)
92         throws RemoteException, AngError {
93
94         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateLead");
95
96         biz.updateLead(campPK, l);
97
98     }
99
100     /**
101      * get the Opportunity Index array structure
102      * @param u the SalesPerson we are searching with
103      * @return an ArrayList of OppIndex objects
104      * @exception AngError thrown when an app error occurs
105      */

106     public ArrayList getOpportunityIndex(SalesPerson u)
107         throws RemoteException, AngError {
108     
109         if (Prefs.DEBUG) System.out.println("RMIBizServices.getOpportunityIndex");
110
111         return biz.getOpportunityIndex(u);
112     }
113         
114     /**
115      * get the product matrix ArrayList which is a big
116      * blob of Products that we build quotes with
117      * @return an ArrayList of Product objects
118      * @exception AngError thrown when an app error occurs
119      */

120     public ArrayList getProductMatrix()
121         throws RemoteException, AngError {
122
123         if (Prefs.DEBUG) System.out.println("RMIBizServices.getProductMatrix");
124
125         return biz.getProductMatrix();
126     }
127
128     /**
129      * get a product by its primary key
130      * @param pk the primary key
131      * @return the Product if found or null if not found
132      */

133     public Product getProduct(long pk)
134         throws RemoteException, AngError {
135
136         if (Prefs.DEBUG) System.out.println("RMIBizServices.getProduct");
137         return biz.getProduct(pk);
138     }
139
140     /**
141      * update a product
142      * @param product the Product to update
143      * @exception AngError thrown when an app error occurs
144      */

145     public void updateProduct(Product product)
146         throws RemoteException, AngError {
147
148         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateProduct");
149         biz.updateProduct(product);
150     }
151     
152     /**
153      * get the list of Product groups used in the quoting
154      * process
155      * @return an ArrayList of product group objects
156      * @exception AngError thrown when an app error occurs
157      */

158     public ArrayList getProductGroups()
159         throws RemoteException, AngError {
160
161         if (Prefs.DEBUG) System.out.println("RMIBizServices.getProductGroups");
162         return biz.getProductGroups();
163     }
164
165     /**
166      * get the ArrayList of Product Line objects used
167      * in the quoting process
168      * @param group a product group to search for
169      * @return the ArrayList of found Product Line objs
170      * @exception AngError thrown when an app error occurs
171      */

172     public ArrayList getProductLines(String JavaDoc group)
173         throws RemoteException, AngError {
174
175         if (Prefs.DEBUG) System.out.println("RMIBizServices.getProductLines");
176         return biz.getProductLines(group);
177     }
178
179     /**
180      * get all the Products for a given product line
181      * @param group the product group to search in
182      * @param line the product line to search in
183      * @return the ArrayList of foun products
184      * @exception AngError thrown when an app error occurs
185      */

186     public ArrayList getProductsForLine(String JavaDoc group, String JavaDoc line)
187         throws RemoteException, AngError {
188         ArrayList prods = null;
189
190         if (Prefs.DEBUG) System.out.println("RMIBizServices.getProductsForLine");
191         return biz.getProductsForLine(group, line);
192     }
193
194     /**
195      * get a Product object using some criteria
196      * @param group the product group to search
197      * @param line the product line to search
198      * @param name the product name to search
199      * @return the found Product
200      * @exception AngError thrown when an app error occurs
201      */

202     public Product getProduct(String JavaDoc group, String JavaDoc line, String JavaDoc name)
203         throws RemoteException, AngError {
204
205         if (Prefs.DEBUG) System.out.println("RMIBizServices.getProduct");
206
207         return biz.getProduct(group, line, name);
208     }
209
210     /**
211      * add a Forecast to the database
212      * @param opportunityPK the Opportunity primary key of the
213      * parent to this Forecast being added
214      * @param a the Forecast we are adding
215      * @return the newly assigned Forecast primary key
216      * @exception AngError thrown when an app error occurs
217      */

218     public long addForecast(long opportunityPK, Forecast a)
219         throws RemoteException, AngError {
220
221         if (Prefs.DEBUG) System.out.println("RMIBizServices.addForecast");
222         return biz.addForecast(opportunityPK, a);
223     }
224
225
226     /**
227      * update the Forecast
228      * @param oppPK the Opportunity primary key of the parent
229      * to this Forecast
230      * @param a the Forecast we are updating
231      * @exception AngError thrown when an app error occurs
232      */

233     public void updateForecast(long oppPK, Forecast a)
234         throws RemoteException, AngError {
235
236         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateForecast");
237         biz.updateForecast(oppPK, a);
238     }
239
240     /**
241      * delete a Forecast
242      * @param opportunityPK the parent Opportunity's primary key
243      * @param forecastPK the Forecast primary key we delete with
244      * @exception AngError thrown when an app error occurs
245      */

246     public void deleteForecast(long opportunityPK, long forecastPK)
247         throws RemoteException, AngError {
248
249         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteForecast");
250         biz.deleteForecast(opportunityPK, forecastPK);
251     }
252
253     /**
254      * add an Order to the database
255      * @param oppPK the parent Opportunity primary key
256      * @param q the Order we are adding
257      * @return the newly assigned primary key
258      * @exception AngError thrown when an app error occurs
259      */

260     public long addOrder(long oppPK, Order q)
261         throws RemoteException, AngError {
262
263         if (Prefs.DEBUG) System.out.println("RMIBizServices.addOrder");
264         return biz.addOrder(oppPK, q);
265     }
266
267     /**
268      * update an Order in the database
269      * @param oppPK the parent Opportunity primary key
270      * @param q the Order we are updating
271      * @exception AngError thrown when an app error occurs
272      */

273     public void updateOrder(long oppPK, Order q)
274         throws RemoteException, AngError {
275
276         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateOrder");
277         biz.updateOrder(oppPK, q);
278     }
279
280     /**
281      * add a Quote to the database
282      * @param oppPK the parent Opportunity primary key
283      * @param q the Quote we are adding
284      * @return the newly assigned Quote primary key
285      * @exception AngError thrown when an app error occurs
286      */

287     public long addQuote(long oppPK, Quote q)
288         throws RemoteException, AngError {
289
290         if (Prefs.DEBUG) System.out.println("RMIBizServices.addQuote");
291         return biz.addQuote(oppPK, q);
292     }
293
294     /**
295      * update a Quote in the database
296      * @param oppPK the parent Opportunity primary key
297      * @param q the Quote we are updating
298      * @exception AngError thrown when an app error occurs
299      */

300     public void updateQuote(long oppPK, Quote q)
301         throws RemoteException, AngError {
302
303         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateQuote");
304         biz.updateQuote(oppPK, q);
305     }
306
307     /**
308      * delete a Quote in the database
309      * @param oppPK the parent Opportunity primary key
310      * @param quotePK the Quote primary key we delete with
311      * @exception AngError thrown when an app error occurs
312      */

313     public void deleteQuote(long oppPK, long quotePK)
314         throws RemoteException, AngError {
315         
316         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteQuote");
317         biz.deleteQuote(oppPK, quotePK);
318     }
319
320     /**
321      * add a QuoteLine to the database
322      * @param oppPK the parent Opportunity primary key
323      * @param quotePK the parent Quote primary key
324      * @param a the QuoteLine we are adding
325      * @return the newly assigned QuoteLine primary key
326      * @exception AngError thrown when an app error occurs
327      */

328     public long addQuoteLine(long oppPK, long quotePK, QuoteLine a)
329         throws RemoteException, AngError {
330
331         if (Prefs.DEBUG) System.out.println("RMIBizServices.addQuoteLine");
332         return biz.addQuoteLine(oppPK, quotePK, a);
333     }
334
335     /**
336      * delete a QuoteLine from the database
337      * @param oppPK the primary key of the parent Opportunity
338      * @param quotePK the primary key of the parent Quote
339      * @param linePK the primary key of the QuoteLine we are deleting
340      * @exception AngError thrown when an app error occurs
341      */

342     public void deleteQuoteLine(long oppPK, long quotePK, long linePK)
343         throws RemoteException, AngError {
344         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteQuoteLine");
345         biz.deleteQuoteLine(oppPK, quotePK, linePK);
346     }
347
348     /**
349      * get all the Alarms for a given SalesPerson
350      * only for the current day
351      * @param salesPersonPK the primary key of the sales person
352      * we are searching for
353      * @return an ArrayList of all Alarms that pertain
354      * to this sales person
355      * @exception AngError thrown when an app error occurs
356      */

357     public ArrayList getAlarms(long salesPersonPK)
358         throws RemoteException, AngError {
359
360         if (Prefs.DEBUG) System.out.println("RMIBizServices.getAlarms");
361         ArrayList acts = biz.getAlarms(salesPersonPK);
362         System.out.println("RMIBizServices.getAlarms acts="+ acts.size());
363         return acts;
364     }
365     
366     /**
367      * add an Activity to the database
368      * @param opportunityPK the parent opportunity
369      * @return description
370      * @exception AngError thrown when an app error occurs
371      */

372     public long addActivity(long opportunityPK, Activity a)
373         throws RemoteException, AngError {
374
375         if (Prefs.DEBUG) System.out.println("RMIBizServices.addActivity");
376         return biz.addActivity(opportunityPK, a);
377     }
378
379     /**
380      * update an Activity
381      * @param oppPK the containing Opportunity primary key
382      * @param a the Activity we are updating
383      * @exception AngError thrown when an app error occurs
384      */

385     public void updateActivity(long oppPK, Activity a)
386         throws RemoteException, AngError {
387
388         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateActivity");
389         biz.updateActivity(oppPK, a);
390     }
391
392     /**
393      * delete an Activity
394      * @param opportunityPK the containing opportunity primary key
395      * @param activityPK the primary key of the Activity we are deleting
396      * @exception AngError thrown when an app error occurs
397      */

398     public void deleteActivity(long opportunityPK, long activityPK)
399         throws RemoteException, AngError {
400
401         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteActivity");
402         biz.deleteActivity(opportunityPK, activityPK);
403     }
404
405
406     /**
407      * get all the user roles in the system
408      * @param lastSyncDate a user's last sync date we use to limit
409      * the query
410      * @return an ArrayList of all the found data
411      * @exception AngError thrown when an app error occurs
412      */

413     public ArrayList getAllUserRoles(java.util.Date JavaDoc lastSyncDate)
414         throws RemoteException, AngError {
415
416         if (Prefs.DEBUG) System.out.println("RMIBizServices.getAllUserRoles");
417         return biz.getAllUserRoles(lastSyncDate);
418     }
419
420     /**
421      * load a user role to the system
422      * @param role the user role we are adding
423      * @exception AngError thrown when an app error occurs
424      */

425     public void loadUserRole(UserRole role)
426         throws RemoteException, AngError {
427
428         if (Prefs.DEBUG) System.out.println("RMIBizServices.loadUserRole");
429         biz.loadUserRole(role);
430     }
431
432
433
434     /**
435      * add a user role to the system
436      * @param role the user role we are adding
437      * @exception AngError thrown when an app error occurs
438      */

439     public void addUserRole(UserRole role)
440         throws RemoteException, AngError {
441
442         if (Prefs.DEBUG) System.out.println("RMIBizServices.addUserRole");
443         biz.addUserRole(role);
444     }
445
446
447     /**
448      * deleta a user role
449      * @param pk the pk of the user role to delete
450      * @exception AngError thrown when an app error occurs
451      */

452     public void deleteUserRole(long pk)
453         throws RemoteException, AngError {
454
455         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteUserRole");
456         biz.deleteUserRole(pk);
457     }
458
459
460     /**
461      * update a user role
462      * @param role the UserRole we are updating
463      * @exception AngError thrown when an app error occurs
464      */

465     public void updateUserRole(UserRole role)
466         throws RemoteException, AngError {
467
468         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateUserRole");
469         biz.updateUserRole(role);
470     }
471
472     
473     /**
474      * get a user role
475      * @param name the name of the User Role we are getting
476      * @return the found UserRole
477      * @exception AngError thrown when an app error occurs
478      */

479     public UserRole getUserRole(String JavaDoc name)
480         throws RemoteException, AngError {
481
482         if (Prefs.DEBUG) System.out.println("RMIBizServices.getUserRole");
483         return biz.getUserRole(name);
484     }
485
486
487     /**
488      * logon to the system
489      * @param id the logon id to try
490      * @param psw the logon psw to try
491      * @return a Login credential if successful
492      * @exception AngError thrown when an app error occurs
493      */

494     public Login logon(String JavaDoc id, String JavaDoc psw)
495         throws RemoteException, AngError {
496
497         if (Prefs.DEBUG) System.out.println(id + "/" + psw + " BizServices.logon");
498         System.out.println("before logon call");
499         return biz.logon(id, psw);
500     }
501
502     /**
503      * delete a customer
504      * @param cust the customer to delete with
505      * @exception AngError thrown when an app error occurs
506      */

507     public void deleteCustomer(Customer cust)
508         throws RemoteException, AngError {
509
510         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteCustomer");
511         biz.deleteCustomer(cust);
512     }
513
514     /**
515      * delete a customer
516      * @param name the customer name to delete with
517      * @exception AngError thrown when an app error occurs
518      */

519     public void deleteCustomer(String JavaDoc name)
520         throws RemoteException, AngError {
521
522         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteCustomer");
523         biz.deleteCustomer(name);
524     }
525
526
527     /**
528      * update a customer
529      * @param c the Customer we update
530      * @exception AngError thrown when an app error occurs
531      */

532     public void updateCustomer(Customer c)
533         throws RemoteException, AngError {
534
535         if (Prefs.DEBUG) System.out.println("RMIBizServices.udpateCustomer");
536         biz.updateCustomer(c);
537     }
538
539     /**
540      * load a customer
541      * @param c the Customer to load
542      * @exception AngError thrown when an app error occurs
543      */

544     public void loadCustomer(Customer c)
545         throws RemoteException, AngError {
546
547         if (Prefs.DEBUG) System.out.println("RMIBizServices.loadCustomer");
548         biz.loadCustomer(c);
549     }
550
551     /**
552      * add a customer
553      * @param c the Customer to add
554      * @return the primary key of the newly added row
555      * @exception AngError thrown when an app error occurs
556      */

557     public long addCustomer(Customer c)
558         throws RemoteException, AngError {
559
560         if (Prefs.DEBUG) System.out.println("RMIBizServices.addCustomer");
561         return biz.addCustomer(c);
562     }
563
564
565     /**
566      * get a customer by name
567      * @param name the customer name to search with
568      * @return the found Customer
569      * @exception AngError thrown when an app error occurs
570      */

571     public Customer getCustomer(String JavaDoc name)
572         throws RemoteException, AngError {
573
574         if (Prefs.DEBUG) System.out.println("RMIBizServices.getCustomer");
575         return biz.getCustomer(name);
576     }
577
578
579     /**
580      * get all the customer names
581      * @return an array of customer names found
582      * @exception AngError thrown when an app error occurs
583      */

584     public Object JavaDoc[] getAllCustomerNames()
585         throws RemoteException, AngError {
586
587         if (Prefs.DEBUG) System.out.println("RMIBizServices.getAllCustomerNames");
588         return biz.getAllCustomerNames();
589     }
590
591     /**
592      * get a StateTax
593      * @param code the code to key with
594      * @return a StateTax if found, null if not found
595      * @exception AngError thrown when an app error occurs
596      */

597     public StateTax getTax(String JavaDoc code)
598         throws RemoteException, AngError {
599     
600         if (Prefs.DEBUG) System.out.println("RMIBizServices.getTax");
601         return biz.getTax(code);
602     }
603
604     /**
605      * update a state tax
606      * @param tax the StateTax to update
607      * @exception AngError thrown when an app error occurs
608      */

609     public void updateTax(StateTax tax)
610         throws RemoteException, AngError {
611
612         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateTax");
613         biz.updateTax(tax);
614     }
615
616     /**
617      * delete all StateTax rows
618      * @exception AngError thrown when an app error occurs
619      */

620     public void deleteAllTax()
621         throws RemoteException, AngError {
622
623         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteAllTax");
624         biz.deleteAllTax();
625     }
626
627     /**
628      * load a StateTax row
629      * @param row the StateTax row to load
630      * @exception AngError thrown when an app error occurs
631      */

632     public void loadTax(StateTax row)
633         throws RemoteException, AngError {
634         if (Prefs.DEBUG) System.out.println("RMIBizServices.getStateTax");
635         biz.loadTax(row);
636     }
637
638     /**
639      * get all the State tax codes
640      * @param lastSyncDate a user's last sync date which limits the
641      * query or null if no limit
642      * @return an ArrayList of StateTax found
643      * @exception AngError thrown when an app error occurs
644      */

645     public ArrayList getStateTax(java.util.Date JavaDoc lastSyncDate)
646         throws RemoteException, AngError {
647
648         if (Prefs.DEBUG) System.out.println("RMIBizServices.getStateTax");
649         return biz.getStateTax(lastSyncDate);
650     }
651
652
653     /**
654      * get all the Customers
655      * @param lastSyncDate a user's last sync date used to limit the
656      * query or null if no limit
657      * @return an ArrayList of Customers found
658      * @exception AngError thrown when an app error occurs
659      */

660     public ArrayList getCustomers(java.util.Date JavaDoc lastSyncDate)
661         throws RemoteException, AngError {
662
663         if (Prefs.DEBUG) System.out.println("RMIBizServices.getCustomers");
664         return biz.getCustomers(lastSyncDate);
665     }
666
667     /**
668      * load a Product
669      * @param p the Product to add
670      * @exception AngError thrown when an app error occurs
671      */

672     public void loadProduct(Product p)
673         throws RemoteException, AngError {
674
675         if (Prefs.DEBUG) System.out.println("RMIBizServices.loadProduct");
676         biz.loadProduct(p);
677     }
678
679     /**
680      * add a Product
681      * @param p the Product to add
682      * @exception AngError thrown when an app error occurs
683      */

684     public void addProduct(Product p)
685         throws RemoteException, AngError {
686
687         if (Prefs.DEBUG) System.out.println("RMIBizServices.addProduct");
688         biz.addProduct(p);
689     }
690
691     /**
692      * delete all the Products
693      * @param prod Product to delete
694      * @exception AngError thrown when an app error occurs
695      */

696     public void deleteProduct(Product prod)
697         throws RemoteException, AngError {
698
699         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteAllProduct");
700         biz.deleteProduct(prod);
701     }
702
703     
704     /**
705      * get all the Products
706      * @param a date to compare rows with in the query
707      * @return an ArrayList of Products
708      * @exception AngError thrown when an app error occurs
709      */

710     public ArrayList getProducts(java.util.Date JavaDoc afterDate)
711         throws RemoteException, AngError {
712
713         if (Prefs.DEBUG) System.out.println("RMIBizServices.getProducts");
714         return biz.getProducts(afterDate);
715     }
716
717
718     /**
719      * get all the Opportunity names for a given user
720      * @param u the SalesPerson to search for
721      * @return an ArrayList of Opportunity Names (Strings)
722      * @exception AngError thrown when an app error occurs
723      */

724     public ArrayList getOpportunityNames(SalesPerson u)
725         throws RemoteException, AngError {
726         
727         if (Prefs.DEBUG) System.out.println("RMIBizServices.getOpportunityNames");
728         return biz.getOpportunityNames(u);
729     }
730
731
732     /**
733      * get all the Opportunities for a given user
734      * @param u the SalesPerson to search for
735      * @param lastSyncDate a user's last sync date to limit the query
736      * with or null if no limit
737      * @return an ArrayList of Opportunity rows found
738      * @exception AngError thrown when an app error occurs
739      */

740     public ArrayList getOpportunities(SalesPerson u, java.util.Date JavaDoc lastSyncDate)
741         throws RemoteException, AngError {
742
743         if (Prefs.DEBUG) System.out.println("RMIBizServices.getOpportunities");
744         return biz.getOpportunities(u, lastSyncDate);
745     }
746
747
748     /**
749      * get an Opportunity
750      * @param pk search by the Opportunity's primary key
751      * @return the found Opportunity
752      * @exception AngError thrown when an app error occurs
753      */

754     public Opportunity getOpportunity(long pk)
755         throws RemoteException, AngError {
756
757         if (Prefs.DEBUG) System.out.println("RMIBizServices.getOpportunity");
758         return biz.getOpportunity(pk);
759     }
760
761
762     /**
763      * delete an Opportunity
764      * @param pk the primary key of an Opportunity to delete
765      * @exception AngError thrown when an app error occurs
766      */

767     public void deleteOpportunity(long pk)
768         throws RemoteException, AngError {
769
770         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteOpportunity");
771         biz.deleteOpportunity(pk);
772     }
773
774     /**
775      * load an Opportunity
776      * @param o the Opportunity we are loading
777      * @exception AngError thrown when an app error occurs
778      */

779     public void loadOpportunity(Opportunity o)
780         throws RemoteException, AngError {
781
782         if (Prefs.DEBUG) System.out.println("RMIBizServices.loadOpportunity");
783         biz.loadOpportunity(o);
784     }
785
786     /**
787      * add an Opportunity
788      * @param o the Opportunity we are adding
789      * @return the newly added Opportunity's primary key
790      * @exception AngError thrown when an app error occurs
791      */

792     public long addOpportunity(Opportunity o)
793         throws RemoteException, AngError {
794
795         if (Prefs.DEBUG) System.out.println("RMIBizServices.addOpportunity");
796         return biz.addOpportunity(o);
797     }
798
799
800     /**
801      * update an Opportunity
802      * @param o the Opportunity to update
803      * @exception AngError thrown when an app error occurs
804      */

805     public void updateOpportunity(Opportunity o)
806         throws RemoteException, AngError {
807
808         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateOpportunity");
809         biz.updateOpportunity(o);
810     }
811
812
813     /**
814      * delete a Contact
815      * @param oppPk the containing Opportunity primary key
816      * @param contPk the Contact primary key to delete with
817      * @exception AngError thrown when an app error occurs
818      */

819     public void deleteContact(long oppPk, long contPk)
820         throws RemoteException, AngError {
821
822         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteContact");
823         biz.deleteContact(oppPk, contPk);
824     }
825
826
827     /**
828      * update a Contact
829      * @param oppPK the containing Opportunity primary key
830      * @param c the the Contact being added
831      * @exception AngError thrown when an app error occurs
832      */

833     public void updateContact(long oppPK, Contact c)
834         throws RemoteException, AngError {
835
836         if (Prefs.DEBUG) System.out.println("RMIBizServices.udpateContact");
837         biz.updateContact(oppPK, c);
838     }
839
840     /**
841      * add a new Contact to the database belonging to the
842      * current opportunity
843      *
844      * @param oppPk the primary key of the parent opportunity
845      * @param c the Address entered for this new contact
846      * @return the primary key of the Contact object that is created
847      * @exception AngError general application error
848      */

849     public long addContact(long oppPk, Contact contact)
850         throws RemoteException, AngError {
851         
852         if (Prefs.DEBUG) System.out.println("RMIBizServices.addContact");
853         return biz.addContact(oppPk, contact);
854     }
855
856
857     /**
858      * get all SalesPersons in the system
859      * @param lastSyncDate a user's last sync date or null, used to
860      * limit the query
861      * @return an TreeMap of SalesPersons
862      * @exception AngError thrown when an app error occurs
863      */

864     public Object JavaDoc[] getSalesPersons(java.util.Date JavaDoc lastSyncDate)
865         throws RemoteException, AngError {
866
867         if (Prefs.DEBUG) System.out.println("RMIBizServices.getSalesPersons");
868         return biz.getSalesPersons(lastSyncDate);
869     }
870
871     /**
872      * get a SalesPerson using a formatted name
873      * @param pk primary key to search with
874      * @return the found SalesPerson
875      * @exception AngError thrown when an app error occurs
876      */

877     public SalesPerson getSalesPerson(long pk)
878         throws RemoteException, AngError {
879
880         if (Prefs.DEBUG) System.out.println("RMIBizServices.getSalesPerson");
881         return biz.getSalesPerson(pk);
882     }
883
884
885     /**
886      * update a SalesPerson
887      * @param s the SalesPerson to update with
888      * @exception AngError thrown when an app error occurs
889      */

890     public void updateSalesPerson(SalesPerson s)
891         throws RemoteException, AngError {
892
893         if (Prefs.DEBUG) System.out.println("RMIBizServices.updateSalesPerson");
894         biz.updateSalesPerson(s);
895     }
896
897     /**
898      * delete all user from the system
899      * @exception AngError thrown when an app error occurs
900      */

901     public void deleteAllSalesPerson()
902         throws RemoteException, AngError {
903
904         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteAllSalesPerson");
905         biz.deleteAllSalesPerson();
906     }
907
908     /**
909      * delete a user from the system
910      * @param pk the SalesPerson primary key to delete with
911      * @exception AngError thrown when an app error occurs
912      */

913     public void deleteSalesPerson(SalesPerson per)
914         throws RemoteException, AngError {
915
916         if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteSalesPerson");
917         biz.deleteSalesPerson(per);
918     }
919
920     /**
921      * load a user to the system
922      * @param s the SalesPerson to add
923      * @exception AngError thrown when an app error occurs
924      */

925     public void loadSalesPerson(SalesPerson s)
926         throws RemoteException, AngError {
927
928         if (Prefs.DEBUG) System.out.println("RMIBizServices.loadSalesPerson");
929         biz.loadSalesPerson(s);
930     }
931
932     /**
933      * add a user to the system
934      * @param s the SalesPerson to add
935      * @return the newly added row's primary key
936      * @exception AngError thrown when an app error occurs
937      */

938     public long addSalesPerson(SalesPerson s)
939         throws RemoteException, AngError {
940
941         if (Prefs.DEBUG) System.out.println("RMIBizServices.addSalesPerson");
942         return biz.addSalesPerson(s);
943     }
944
945
946     /**
947      * get all sales person id's
948      * @return an ArrayList of user IDs
949      * @exception AngError thrown when an app error occurs
950      */

951     public ArrayList getSalesPersonIDs()
952         throws RemoteException, AngError {
953
954         if (Prefs.DEBUG) System.out.println("RMIBizServices.getSalesPersonIDs");
955         return biz.getSalesPersonIDs();
956     }
957
958     /**
959      * get all the users names in 'formatted' form
960      * @return an ArrayList of formatted user names
961      * @exception AngError thrown when an app error occurs
962      */

963     public ArrayList getSalesPersonNames()
964         throws RemoteException, AngError {
965         
966         if (Prefs.DEBUG) System.out.println("RMIBizServices.getSalesPersonNames");
967         return biz.getSalesPersonNames();
968     }
969
970
971     /**
972      * add a user to a UserGroup
973      * @param userPK the primary key of the user being added
974      * @param group the UserGroup begin added to
975      * @exception AngError thrown when an app error occurs
976      */

977     public void addUserToGroup(long userPK, UserGroup group)
978         throws RemoteException, AngError {
979
980         if (Prefs.DEBUG) System.out.println("RMIBizServices.addUserToGroup");
981         biz.addUserToGroup(userPK, group);
982     }
983
984
985     /**
986      * get all the SalesPersons in a UserGroup
987      * @param groupName the UserGroup we are searching with
988      * @return an array of SalesPersons found
989      * @exception AngError thrown when an app error occurs
990      */

991     public Object JavaDoc[] getUsersInGroup(String JavaDoc groupName)
992         throws RemoteException, AngError {
993
994         if (Prefs.DEBUG) System.out.println("RMIBizServices.getUsersInGroup");
995         return biz.getUsersInGroup(groupName);
996     }
997
998     /**
999      * get a UserGroup in the system
1000     * @param pk a primary key
1001     * @return a UserGroup that was found or null if not found
1002     * @exception AngError thrown when an app error occurs
1003     */

1004    public UserGroup getUserGroup(long pk)
1005        throws RemoteException, AngError {
1006
1007        if (Prefs.DEBUG) System.out.println("RMIBizServices.getUserGroup");
1008        return biz.getUserGroup(pk);
1009    }
1010
1011    /**
1012     * get all UserGroups in the system
1013     * @param lastSyncDate a user's last sync date which limits the query
1014     * @return an array of UserGroups that were found
1015     * @exception AngError thrown when an app error occurs
1016     */

1017    public Object JavaDoc[] getUserGroups(java.util.Date JavaDoc lastSyncDate)
1018        throws RemoteException, AngError {
1019
1020        if (Prefs.DEBUG) System.out.println("RMIBizServices.getUserGroups");
1021        return biz.getUserGroups(lastSyncDate);
1022    }
1023
1024    /**
1025     * delete all the user groups
1026     * @exception AngError thrown when an app error occurs
1027     */

1028    public void deleteAllUserGroup()
1029        throws RemoteException, AngError {
1030
1031        if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteAllUserGroups");
1032        biz.deleteAllUserGroup();
1033    }
1034
1035    /**
1036     * load a UserGroup to the system
1037     * @param g a UserGroup we are adding to the system
1038     * @exception AngError thrown when an app error occurs
1039     */

1040    public void loadUserGroup(UserGroup g)
1041        throws RemoteException, AngError {
1042
1043        if (Prefs.DEBUG) System.out.println("RMIBizServices.loadUserGroup");
1044        biz.loadUserGroup(g);
1045    }
1046
1047    /**
1048     * add a UserGroup to the system
1049     * @param g a UserGroup we are adding to the system
1050     * @exception AngError thrown when an app error occurs
1051     */

1052    public void addUserGroup(UserGroup g)
1053        throws RemoteException, AngError {
1054
1055        if (Prefs.DEBUG) System.out.println("RMIBizServices.addUserGroup");
1056        biz.addUserGroup(g);
1057    }
1058
1059
1060    /**
1061     * delete a UserGroup
1062     * @param groupName the UserGroup name we delete with
1063     * @exception AngError thrown when an app error occurs
1064     */

1065    public void deleteUserGroup(String JavaDoc groupName)
1066        throws RemoteException, AngError {
1067
1068        if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteUserGroup");
1069        biz.deleteUserGroup(groupName);
1070    }
1071
1072
1073    /**
1074     * delete a user in a UserGroup
1075     * @param g the containing UserGroup
1076     * @param userPK the user's primary key we are deleting with
1077     * @exception AngError thrown when an app error occurs
1078     */

1079    public void deleteUserInGroup(UserGroup g, long userPK)
1080        throws RemoteException, AngError {
1081
1082        if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteUserInGroup");
1083        biz.deleteUserInGroup(g, userPK);
1084    }
1085
1086
1087    /**
1088     * get the UserGroups for a given user
1089     * @param userPK the SalesPerson primary key we are searching for
1090     * @return an ArrayList of UserGroup(s) this user belongs to
1091     * @exception AngError thrown when an app error occurs
1092     */

1093    public ArrayList getGroupsForUser(long userPK)
1094        throws RemoteException, AngError {
1095
1096        if (Prefs.DEBUG) System.out.println("RMIBizServices.getGroupsForUser");
1097        return biz.getGroupsForUser(userPK);
1098    }
1099
1100    
1101    /**
1102     * load a Campaign
1103     * @exception AngError thrown when an app error occurs
1104     */

1105    public void loadCampaign(Campaign c)
1106        throws RemoteException, AngError {
1107
1108        if (Prefs.DEBUG) System.out.println("RMIBizServices.loadCampaign");
1109        biz.loadCampaign(c);
1110    }
1111
1112    /**
1113     * get a Campaign
1114     * @param pk a primary key
1115     * @return a Campaign that was found or null if not found
1116     * @exception AngError thrown when an app error occurs
1117     */

1118    public Campaign getCampaign(long pk)
1119        throws RemoteException, AngError {
1120
1121        if (Prefs.DEBUG) System.out.println("RMIBizServices.getCampaign");
1122        return biz.getCampaign(pk);
1123    }
1124
1125    /**
1126     * get the Campaigns
1127     * @param lastSyncDate a user's last sync date which limits the
1128     * query or null if no limit
1129     * @return an ArrayList of Campaigns that were found
1130     * @exception AngError thrown when an app error occurs
1131     */

1132    public ArrayList getCampaigns(java.util.Date JavaDoc lastSyncDate)
1133        throws RemoteException, AngError {
1134
1135        if (Prefs.DEBUG) System.out.println("RMIBizServices.getCampaigns");
1136        return biz.getCampaigns(lastSyncDate);
1137    }
1138
1139    /**
1140     * delete the campaigns
1141     * @exception AngError thrown when an app error occurs
1142     */

1143    public void deleteAllCampaign()
1144        throws RemoteException, AngError {
1145
1146        if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteAllCampaign");
1147        biz.deleteAllCampaign();
1148    }
1149
1150
1151    /**
1152     * get a Lead
1153     * @param pk the Lead primary key
1154     * @return the Lead
1155     */

1156    public Lead getLead(long pk)
1157        throws RemoteException, AngError {
1158
1159        if (Prefs.DEBUG) System.out.println("RMIBizServices.getLead");
1160        return biz.getLead(pk);
1161    }
1162
1163    /**
1164     * get the Leads for a given Campaign
1165     * @param campaignPK the containing Campaign's primary key
1166     * @return an ArrayList of Leads that were found
1167     * @exception AngError thrown when an app error occurs
1168     */

1169    public ArrayList getCampaignLeads(long campaignPK)
1170        throws RemoteException, AngError {
1171
1172        if (Prefs.DEBUG) System.out.println("RMIBizServices.getCampaignLeads");
1173        return biz.getCampaignLeads(campaignPK);
1174    }
1175
1176    /**
1177     * get all Leads
1178     * @param lastSyncDate a user's last sync date used to limit the
1179     * query or null if no limit
1180     * @return an ArrayList of Leads that were found
1181     * @exception AngError thrown when an app error occurs
1182     */

1183    public ArrayList getCampaignLeads(java.util.Date JavaDoc lastSyncDate)
1184        throws RemoteException, AngError {
1185
1186        if (Prefs.DEBUG) System.out.println("RMIBizServices.getCampaignLeads all");
1187        return biz.getCampaignLeads(lastSyncDate);
1188    }
1189
1190    /**
1191     * process the items that were deleted by a user when
1192     * operating in a 'disconnected' mode, each object
1193     * in the passed list will be deleted from the database
1194     *
1195     * @param deletes the ArrayList of DeleteInfo objects
1196     * @exception AngError thrown when an app error occurs
1197     */

1198    public void uploadDeletes(ArrayList deletes)
1199        throws RemoteException, AngError {
1200    
1201        if (Prefs.DEBUG) System.out.println("RMIBizServices.getCampaignLeads");
1202        biz.uploadDeletes(deletes);
1203    }
1204
1205    /**
1206     * add a customer inventory
1207     * @param ci the CustomerInventory to add
1208     * @return the primary key of the newly added row
1209     * @exception AngError thrown when an app error occurs
1210     */

1211    public long addCustomerInventory(CustomerInventory c)
1212        throws RemoteException, AngError {
1213
1214        if (Prefs.DEBUG) System.out.println("RMIBizServices.addCustomerInventory");
1215        return biz.addCustomerInventory(c);
1216    }
1217
1218    /**
1219     * delete a customer inventory
1220     * @param ci the customer inventory to delete with
1221     * @exception AngError thrown when an app error occurs
1222     */

1223    public void deleteCustomerInventory(CustomerInventory ci)
1224        throws RemoteException, AngError {
1225
1226        if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteCustomerInventory");
1227        biz.deleteCustomerInventory(ci);
1228    }
1229
1230    /**
1231     * get the CustomerInventory for a given customer
1232     * @param cust the Customer we are searching with
1233     * @return an ArrayList of CustomerInventory objects
1234     * @exception AngError thrown when an app error occurs
1235     */

1236    public ArrayList getCustomerInventory(long custPK)
1237        throws RemoteException, AngError {
1238    
1239        if (Prefs.DEBUG) System.out.println("RMIBizServices.getCustomerInventory");
1240        return biz.getCustomerInventory(custPK);
1241    }
1242
1243    /**
1244     * see BizServices
1245     */

1246    public void deleteAllUserRole()
1247        throws RemoteException, AngError {
1248        
1249        if (Prefs.DEBUG) System.out.println("RMIBizServices.deleteAllUserRole");
1250        biz.deleteAllUserRole();
1251    }
1252
1253    /**
1254     * see BizServices
1255     */

1256    public ArrayList getGroupMembers(java.util.Date JavaDoc lastSyncDate)
1257        throws RemoteException, AngError {
1258
1259        if (Prefs.DEBUG) System.out.println("RMIBizServices.getGroupMembers");
1260        return biz.getGroupMembers(lastSyncDate);
1261    }
1262
1263    /**
1264     * see BizServices
1265     */

1266    public UserGroupMember getGroupMember(long pk)
1267        throws RemoteException, AngError {
1268
1269        if (Prefs.DEBUG) System.out.println("RMIBizServices.getGroupMember");
1270        return biz.getGroupMember(pk);
1271    }
1272
1273    /**
1274     * see BizServices
1275     */

1276    public void loadGroupMember(UserGroupMember ugm)
1277        throws RemoteException, AngError {
1278
1279        if (Prefs.DEBUG) System.out.println("RMIBizServices.loadGroupMember");
1280        biz.loadGroupMember(ugm);
1281    }
1282
1283    /**
1284     * see BizServices
1285     */

1286    private void loadLead(Lead lead)
1287        throws RemoteException, AngError {
1288
1289        if (Prefs.DEBUG) System.out.println("RMIBizServices.loadLead");
1290        biz.loadLead(lead);
1291    }
1292
1293    /**
1294     * utility to display an error then exit
1295     */

1296     private void raiseError(String JavaDoc msg) {
1297        System.out.println(msg);
1298        System.exit(1);
1299     }
1300
1301}
1302
Popular Tags