| Line 1... |
Line 1... |
| 1 |
package in.shop2020.util;
|
1 |
package in.shop2020.util;
|
| 2 |
import java.io.File;
|
- |
|
| 3 |
import java.io.IOException;
|
- |
|
| 4 |
import java.util.ArrayList;
|
- |
|
| 5 |
import java.util.Calendar;
|
- |
|
| 6 |
import java.util.Date;
|
- |
|
| 7 |
import java.util.HashMap;
|
- |
|
| 8 |
import java.util.LinkedHashMap;
|
- |
|
| 9 |
import java.util.List;
|
- |
|
| 10 |
import java.util.Map;
|
- |
|
| 11 |
|
- |
|
| 12 |
import in.shop2020.metamodel.core.Entity;
|
2 |
import in.shop2020.metamodel.core.Entity;
|
| 13 |
import in.shop2020.metamodel.core.EntityState;
|
3 |
import in.shop2020.metamodel.core.EntityState;
|
| 14 |
import in.shop2020.metamodel.core.EntityStatus;
|
4 |
import in.shop2020.metamodel.core.EntityStatus;
|
| 15 |
import in.shop2020.metamodel.util.CreationUtils;
|
5 |
import in.shop2020.metamodel.util.CreationUtils;
|
| 16 |
import in.shop2020.metamodel.util.ExpandedEntity;
|
6 |
import in.shop2020.metamodel.util.ExpandedEntity;
|
| 17 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
7 |
import in.shop2020.model.v1.catalog.InventoryService.Client;
|
| 18 |
import in.shop2020.model.v1.catalog.Item;
|
8 |
import in.shop2020.model.v1.catalog.Item;
|
| 19 |
import in.shop2020.model.v1.catalog.status;
|
9 |
import in.shop2020.model.v1.catalog.status;
|
| 20 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
10 |
import in.shop2020.thrift.clients.CatalogServiceClient;
|
| - |
|
11 |
import in.shop2020.ui.util.CatalogUploderToGAE;
|
| 21 |
import in.shop2020.ui.util.ComparisonStatsFetcher;
|
12 |
import in.shop2020.ui.util.ComparisonStatsFetcher;
|
| 22 |
import in.shop2020.ui.util.PriceInsertor;
|
- |
|
| 23 |
import in.shop2020.ui.util.NewVUI;
|
13 |
import in.shop2020.ui.util.NewVUI;
|
| - |
|
14 |
import in.shop2020.ui.util.PriceInsertor;
|
| 24 |
import in.shop2020.ui.util.SpecialPageJSONConvertor;
|
15 |
import in.shop2020.ui.util.SpecialPageJSONConvertor;
|
| 25 |
|
16 |
|
| - |
|
17 |
import java.io.File;
|
| - |
|
18 |
import java.io.IOException;
|
| - |
|
19 |
import java.util.ArrayList;
|
| - |
|
20 |
import java.util.Calendar;
|
| - |
|
21 |
import java.util.Date;
|
| - |
|
22 |
import java.util.HashMap;
|
| - |
|
23 |
import java.util.LinkedHashMap;
|
| - |
|
24 |
import java.util.List;
|
| - |
|
25 |
import java.util.Map;
|
| - |
|
26 |
|
| - |
|
27 |
import org.apache.commons.cli.CommandLine;
|
| - |
|
28 |
import org.apache.commons.cli.CommandLineParser;
|
| - |
|
29 |
import org.apache.commons.cli.HelpFormatter;
|
| 26 |
import org.apache.commons.cli.*;
|
30 |
import org.apache.commons.cli.Options;
|
| - |
|
31 |
import org.apache.commons.cli.ParseException;
|
| - |
|
32 |
import org.apache.commons.cli.PosixParser;
|
| 27 |
|
33 |
|
| 28 |
|
34 |
|
| 29 |
|
35 |
|
| 30 |
public class ContentGenerationUtility {
|
36 |
public class ContentGenerationUtility {
|
| 31 |
private static Options options = null; // Command line options
|
37 |
private static Options options = null; // Command line options
|
| Line 271... |
Line 277... |
| 271 |
Map<Long, Map<Long, Double>> slideScoresByEntity = cmp.getSlideScores();
|
277 |
Map<Long, Map<Long, Double>> slideScoresByEntity = cmp.getSlideScores();
|
| 272 |
CreationUtils.storeSlideScores(slideScoresByEntity);
|
278 |
CreationUtils.storeSlideScores(slideScoresByEntity);
|
| 273 |
|
279 |
|
| 274 |
// Fetch comparison statistics only on sunday, else use the data stored in BDB
|
280 |
// Fetch comparison statistics only on sunday, else use the data stored in BDB
|
| 275 |
Calendar cal = Calendar.getInstance();
|
281 |
Calendar cal = Calendar.getInstance();
|
| 276 |
int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
|
282 |
//int dayOfWeek = cal.get(Calendar.DAY_OF_WEEK);
|
| 277 |
//if(dayOfWeek == Calendar.SUNDAY){
|
283 |
//if(dayOfWeek == Calendar.SUNDAY){
|
| 278 |
long toDate = cal.getTime().getTime();
|
284 |
long toDate = cal.getTime().getTime();
|
| 279 |
cal.add(Calendar.MONTH, -1);
|
285 |
cal.add(Calendar.MONTH, -1);
|
| 280 |
long fromDate = cal.getTime().getTime();
|
286 |
long fromDate = cal.getTime().getTime();
|
| 281 |
ComparisonStatsFetcher csf = new ComparisonStatsFetcher();
|
287 |
ComparisonStatsFetcher csf = new ComparisonStatsFetcher();
|
| 282 |
csf.fetchAndStoreComparisonStats(fromDate, toDate);
|
288 |
csf.fetchAndStoreComparisonStats(fromDate, toDate);
|
| 283 |
//}
|
289 |
//}
|
| - |
|
290 |
|
| - |
|
291 |
// Upload catalod to Google App Engine.
|
| - |
|
292 |
if(GENERATION_TYPE.equals("ALL")) {
|
| - |
|
293 |
List<Item> allItems = client.getAllItems(false);
|
| - |
|
294 |
allItems.addAll(client.getAllItems(true));
|
| - |
|
295 |
CatalogUploderToGAE catalogUploaderToGAE = new CatalogUploderToGAE();
|
| - |
|
296 |
catalogUploaderToGAE.uploadItems(allItems);
|
| - |
|
297 |
}
|
| 284 |
|
298 |
|
| 285 |
items = client.getAllItemsByStatus(status.ACTIVE);
|
299 |
items = client.getAllItemsByStatus(status.ACTIVE);
|
| 286 |
items.addAll(client.getAllItemsByStatus(status.PAUSED));
|
300 |
items.addAll(client.getAllItemsByStatus(status.PAUSED));
|
| 287 |
items.addAll(client.getAllItemsByStatus(status.CONTENT_COMPLETE));
|
301 |
items.addAll(client.getAllItemsByStatus(status.CONTENT_COMPLETE));
|
| 288 |
populateEntityIdItemMap();
|
302 |
populateEntityIdItemMap();
|