Java tutorial
/** * Project: movie-mapi-static * * File Created at 2014-11-22 * $Id$ * * Copyright 2010 dianping.com. * All rights reserved. * * This software is the confidential and proprietary information of * Dianping Company. ("Confidential Information"). You shall not * disclose such Confidential Information and shall use it only in * accordance with the terms of the license agreement you entered into * with dianping.com. */ package com.dianping.apistatic.Job; import java.util.Map; import java.util.Set; import org.apache.commons.collections.MapUtils; import com.dianping.apistatic.Constants; import com.dianping.apistatic.builder.CinemaListBuilder; import com.google.common.collect.Maps; /** * * @author jin.chen.sh * */ public class CinemaListCrawlerJob extends BaseCrawlerJob { /* (non-Javadoc) * @see com.dianping.apistatic.Job.BaseCrawlerJob#execute() */ @Override protected void execute() throws Exception { Map<Integer, Set<Integer>> shopIdMap = Maps.newHashMap(); // key cityid for (int cityId : getCityIds()) { log("cinamelist current city: " + cityId); CinemaListBuilder cinemaListBuilder = new CinemaListBuilder(cityId); cinemaListBuilder.buildCache(cinemaListBuilder.getUrlAndHeader()); shopIdMap.put(cityId, cinemaListBuilder.getShopIds()); } if (MapUtils.isNotEmpty(shopIdMap)) { writeObjectAsJsonToFile(Constants.SHOPIDMAP_PATH, shopIdMap); } } }