Source Code Cross Referenced for ProcessOF.java in  » Database-Client » DBBrowser » org » dbbrowser » Java Source Code / Java DocumentationJava Source Code and Java Documentation

Java Source Code / Java Documentation
1. 6.0 JDK Core
2. 6.0 JDK Modules
3. 6.0 JDK Modules com.sun
4. 6.0 JDK Modules com.sun.java
5. 6.0 JDK Modules sun
6. 6.0 JDK Platform
7. Ajax
8. Apache Harmony Java SE
9. Aspect oriented
10. Authentication Authorization
11. Blogger System
12. Build
13. Byte Code
14. Cache
15. Chart
16. Chat
17. Code Analyzer
18. Collaboration
19. Content Management System
20. Database Client
21. Database DBMS
22. Database JDBC Connection Pool
23. Database ORM
24. Development
25. EJB Server geronimo
26. EJB Server GlassFish
27. EJB Server JBoss 4.2.1
28. EJB Server resin 3.1.5
29. ERP CRM Financial
30. ESB
31. Forum
32. GIS
33. Graphic Library
34. Groupware
35. HTML Parser
36. IDE
37. IDE Eclipse
38. IDE Netbeans
39. Installer
40. Internationalization Localization
41. Inversion of Control
42. Issue Tracking
43. J2EE
44. JBoss
45. JMS
46. JMX
47. Library
48. Mail Clients
49. Net
50. Parser
51. PDF
52. Portal
53. Profiler
54. Project Management
55. Report
56. RSS RDF
57. Rule Engine
58. Science
59. Scripting
60. Search Engine
61. Security
62. Sevlet Container
63. Source Control
64. Swing Library
65. Template Engine
66. Test Coverage
67. Testing
68. UML
69. Web Crawler
70. Web Framework
71. Web Mail
72. Web Server
73. Web Services
74. Web Services apache cxf 2.0.1
75. Web Services AXIS2
76. Wiki Engine
77. Workflow Engines
78. XML
79. XML UI
Java
Java Tutorial
Java Open Source
Jar File Download
Java Articles
Java Products
Java by API
Photoshop Tutorials
Maya Tutorials
Flash Tutorials
3ds-Max Tutorials
Illustrator Tutorials
GIMP Tutorials
C# / C Sharp
C# / CSharp Tutorial
C# / CSharp Open Source
ASP.Net
ASP.NET Tutorial
JavaScript DHTML
JavaScript Tutorial
JavaScript Reference
HTML / CSS
HTML CSS Reference
C / ANSI-C
C Tutorial
C++
C++ Tutorial
Ruby
PHP
Python
Python Tutorial
Python Open Source
SQL Server / T-SQL
SQL Server / T-SQL Tutorial
Oracle PL / SQL
Oracle PL/SQL Tutorial
PostgreSQL
SQL / MySQL
MySQL Tutorial
VB.Net
VB.Net Tutorial
Flash / Flex / ActionScript
VBA / Excel / Access / Word
XML
XML Tutorial
Microsoft Office PowerPoint 2007 Tutorial
Microsoft Office Excel 2007 Tutorial
Microsoft Office Word 2007 Tutorial
Java Source Code / Java Documentation » Database Client » DBBrowser » org.dbbrowser 
Source Cross Referenced  Class Diagram Java Document (Java Doc) 


