001: /*
002: * Copyright 2007 Google Inc.
003: *
004: * Licensed under the Apache License, Version 2.0 (the "License"); you may not
005: * use this file except in compliance with the License. You may obtain a copy of
006: * the License at
007: *
008: * http://www.apache.org/licenses/LICENSE-2.0
009: *
010: * Unless required by applicable law or agreed to in writing, software
011: * distributed under the License is distributed on an "AS IS" BASIS, WITHOUT
012: * WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the
013: * License for the specific language governing permissions and limitations under
014: * the License.
015: */
016: package com.google.gwt.sample.mail.client;
017:
018: import java.util.ArrayList;
019:
020: /**
021: * A simple client-side generator of fake email messages.
022: */
023: public class MailItems {
024:
025: private static final int NUM_ITEMS = 37;
026: private static final int FRAGMENTS_PER_EMAIL = 10;
027:
028: private static final String[] senders = new String[] {
029: "markboland05", "Hollie Voss", "boticario",
030: "Emerson Milton", "Healy Colette", "Brigitte Cobb",
031: "Elba Lockhart", "Claudio Engle", "Dena Pacheco",
032: "Brasil s.p", "Parker", "derbvktqsr", "qetlyxxogg",
033: "antenas.sul", "Christina Blake", "Gail Horton",
034: "Orville Daniel", "PostMaster", "Rae Childers",
035: "Buster misjenou", "user31065", "ftsgeolbx", "aqlovikigd",
036: "user18411", "Mildred Starnes", "Candice Carson",
037: "Louise Kelchner", "Emilio Hutchinson", "Geneva Underwood",
038: "Residence Oper?", "fpnztbwag", "tiger", "Heriberto Rush",
039: "bulrush Bouchard", "Abigail Louis", "Chad Andrews",
040: "bjjycpaa", "Terry English", "Bell Snedden", "huang",
041: "hhh", "(unknown sender)", "Kent", "Dirk Newman",
042: "Equipe Virtual Cards", "wishesundmore", "Benito Meeks" };
043:
044: private static final String[] emails = new String[] {
045: "mark@example.com", "hollie@example.com",
046: "boticario@example.com", "emerson@example.com",
047: "healy@example.com", "brigitte@example.com",
048: "elba@example.com", "claudio@example.com",
049: "dena@example.com", "brasilsp@example.com",
050: "parker@example.com", "derbvktqsr@example.com",
051: "qetlyxxogg@example.com", "antenas_sul@example.com",
052: "cblake@example.com", "gailh@example.com",
053: "orville@example.com", "post_master@example.com",
054: "rchilders@example.com", "buster@example.com",
055: "user31065@example.com", "ftsgeolbx@example.com",
056: "aqlovikigd@example.com", "user18411@example.com",
057: "mildred@example.com", "candice@example.com",
058: "louise_kelchner@example.com", "emilio@example.com",
059: "geneva@example.com", "residence_oper@example.com",
060: "fpnztbwag@example.com", "tiger@example.com",
061: "heriberto@example.com", "bulrush@example.com",
062: "abigail_louis@example.com", "chada@example.com",
063: "bjjycpaa@example.com", "terry@example.com",
064: "bell@example.com", "huang@example.com", "hhh@example.com",
065: "kent@example.com", "newman@example.com",
066: "equipe_virtual@example.com", "wishesundmore@example.com",
067: "benito@example.com" };
068:
069: private static final String[] subjects = new String[] {
070: "URGENT -[Mon, 24 Apr 2006 02:17:27 +0000]",
071: "URGENT TRANSACTION -[Sun, 23 Apr 2006 13:10:03 +0000]",
072: "fw: Here it comes",
073: "voce ganho um vale presente Boticario",
074: "Read this ASAP",
075: "Hot Stock Talk",
076: "New Breed of Equity Trader",
077: "FWD: TopWeeks the wire special pr news release",
078: "[fwd] Read this ASAP",
079: "Renda Extra R$1.000,00-R$2.000,00/m?s",
080: "re: Make sure your special pr news released",
081: "Forbidden Knowledge Conference",
082: "decodificadores os menores pre?os",
083: "re: Our Pick",
084: "RE: The hottest pick Watcher",
085: "RE: St0kkMarrkett Picks Trade watch special pr news release",
086: "St0kkMarrkett Picks Watch special pr news release news",
087: "You are a Winner oskoxmshco",
088: "Encrypted E-mail System (VIRUS REMOVED)",
089: "Fw: Malcolm",
090: "Secure Message System (VIRUS REMOVED)",
091: "fwd: St0kkMarrkett Picks Watch special pr news releaser",
092: "FWD: Financial Market Traderr special pr news release",
093: "? s? uma dica r?pida !!!!! leia !!!",
094: "re: You have to heard this",
095: "fwd: Watcher TopNews",
096: "VACANZE alle Mauritius",
097: "funny",
098: "re: You need to review this",
099: "[re:] Our Pick",
100: "RE: Before the be11 special pr news release",
101: "[re:] Market TradePicks Trade watch news",
102: "No prescription needed",
103: "Seu novo site",
104: "[fwd] Financial Market Trader Picker",
105: "FWD: Top Financial Market Specialists Trader interest increases",
106: "Os cart?es mais animados da web!!",
107: "We will sale 4 you cebtdbwtcv",
108: "RE: Best Top Financial Market Specialists Trader Picks" };
109:
110: private static final String[] fragments = new String[] {
111: "Dear Friend,<br><br>I am Mr. Mark Boland the Bank Manager of ABN AMRO "
112: + "BANK 101 Moorgate, London, EC2M 6SB.<br><br>",
113: "I have an urgent and very confidential business proposition for you. On "
114: + "July 20, 2001; Mr. Zemenu Gente, a National of France, who used to be a "
115: + "private contractor with the Shell Petroleum Development Company in Saudi "
116: + "Arabia. Mr. Zemenu Gente Made a Numbered time (Fixed deposit) for 36 "
117: + "calendar months, valued at GBP?30, 000,000.00 (Thirty Million Pounds "
118: + "only) in my Branch.",
119: "I have all necessary legal documents that can be used to back up any "
120: + "claim we may make. All I require is your honest Co-operation, "
121: + "Confidentiality and A trust to enable us sees this transaction through. "
122: + "I guarantee you that this will be executed under a legitimate "
123: + "arrangement that will protect you from any breach of the law. Please "
124: + "get in touch with me urgently by E-mail and "
125: + "Provide me with the following;<br>",
126: "The OIL sector is going crazy. This is our weekly gift to you!<br>"
127: + "<br>"
128: + "Get KKPT First Thing, This Is Going To Run!<br>"
129: + "<br>"
130: + "Check out Latest NEWS!<br>"
131: + "<br>"
132: + "KOKO PETROLEUM (KKPT) - This is our #1 pick for next week!<br>"
133: + "Our last pick gained $2.16 in 4 days of trading.<br>",
134: "LAS VEGAS, NEVADA--(MARKET WIRE)--Apr 6, 2006 -- KOKO Petroleum, Inc. "
135: + "(Other OTC:KKPT.PK - News) -<br>KOKO Petroleum, Inc. announced today that "
136: + "its operator for the Corsicana Field, JMT Resources, Ltd. (\"JMT\") "
137: + "will commence a re-work program on its Pecan Gap wells in the next week. "
138: + "The re-work program will consist of drilling six lateral bore production "
139: + "strings from the existing well bore. This process, known as Radial Jet "
140: + "Enhancement, will utilize high pressure fluids to drill the lateral well "
141: + "bores, which will extend out approximately 350\' each.",
142: "JMT has contracted with Well Enhancement Services, LLC (www."
143: + "wellenhancement.com) to perform the rework on its Pierce nos. 14 and 14a. "
144: + "A small sand frac will follow the drilling of the lateral well bores in "
145: + "order to enhance permeability and create larger access to the Pecan Gap "
146: + "reservoir. Total cost of the re-work per well is estimated to be "
147: + "approximately $50,000 USD.",
148: "Parab?ns!<br>Voc? Ganhou Um Vale Presente da Botic?rio no valor de "
149: + "R$50,00<br>Voc? foi contemplado na Promo??o Respeite Minha Natureza - "
150: + "Pulseira Social.<br>Algu?m pode t?-lo inscrito na promo??o! (Amigos(as), "
151: + "Namorado(a) etc.).<br>Para retirar o seu pr?mio em uma das nossas Lojas, "
152: + "fa?a o download do Vale-Presente abaixo.<br>Ap?s o download, com o "
153: + "arquivo previamente salvo, imprima uma folha e salve a c?pia em seu "
154: + "computador para evitar transtornos decorrentes da perda do mesmo. "
155: + "Lembramos que o Vale-Presente ? ?nico e intransfer?vel.",
156: "Large Marketing Campaign running this weekend!<br>"
157: + "<br>"
158: + "Should you get in today before it explodes?<br>"
159: + "<br>" + "This Will Fly Starting Monday!",
160: "PREMIER INFORMATION (PIFR)<br>"
161: + "A U.S. based company offers specialized information management "
162: + "serices to both the Insurance and Healthcare Industries. The services "
163: + "we provide are specific to each industry and designed for quick "
164: + "response and maximum security.<br>"
165: + "<br>"
166: + "STK- PIFR<br>"
167: + "Current Price: .20<br>"
168: + "This one went to $2.80 during the last marketing Campaign!",
169: "These partnerships specifically allow Premier to obtain personal health "
170: + "information, as governed by the Health In-surancee Portability and "
171: + "Accountability Act of 1996 (HIPAA), and other applicable state laws and "
172: + "regulations.<br><br>"
173: + "Global HealthCare Market Undergoing Digital Conversion",
174: ">> Componentes e decodificadores; confira aqui;<br>"
175: + " http://br.geocities.com/listajohn/index.htm<br>",
176: "THE GOVERNING AWARD<br>"
177: + "NETHERLANDS HEAD OFFICE<br>"
178: + "AC 76892 HAUITSOP<br>"
179: + "AMSTERDAM, THE NETHERLANDS.<br>"
180: + "FROM: THE DESK OF THE PROMOTIONS MANAGER.<br>"
181: + "INTERNATIONAL PROMOTIONS / PRIZE AWARD DEPARTMENT<br>"
182: + "REF NUMBER: 14235/089.<br>"
183: + "BATCH NUMBER: 304/64780/IFY.<br>"
184: + "RE/AWARD NOTIFICATION<br>",
185: "We are pleased to inform you of the announcement today 13th of April "
186: + "2006, you among TWO LUCKY WINNERS WON the GOVERNING AWARD draw held on "
187: + "the 28th of March 2006. The THREE Winning Addresses were randomly "
188: + "selected from a batch of 10,000,000 international email addresses. "
189: + "Your email address emerged alongside TWO others as a category B winner "
190: + "in this year\'s Annual GOVERNING AWARD Draw.<br>",
191: ">> obrigado por me dar esta pequena aten??o !!!<br>"
192: + "CASO GOSTE DE ASSISTIR TV , MAS A SUA ANTENA S? PEGA AQUELES CANAIS "
193: + "LOCAIS OU O SEU SISTEMA PAGO ? MUITO CARO , SAIBA QUE TENHO CART?ES "
194: + "DE ACESSO PARA SKY DIRECTV , E DECODERS PARA NET TVA E TECSAT , "
195: + "TUDO GRATIS , SEM ASSINTURA , SEM MENSALIDADE, VC PAGA UMA VEZ S? E "
196: + "ASSISTE A MUITOS CANAIS , FILMES , JOGOS , PORNOS , DESENHOS , "
197: + "DOCUMENT?RIOS ,SHOWS , ETC,<br><br>"
198: + "CART?O SKY E DIRECTV TOTALMENTE HACKEADOS 350,00<br>"
199: + "DECODERS NET TVA DESBLOQUEADOS 390,00<br>"
200: + "KITS COMPLETOS SKY OU DTV ANTENA DECODER E CART?O 650,00<br>"
201: + "TECSAT FREE 450,00<br>"
202: + "TENHO TB ACESS?RIOS , CABOS, LNB .<br>",
203: "********************************************************************<br>"
204: + " Original filename: mail.zip<br>"
205: + " Virus discovered: JS.Feebs.AC<br>"
206: + "********************************************************************<br>"
207: + " A file that was attached to this email contained a virus.<br>"
208: + " It is very likely that the original message was generated<br>"
209: + " by the virus and not a person - treat this message as you would<br>"
210: + " any other junk mail (spam).<br>"
211: + " For more information on why you received this message please visit:<br>",
212: "Put a few letters after your name. Let us show you how you can do it in "
213: + "just a few days.<br><br>"
214: + "http://thewrongchoiceforyou.info<br><br>"
215: + "kill future mailing by pressing this : see main website",
216: "We possess scores of pharmaceutical products handy<br>"
217: + "All med\'s are made in U.S. laboratories<br>"
218: + "For your wellbeing! Very rapid, protected and secure<br>"
219: + "Ordering, No script required. We have the pain aid you require<br>",
220: "\"Oh, don\'t speak to me of Austria. Perhaps I don\'t understand things, "
221: + "but Austria never has wished, and does not wish, for war. She is "
222: + "betraying us! Russia alone must save Europe. Our gracious sovereign "
223: + "recognizes his high vocation and will be true to it. That is the one "
224: + "thing I have faith in! Our good and wonderful sovereign has to perform "
225: + "the noblest role on earth, and he is so virtuous and noble that God "
226: + "will not forsake him. He will fulfill his vocation and crush the hydra "
227: + "of revolution, which has become more terrible than ever in the person of "
228: + "this murderer and villain! We alone must avenge the blood of the "
229: + "just one.... Whom, I ask you, can we rely on?... England with "
230: + "her commercial spirit will not and cannot understand the Emperor "
231: + "Alexander\'s loftiness of soul. She has refused to evacuate Malta. "
232: + "She wanted to find, and still seeks, some secret motive in our "
233: + "actions. What answer did Novosiltsev get? None. The English have not "
234: + "understood and cannot understand the self-ab!<br>negation of our "
235: + "Emperor who wants nothing for himself, but only desires the good "
236: + "of mankind. And what have they promised? Nothing! And what little "
237: + "they have promised they will not perform! Prussia has always "
238: + "declared that Buonaparte is invincible, and that all Europe is "
239: + "powerless before him.... And I don\'t believe a word that Hardenburg "
240: + "says, or Haugwitz either. This famous Prussian neutrality is just a "
241: + "trap. I have faith only in God and the lofty destiny of our adored "
242: + "monarch. He will save Europe!\"<br>\"Those were extremes, no doubt, "
243: + "but they are not what is most important. What is important are the "
244: + "rights of man, emancipation from prejudices, and equality of "
245: + "citizenship, and all these ideas Napoleon has retained in full "
246: + "force.\"" };
247:
248: private static int senderIdx = 0, emailIdx = 0, subjectIdx = 0,
249: fragmentIdx = 0;
250: private static ArrayList<MailItem> items = new ArrayList<MailItem>();
251:
252: static {
253: for (int i = 0; i < NUM_ITEMS; ++i) {
254: items.add(createFakeMail());
255: }
256: }
257:
258: public static MailItem getMailItem(int index) {
259: if (index >= items.size()) {
260: return null;
261: }
262: return items.get(index);
263: }
264:
265: public static int getMailItemCount() {
266: return items.size();
267: }
268:
269: private static MailItem createFakeMail() {
270: String sender = senders[senderIdx++];
271: if (senderIdx == senders.length) {
272: senderIdx = 0;
273: }
274:
275: String email = emails[emailIdx++];
276: if (emailIdx == emails.length) {
277: emailIdx = 0;
278: }
279:
280: String subject = subjects[subjectIdx++];
281: if (subjectIdx == subjects.length) {
282: subjectIdx = 0;
283: }
284:
285: String body = "";
286: for (int i = 0; i < FRAGMENTS_PER_EMAIL; ++i) {
287: body += fragments[fragmentIdx++];
288: if (fragmentIdx == fragments.length) {
289: fragmentIdx = 0;
290: }
291: }
292:
293: return new MailItem(sender, email, subject, body);
294: }
295: }
|