View Javadoc

1   package de.tivsource.page.admin.actions.locations.location;
2   
3   
4   import java.util.Iterator;
5   
6   import org.apache.logging.log4j.LogManager;
7   import org.apache.logging.log4j.Logger;
8   import org.apache.struts2.convention.annotation.Action;
9   import org.apache.struts2.convention.annotation.Actions;
10  import org.apache.struts2.convention.annotation.Result;
11  
12  import de.tivsource.ejb3plugin.InjectEJB;
13  import de.tivsource.page.admin.actions.EmptyAction;
14  import de.tivsource.page.dao.location.LocationDaoLocal;
15  import de.tivsource.page.entity.location.Location;
16  import de.tivsource.page.helper.osm.CreateOpenStreetMapCache;
17  
18  /**
19   * 
20   * @author Marc Michele
21   *
22   */
23  public class OSMCacheAction extends EmptyAction {
24  
25  	/**
26  	 * Serial Version UID.
27  	 */
28  	private static final long serialVersionUID = 575079215033958866L;
29  
30  	/**
31  	 * Statischer Logger der Klasse.
32  	 */
33      private static final Logger LOGGER = LogManager.getLogger(OSMCacheAction.class);
34  
35      @InjectEJB(name="LocationDao")
36      private LocationDaoLocal locationDaoLocal;
37  
38      @Override
39      @Actions({
40          @Action(
41          		value = "cache", 
42          		results = { @Result(name = "success", type="tiles", location = "index") }
43          )
44      })
45      public String execute() throws Exception {
46      	LOGGER.info("execute() aufgerufen.");
47      	
48      	Iterator<Location> locationIterator = locationDaoLocal.findAll(0, locationDaoLocal.countAll()).iterator();
49      	
50      	while(locationIterator.hasNext()) {
51      		Location next = locationIterator.next();
52      		CreateOpenStreetMapCache cacheToCreate = new CreateOpenStreetMapCache(next.getUuid(), next.getLatitude(), next.getLongitude());
53      		cacheToCreate.generate();
54      	}
55      	
56      	
57      	return SUCCESS;
58      }// Ende execute()
59  	
60  }// Ende class