001:        package org.dbbrowser;
002:
003:        import java.io.BufferedReader;
004:        import java.io.BufferedWriter;
005:        import java.io.FileReader;
006:        import java.io.FileWriter;
007:        import java.io.IOException;
008:
009:        public class ProcessOF {
010:            private String FILE_HEADER = "\"HDR\",\"DL7431\",\"CMS/CLASS INTEGRATION OVERNIGHT FEED -  16/03/2006\",\"2006/03/16\"\n"
011:                    + "\"IDENTIFIER\",\"RECORD TYPE\",\"ACTION TYPE\",\"UNIQUE CLAIM REFERENCE\",\"TRANSACTION REFERENCE\",\"CLAIM SEQUENCE NUMBER\",\"BUREAU ID\"";
012:
013:            public static void main(String[] args) {
014:                (new ProcessOF()).runForWellington();
015:            }
016:
017:            /*
018:            insert into policy 
019:            (
020:            ID, 
021:            CLIENT_NAME,
022:            IS_SKELETAL,
023:            CLASS_OSND_DATE,
024:            CLASS_OSND_NUMBER,
025:            VERSION
026:            )
027:            values
028:            (
029:            POLICY_SEQ.nextval,
030:            'Wellington',
031:            'N',
032:            '03-APR-2006',
033:            77777,
034:            0
035:            )
036:
037:             *
038:             */
039:
040:            public void runForAscot() {
041:                insertHeader("C:/projects/xcs_cms/target/dist/ASCOT-claims-for-stress-testing.csv");
042:                processTypeA_Data(
043:                        "1414",
044:                        "SY",
045:                        15,
046:                        "ASCOT",
047:                        "C:/projects/xcs_cms/target/dist/template-type-A-for-OF-for-stress-testing.csv",
048:                        "C:/projects/xcs_cms/target/dist/ASCOT-claims-for-stress-testing.csv");
049:                System.out
050:                        .println("\n-----------------------------------------------------------------------------------\n");
051:                processTypeB_Data(
052:                        "1414",
053:                        "SY",
054:                        15,
055:                        "ASCOT",
056:                        "C:/projects/xcs_cms/target/dist/template-type-B-for-OF-for-stress-testing.csv",
057:                        "C:/projects/xcs_cms/target/dist/ASCOT-claims-for-stress-testing.csv");
058:                System.out
059:                        .println("\n-----------------------------------------------------------------------------------\n");
060:                processTypeC_Data(
061:                        "1414",
062:                        "SY",
063:                        15,
064:                        "ASCOT",
065:                        "C:/projects/xcs_cms/target/dist/template-type-C-for-OF-for-stress-testing.csv",
066:                        "C:/projects/xcs_cms/target/dist/ASCOT-claims-for-stress-testing.csv");
067:                System.out
068:                        .println("\n-----------------------------------------------------------------------------------\n");
069:                //processTypeD_Data("1414", "SY", 15, "ASCOT", "C:/projects/xcs_cms/target/dist/template-type-D-for-OF-for-stress-testing.csv", "C:/projects/xcs_cms/target/dist/ASCOT-claims-for-stress-testing.csv");
070:            }
071:
072:            public void runForAxis() {
073:                insertHeader("C:/projects/xcs_cms/target/dist/AXIS-claims-for-stress-testing.csv");
074:                processTypeA_Data(
075:                        "A9208",
076:                        "LR",
077:                        15,
078:                        "AXIS",
079:                        "C:/projects/xcs_cms/target/dist/template-type-A-for-OF-for-stress-testing.csv",
080:                        "C:/projects/xcs_cms/target/dist/AXIS-claims-for-stress-testing.csv");
081:                System.out
082:                        .println("\n-----------------------------------------------------------------------------------\n");
083:                processTypeB_Data(
084:                        "A9208",
085:                        "LR",
086:                        15,
087:                        "AXIS",
088:                        "C:/projects/xcs_cms/target/dist/template-type-B-for-OF-for-stress-testing.csv",
089:                        "C:/projects/xcs_cms/target/dist/AXIS-claims-for-stress-testing.csv");
090:                System.out
091:                        .println("\n-----------------------------------------------------------------------------------\n");
092:                processTypeC_Data(
093:                        "A9208",
094:                        "LR",
095:                        15,
096:                        "AXIS",
097:                        "C:/projects/xcs_cms/target/dist/template-type-C-for-OF-for-stress-testing.csv",
098:                        "C:/projects/xcs_cms/target/dist/AXIS-claims-for-stress-testing.csv");
099:                System.out
100:                        .println("\n-----------------------------------------------------------------------------------\n");
101:
102:                String[] bureauNumbers = new String[] { "A9208", "A9315",
103:                        "A9703" };
104:                processTypeD_Data(
105:                        bureauNumbers,
106:                        "LR",
107:                        15,
108:                        "AXIS",
109:                        "C:/projects/xcs_cms/target/dist/template-type-D-for-OF-for-stress-testing.csv",
110:                        "C:/projects/xcs_cms/target/dist/AXIS-claims-for-stress-testing.csv");
111:            }
112:
113:            public void runForWellington() {
114:                insertHeader("C:/projects/xcs_cms/target/dist/WELLINGTON-claims-for-stress-testing.csv");
115:                processTypeA_Data(
116:                        "0051",
117:                        "SY",
118:                        15,
119:                        "WELL",
120:                        "C:/projects/xcs_cms/target/dist/template-type-A-for-OF-for-stress-testing.csv",
121:                        "C:/projects/xcs_cms/target/dist/WELLINGTON-claims-for-stress-testing.csv");
122:                System.out
123:                        .println("\n-----------------------------------------------------------------------------------\n");
124:                processTypeB_Data(
125:                        "0051",
126:                        "SY",
127:                        15,
128:                        "WELL",
129:                        "C:/projects/xcs_cms/target/dist/template-type-B-for-OF-for-stress-testing.csv",
130:                        "C:/projects/xcs_cms/target/dist/WELLINGTON-claims-for-stress-testing.csv");
131:                System.out
132:                        .println("\n-----------------------------------------------------------------------------------\n");
133:                processTypeC_Data(
134:                        "0051",
135:                        "SY",
136:                        15,
137:                        "WELL",
138:                        "C:/projects/xcs_cms/target/dist/template-type-C-for-OF-for-stress-testing.csv",
139:                        "C:/projects/xcs_cms/target/dist/WELLINGTON-claims-for-stress-testing.csv");
140:                System.out
141:                        .println("\n-----------------------------------------------------------------------------------\n");
142:
143:                String[] bureauNumbers = new String[] { "0051", "1095", "2020" };
144:                processTypeD_Data(
145:                        bureauNumbers,
146:                        "SY",
147:                        15,
148:                        "WELL",
149:                        "C:/projects/xcs_cms/target/dist/template-type-D-for-OF-for-stress-testing.csv",
150:                        "C:/projects/xcs_cms/target/dist/WELLINGTON-claims-for-stress-testing.csv");
151:            }
152:
153:            public void runForTMG() {
154:                insertHeader("C:/projects/xcs_cms/target/dist/TMG-claims-for-stress-testing.csv");
155:                processTypeA_Data(
156:                        "T8703",
157:                        "LR",
158:                        15,
159:                        "TMG",
160:                        "C:/projects/xcs_cms/target/dist/template-type-A-for-OF-for-stress-testing.csv",
161:                        "C:/projects/xcs_cms/target/dist/TMG-claims-for-stress-testing.csv");
162:                System.out
163:                        .println("\n-----------------------------------------------------------------------------------\n");
164:                processTypeB_Data(
165:                        "T8703",
166:                        "LR",
167:                        15,
168:                        "TMG",
169:                        "C:/projects/xcs_cms/target/dist/template-type-B-for-OF-for-stress-testing.csv",
170:                        "C:/projects/xcs_cms/target/dist/TMG-claims-for-stress-testing.csv");
171:                System.out
172:                        .println("\n-----------------------------------------------------------------------------------\n");
173:                processTypeC_Data(
174:                        "T8703",
175:                        "LR",
176:                        15,
177:                        "TMG",
178:                        "C:/projects/xcs_cms/target/dist/template-type-C-for-OF-for-stress-testing.csv",
179:                        "C:/projects/xcs_cms/target/dist/TMG-claims-for-stress-testing.csv");
180:                System.out
181:                        .println("\n-----------------------------------------------------------------------------------\n");
182:            }
183:
184:            public void runForCatlin() {
185:                insertHeader("C:/projects/xcs_cms/target/dist/CATLIN-claims-for-stress-testing.csv");
186:                processTypeA_Data(
187:                        "1003",
188:                        "SY",
189:                        15,
190:                        "CATLIN",
191:                        "C:/projects/xcs_cms/target/dist/template-type-A-for-OF-for-stress-testing.csv",
192:                        "C:/projects/xcs_cms/target/dist/CATLIN-claims-for-stress-testing.csv");
193:                System.out
194:                        .println("\n-----------------------------------------------------------------------------------\n");
195:                processTypeB_Data(
196:                        "2003",
197:                        "SY",
198:                        15,
199:                        "CATLIN",
200:                        "C:/projects/xcs_cms/target/dist/template-type-B-for-OF-for-stress-testing.csv",
201:                        "C:/projects/xcs_cms/target/dist/CATLIN-claims-for-stress-testing.csv");
202:                System.out
203:                        .println("\n-----------------------------------------------------------------------------------\n");
204:                processTypeC_Data(
205:                        "1003",
206:                        "SY",
207:                        15,
208:                        "CATLIN",
209:                        "C:/projects/xcs_cms/target/dist/template-type-C-for-OF-for-stress-testing.csv",
210:                        "C:/projects/xcs_cms/target/dist/CATLIN-claims-for-stress-testing.csv");
211:                System.out
212:                        .println("\n-----------------------------------------------------------------------------------\n");
213:
214:                String[] bureauNumbers = new String[] { "1003", "2003", "1003" };
215:                processTypeD_Data(
216:                        bureauNumbers,
217:                        "SY",
218:                        15,
219:                        "CATLIN",
220:                        "C:/projects/xcs_cms/target/dist/template-type-D-for-OF-for-stress-testing.csv",
221:                        "C:/projects/xcs_cms/target/dist/CATLIN-claims-for-stress-testing.csv");
222:            }
223:
224:            private void insertHeader(String outputFile) {
225:                try {
226:                    FileWriter fileWriter = new FileWriter(outputFile);
227:                    BufferedWriter writer = new BufferedWriter(fileWriter);
228:                    writer.write(FILE_HEADER + "\n");
229:                    writer.flush();
230:                    writer.close();
231:                } catch (IOException exc) {
232:                    System.out
233:                            .println("*** IOException ***" + exc.getMessage());
234:                }
235:            }
236:
237:            public void processTypeD_Data(String[] bureauNumbers,
238:                    String bureauId, int countOfClaimsGenerated,
239:                    String clientName, String inputFile, String outputFile) {
240:                try {
241:                    String CLIENT_NAME = clientName;
242:                    String BUREAU_ID = bureauId;
243:                    String BUREAU_NUMBER1 = bureauNumbers[0];
244:                    String BUREAU_NUMBER2 = bureauNumbers[1];
245:                    String BUREAU_NUMBER3 = bureauNumbers[2];
246:                    String OSND_NUMBER1 = "99999";
247:                    String OSND_NUMBER2 = "88888";
248:                    String OSND_NUMBER3 = "77777";
249:                    String OSND_DATE = "20060402";
250:
251:                    //Load the file
252:                    FileReader fileReader = new FileReader(inputFile);
253:                    BufferedReader reader = new BufferedReader(fileReader);
254:
255:                    FileWriter fileWriter = new FileWriter(outputFile, true);
256:                    BufferedWriter writer = new BufferedWriter(fileWriter);
257:
258:                    //Read data from file
259:                    String claimLine = reader.readLine();
260:
261:                    //Read transaction data from file
262:                    String[] txAndFinancialsLines = new String[3];
263:                    for (int i = 0; i < 3; i++) {
264:                        txAndFinancialsLines[i] = reader.readLine();
265:                    }
266:
267:                    //Read market line data from file
268:                    String[] marketLineLines = new String[3];
269:                    for (int i = 0; i < 3; i++) {
270:                        marketLineLines[i] = reader.readLine();
271:                    }
272:
273:                    //Loop and process all claims 
274:                    for (int claimCounter = 1; claimCounter < countOfClaimsGenerated; claimCounter++) {
275:                        //Loop 3 times for each claim so each claim has 3 transactions
276:                        for (int z = 1; z < 4; z++) {
277:                            //Replace all UCR tokens in line 1
278:                            String newClaimLine = claimLine.replaceAll("<UCR>",
279:                                    CLIENT_NAME + "_" + claimCounter + "D");
280:                            newClaimLine = newClaimLine.replaceAll("<Tx-Ref>",
281:                                    "TxRef_" + z + "_" + CLIENT_NAME + "_"
282:                                            + claimCounter + "D");
283:                            newClaimLine = newClaimLine.replaceAll(
284:                                    "<bureau-id>", BUREAU_ID);
285:                            newClaimLine = newClaimLine.replaceAll(
286:                                    "<sequence-number>", "00" + z);
287:
288:                            //Set the osnd number
289:                            String osndNumber = "";
290:                            if (claimCounter <= 5) {
291:                                osndNumber = OSND_NUMBER1;
292:                            } else if (claimCounter <= 10 && claimCounter > 5) {
293:                                osndNumber = OSND_NUMBER2;
294:                            } else if (claimCounter > 10) {
295:                                osndNumber = OSND_NUMBER3;
296:                            }
297:
298:                            newClaimLine = newClaimLine.replaceAll(
299:                                    "<osnd-number>", osndNumber);
300:                            newClaimLine = newClaimLine.replaceAll(
301:                                    "<osnd-date>", OSND_DATE);
302:
303:                            writer.write(newClaimLine);
304:                            writer.write("\n");
305:                            System.out.println(newClaimLine);
306:
307:                            //Record type 2 - Tx and financials
308:                            for (int txCounter = 1; txCounter < txAndFinancialsLines.length + 1; txCounter++) {
309:                                String txAndFinancialsLine = txAndFinancialsLines[txCounter - 1];
310:                                String newTxLine1 = txAndFinancialsLine
311:                                        .replaceAll("<UCR>", CLIENT_NAME + "_"
312:                                                + claimCounter + "D");
313:                                String newTxLine2 = newTxLine1.replaceAll(
314:                                        "<Tx-Ref>", "TxRef_" + z + "_"
315:                                                + CLIENT_NAME + "_"
316:                                                + claimCounter + "D");
317:                                String newTxLine3 = newTxLine2.replaceAll(
318:                                        "<bureau-id>", BUREAU_ID);
319:                                newTxLine3 = newTxLine3.replaceAll(
320:                                        "<sequence-number>", "00" + z);
321:
322:                                writer.write(newTxLine3);
323:                                writer.write("\n");
324:                                System.out.println(newTxLine3);
325:                            }
326:
327:                            //Record type 3 - Tx and financials
328:                            for (int marketLineCounter = 1; marketLineCounter < marketLineLines.length + 1; marketLineCounter++) {
329:                                String marketLineLine = marketLineLines[marketLineCounter - 1];
330:                                String newMarketLineLine1 = marketLineLine
331:                                        .replaceAll("<UCR>", CLIENT_NAME + "_"
332:                                                + claimCounter + "D");
333:                                newMarketLineLine1 = newMarketLineLine1
334:                                        .replaceAll("<Tx-Ref>", "TxRef_" + z
335:                                                + "_" + CLIENT_NAME + "_"
336:                                                + claimCounter + "D");
337:                                newMarketLineLine1 = newMarketLineLine1
338:                                        .replaceAll("<bureau-id>", BUREAU_ID);
339:                                newMarketLineLine1 = newMarketLineLine1
340:                                        .replaceAll("<sequence-number>", "00"
341:                                                + z);
342:
343:                                String bureauNumber = "";
344:                                switch (marketLineCounter) {
345:                                case 1:
346:                                    bureauNumber = BUREAU_NUMBER1;
347:                                    break;
348:                                case 2:
349:                                    bureauNumber = BUREAU_NUMBER2;
350:                                    break;
351:                                case 3:
352:                                    bureauNumber = BUREAU_NUMBER3;
353:                                    break;
354:                                default:
355:                                    System.out
356:                                            .println("*** Invalid option ***");
357:                                    break;
358:                                }
359:
360:                                newMarketLineLine1 = newMarketLineLine1
361:                                        .replaceAll("<bureau-number>",
362:                                                bureauNumber);
363:                                writer.write(newMarketLineLine1);
364:                                writer.write("\n");
365:                                System.out.println(newMarketLineLine1);
366:                            }
367:                        }
368:                    }
369:                    reader.close();
370:                    writer.flush();
371:                    writer.close();
372:                } catch (IOException exc) {
373:                    System.out
374:                            .println("*** IOException ***" + exc.getMessage());
375:                }
376:            }
377:
378:            public void processTypeC_Data(String bureauNumber, String bureauId,
379:                    int countOfClaimsGenerated, String clientName,
380:                    String inputFile, String outputFile) {
381:                try {
382:                    String CLIENT_NAME = clientName;
383:                    String BUREAU_ID = bureauId;
384:                    String BUREAU_NUMBER = bureauNumber;
385:                    String OSND_NUMBER1 = "99999";
386:                    String OSND_NUMBER2 = "88888";
387:                    String OSND_NUMBER3 = "77777";
388:                    String OSND_DATE = "20060403";
389:
390:                    //Load the file
391:                    FileReader fileReader = new FileReader(inputFile);
392:                    BufferedReader reader = new BufferedReader(fileReader);
393:
394:                    FileWriter fileWriter = new FileWriter(outputFile, true);
395:                    BufferedWriter writer = new BufferedWriter(fileWriter);
396:
397:                    //Read data from file
398:                    String claimLine = reader.readLine();
399:
400:                    //Read transaction data from file
401:                    String[] txAndFinancialsLines = new String[3];
402:                    for (int i = 0; i < 3; i++) {
403:                        txAndFinancialsLines[i] = reader.readLine();
404:                    }
405:
406:                    //Read market line data from file
407:                    String[] marketLineLines = new String[1];
408:                    for (int i = 0; i < 1; i++) {
409:                        marketLineLines[i] = reader.readLine();
410:                    }
411:
412:                    //Loop and process all claims 
413:                    for (int claimCounter = 1; claimCounter < countOfClaimsGenerated; claimCounter++) {
414:                        //Loop 3 times for each claim so each claim has 3 transactions
415:                        for (int z = 1; z < 4; z++) {
416:                            //Replace all UCR tokens in line 1
417:                            String newClaimLine = claimLine.replaceAll("<UCR>",
418:                                    CLIENT_NAME + "_" + claimCounter + "C");
419:                            newClaimLine = newClaimLine.replaceAll("<Tx-Ref>",
420:                                    "TxRef_" + z + "_" + CLIENT_NAME + "_"
421:                                            + claimCounter + "C");
422:                            newClaimLine = newClaimLine.replaceAll(
423:                                    "<bureau-id>", BUREAU_ID);
424:                            newClaimLine = newClaimLine.replaceAll(
425:                                    "<sequence-number>", "00" + z);
426:
427:                            //Set the osnd number
428:                            String osndNumber = "";
429:                            if (claimCounter <= 5) {
430:                                osndNumber = OSND_NUMBER1;
431:                            } else if (claimCounter <= 10 && claimCounter > 5) {
432:                                osndNumber = OSND_NUMBER2;
433:                            } else if (claimCounter > 10) {
434:                                osndNumber = OSND_NUMBER3;
435:                            }
436:
437:                            newClaimLine = newClaimLine.replaceAll(
438:                                    "<osnd-number>", osndNumber);
439:                            newClaimLine = newClaimLine.replaceAll(
440:                                    "<osnd-date>", OSND_DATE);
441:
442:                            writer.write(newClaimLine);
443:                            writer.write("\n");
444:                            System.out.println(newClaimLine);
445:
446:                            //Record type 2 - Tx and financials
447:                            for (int txCounter = 1; txCounter < txAndFinancialsLines.length + 1; txCounter++) {
448:                                String txAndFinancialsLine = txAndFinancialsLines[txCounter - 1];
449:                                String newTxLine1 = txAndFinancialsLine
450:                                        .replaceAll("<UCR>", CLIENT_NAME + "_"
451:                                                + claimCounter + "C");
452:                                String newTxLine2 = newTxLine1.replaceAll(
453:                                        "<Tx-Ref>", "TxRef_" + z + "_"
454:                                                + CLIENT_NAME + "_"
455:                                                + claimCounter + "C");
456:                                String newTxLine3 = newTxLine2.replaceAll(
457:                                        "<bureau-id>", BUREAU_ID);
458:                                newTxLine3 = newTxLine3.replaceAll(
459:                                        "<sequence-number>", "00" + z);
460:                                writer.write(newTxLine3);
461:                                writer.write("\n");
462:                                System.out.println(newTxLine3);
463:                            }
464:
465:                            //Record type 3 - Tx and financials
466:                            for (int marketLineCounter = 1; marketLineCounter < marketLineLines.length + 1; marketLineCounter++) {
467:                                String marketLineLine = marketLineLines[marketLineCounter - 1];
468:                                String newMarketLineLine1 = marketLineLine
469:                                        .replaceAll("<UCR>", CLIENT_NAME + "_"
470:                                                + claimCounter + "C");
471:                                newMarketLineLine1 = newMarketLineLine1
472:                                        .replaceAll("<Tx-Ref>", "TxRef_" + z
473:                                                + "_" + CLIENT_NAME + "_"
474:                                                + claimCounter + "C");
475:                                newMarketLineLine1 = newMarketLineLine1
476:                                        .replaceAll("<bureau-id>", BUREAU_ID);
477:                                newMarketLineLine1 = newMarketLineLine1
478:                                        .replaceAll("<bureau-number>",
479:                                                BUREAU_NUMBER);
480:                                newMarketLineLine1 = newMarketLineLine1
481:                                        .replaceAll("<sequence-number>", "00"
482:                                                + z);
483:
484:                                writer.write(newMarketLineLine1);
485:                                writer.write("\n");
486:                                System.out.println(newMarketLineLine1);
487:                            }
488:                        }
489:                    }
490:                    reader.close();
491:                    writer.flush();
492:                    writer.close();
493:                } catch (IOException exc) {
494:                    System.out
495:                            .println("*** IOException ***" + exc.getMessage());
496:                }
497:            }
498:
499:            public void processTypeB_Data(String bureauNumber, String bureauId,
500:                    int countOfClaimsGenerated, String clientName,
501:                    String inputFile, String outputFile) {
502:                try {
503:                    String CLIENT_NAME = clientName;
504:                    String BUREAU_ID = bureauId;
505:                    String BUREAU_NUMBER = bureauNumber;
506:                    String OSND_NUMBER1 = "99999";
507:                    String OSND_NUMBER2 = "88888";
508:                    String OSND_NUMBER3 = "77777";
509:                    String OSND_DATE = "20060404";
510:
511:                    //Load the file
512:                    FileReader fileReader = new FileReader(inputFile);
513:                    BufferedReader reader = new BufferedReader(fileReader);
514:
515:                    FileWriter fileWriter = new FileWriter(outputFile, true);
516:                    BufferedWriter writer = new BufferedWriter(fileWriter);
517:
518:                    //Read data from file
519:                    String claimLine = reader.readLine();
520:
521:                    //Read transaction data from file
522:                    String[] txAndFinancialsLines = new String[3];
523:                    for (int i = 0; i < 3; i++) {
524:                        txAndFinancialsLines[i] = reader.readLine();
525:                    }
526:
527:                    //Read market line data from file
528:                    String[] marketLineLines = new String[1];
529:                    for (int i = 0; i < 1; i++) {
530:                        marketLineLines[i] = reader.readLine();
531:                    }
532:
533:                    //Loop and process all claims 
534:                    for (int claimCounter = 1; claimCounter < countOfClaimsGenerated; claimCounter++) {
535:                        //Replace all UCR tokens in line 1
536:                        String newClaimLine = claimLine.replaceAll("<UCR>",
537:                                CLIENT_NAME + "_" + claimCounter + "B");
538:                        newClaimLine = newClaimLine.replaceAll("<Tx-Ref>",
539:                                "TxRef" + "_" + CLIENT_NAME + "_"
540:                                        + claimCounter + "B");
541:                        newClaimLine = newClaimLine.replaceAll("<bureau-id>",
542:                                BUREAU_ID);
543:
544:                        //Set the osnd number
545:                        String osndNumber = "";
546:                        if (claimCounter <= 5) {
547:                            osndNumber = OSND_NUMBER1;
548:                        } else if (claimCounter <= 10 && claimCounter > 5) {
549:                            osndNumber = OSND_NUMBER2;
550:                        } else if (claimCounter > 10) {
551:                            osndNumber = OSND_NUMBER3;
552:                        }
553:
554:                        newClaimLine = newClaimLine.replaceAll("<osnd-number>",
555:                                osndNumber);
556:                        newClaimLine = newClaimLine.replaceAll("<osnd-date>",
557:                                OSND_DATE);
558:
559:                        writer.write(newClaimLine);
560:                        writer.write("\n");
561:                        System.out.println(newClaimLine);
562:
563:                        //Record type 2 - Tx and financials
564:                        for (int txCounter = 1; txCounter < txAndFinancialsLines.length + 1; txCounter++) {
565:                            String txAndFinancialsLine = txAndFinancialsLines[txCounter - 1];
566:                            String newTxLine1 = txAndFinancialsLine.replaceAll(
567:                                    "<UCR>", CLIENT_NAME + "_" + claimCounter
568:                                            + "B");
569:                            String newTxLine2 = newTxLine1.replaceAll(
570:                                    "<Tx-Ref>", "TxRef" + "_" + CLIENT_NAME
571:                                            + "_" + claimCounter + "B");
572:                            String newTxLine3 = newTxLine2.replaceAll(
573:                                    "<bureau-id>", BUREAU_ID);
574:                            writer.write(newTxLine3);
575:                            writer.write("\n");
576:                            System.out.println(newTxLine3);
577:                        }
578:
579:                        //Record type 3 - Tx and financials
580:                        for (int marketLineCounter = 1; marketLineCounter < marketLineLines.length + 1; marketLineCounter++) {
581:                            String marketLineLine = marketLineLines[marketLineCounter - 1];
582:                            String newMarketLineLine1 = marketLineLine
583:                                    .replaceAll("<UCR>", CLIENT_NAME + "_"
584:                                            + claimCounter + "B");
585:                            newMarketLineLine1 = newMarketLineLine1.replaceAll(
586:                                    "<Tx-Ref>", "TxRef" + "_" + CLIENT_NAME
587:                                            + "_" + claimCounter + "B");
588:                            newMarketLineLine1 = newMarketLineLine1.replaceAll(
589:                                    "<bureau-id>", BUREAU_ID);
590:                            newMarketLineLine1 = newMarketLineLine1.replaceAll(
591:                                    "<bureau-number>", BUREAU_NUMBER);
592:                            writer.write(newMarketLineLine1);
593:                            writer.write("\n");
594:                            System.out.println(newMarketLineLine1);
595:                        }
596:                    }
597:                    reader.close();
598:                    writer.flush();
599:                    writer.close();
600:                } catch (IOException exc) {
601:                    System.out
602:                            .println("*** IOException ***" + exc.getMessage());
603:                }
604:            }
605:
606:            public void processTypeA_Data(String bureauNumber, String bureauId,
607:                    int countOfClaimsGenerated, String clientName,
608:                    String inputFile, String outputFile) {
609:                try {
610:                    String CLIENT_NAME = clientName;
611:                    String BUREAU_ID = bureauId;
612:                    String BUREAU_NUMBER = bureauNumber;
613:                    String OSND_NUMBER1 = "99999";
614:                    String OSND_NUMBER2 = "88888";
615:                    String OSND_NUMBER3 = "77777";
616:                    String OSND_DATE = "20060405";
617:
618:                    //Load the file
619:                    FileReader fileReader = new FileReader(inputFile);
620:                    BufferedReader reader = new BufferedReader(fileReader);
621:
622:                    FileWriter fileWriter = new FileWriter(outputFile, true);
623:                    BufferedWriter writer = new BufferedWriter(fileWriter);
624:
625:                    String claimLine = reader.readLine();
626:                    String txAndFinancialsLine = reader.readLine();
627:                    String marketLineLine = reader.readLine();
628:
629:                    //Loop and process all claims 
630:                    for (int claimCounter = 1; claimCounter < countOfClaimsGenerated; claimCounter++) {
631:                        //Replace all tokens in line 1
632:                        String newClaimLine = claimLine.replaceAll("<UCR>",
633:                                CLIENT_NAME + "_" + claimCounter + "A");
634:                        newClaimLine = newClaimLine.replaceAll("<Tx-Ref>",
635:                                "TxRef" + "_" + CLIENT_NAME + "_"
636:                                        + claimCounter + "A");
637:                        newClaimLine = newClaimLine.replaceAll("<bureau-id>",
638:                                bureauId);
639:
640:                        //Set the osnd number
641:                        String osndNumber = "";
642:                        if (claimCounter <= 5) {
643:                            osndNumber = OSND_NUMBER1;
644:                        } else if (claimCounter <= 10 && claimCounter > 5) {
645:                            osndNumber = OSND_NUMBER2;
646:                        } else if (claimCounter > 10) {
647:                            osndNumber = OSND_NUMBER3;
648:                        }
649:
650:                        newClaimLine = newClaimLine.replaceAll("<osnd-number>",
651:                                osndNumber);
652:                        newClaimLine = newClaimLine.replaceAll("<osnd-date>",
653:                                OSND_DATE);
654:
655:                        writer.write(newClaimLine);
656:                        writer.write("\n");
657:                        System.out.println(newClaimLine);
658:
659:                        //Line 2
660:                        String newTxLine1 = txAndFinancialsLine
661:                                .replaceAll("<UCR>", CLIENT_NAME + "_"
662:                                        + claimCounter + "A");
663:                        String newTxLine2 = newTxLine1.replaceAll("<Tx-Ref>",
664:                                "TxRef_" + CLIENT_NAME + "_" + claimCounter
665:                                        + "A");
666:                        String newTxLine3 = newTxLine2.replaceAll(
667:                                "<bureau-id>", bureauId);
668:                        writer.write(newTxLine3);
669:                        writer.write("\n");
670:                        System.out.println(newTxLine3);
671:
672:                        //Line 3
673:                        String newMarketLineLine1 = marketLineLine.replaceAll(
674:                                "<UCR>", clientName + "_" + claimCounter + "A");
675:                        String newMarketLineLine2 = newMarketLineLine1
676:                                .replaceAll("<Tx-Ref>", "TxRef" + "_"
677:                                        + CLIENT_NAME + "_" + claimCounter
678:                                        + "A");
679:                        String newMarketLineLine3 = newMarketLineLine2
680:                                .replaceAll("<bureau-id>", bureauId);
681:                        String newMarketLineLine4 = newMarketLineLine3
682:                                .replaceAll("<bureau-number>", bureauNumber);
683:                        writer.write(newMarketLineLine4);
684:                        writer.write("\n");
685:                        System.out.println(newMarketLineLine4);
686:                    }
687:                    reader.close();
688:                    writer.flush();
689:                    writer.close();
690:                } catch (IOException exc) {
691:                    System.out
692:                            .println("*** IOException ***" + exc.getMessage());
693:                }
694:            }
695:        }
www.java2java.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.