package com report_lib import com report_lib data import com report_li

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
package com.report_lib;
import com.report_lib.data.*;
import com.report_lib.data.report.Report;
import java.io.UnsupportedEncodingException;
/**
* Created by Микола on 26.05.15.
*/
public class Program {
public static void main(String[] args) throws UnsupportedEncodingException {
String defaultReport = "price_list";
String selectedReport = defaultReport;
args[0] = defaultReport;
Integer userId = 5;
try{
if(!args[0].isEmpty()){
selectedReport = args[0];
}
else{
System.out.println("loading default report - " + selectedReport);
}
if(selectedReport.equals("user_sms") && !args[1].isEmpty()){
userId = new Integer(args[1]);
}
else if(!selectedReport.equals("user_sms")){
selectedReport = defaultReport;
}
Report report;
if (selectedReport.equals("price_list")) {
report = new PriceList();
} else if (selectedReport.equals("sended_sms")) {
report = new SendedSms();
} else if(selectedReport.equals("sms_country")){
report = new SmsCountry();
} else if(selectedReport.equals("sms_stat")){
report = new SmsStat();
}
else {
report = new UserSms(userId);
}
report.prepareReport("report.ftl");
report.saveToFile("index.html");
report.showInWebBrowser();}
catch (ArrayIndexOutOfBoundsException e){
System.out.println(e.getMessage());
}
}
}