Commit 7b1373fa by Tuukka Kivilahti

imagemap generation

1 parent b3f7a65c
deploy.ant.properties.file=/home/tuukka/.netbeans/6.8/gfv3-913352158.properties
deploy.ant.properties.file=/home/tuukka/.netbeans/6.8/gfv3307033442.properties
j2ee.appclient.tool.jvmoptions=-Djava.endorsed.dirs="/usr/local/sges-v3/glassfish/lib/endorsed":"/usr/local/sges-v3/glassfish/modules/endorsed" -javaagent:"/usr/local/sges-v3/glassfish/modules/gf-client.jar"=mode=acscript,arg=-configxml,arg="/home/tuukka/.netbeans/6.8/GlassFish_v3/config/sun-acc.xml",client=jar=
j2ee.appclient.tool.mainclass=org.glassfish.appclient.client.AppClientFacade
j2ee.appclient.tool.runtime=
j2ee.platform.classpath=/usr/local/sges-v3/glassfish/modules/endorsed/jaxb-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/webservices-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/javax.security.jacc.jar:/usr/local/sges-v3/glassfish/modules/javax.resource.jar:/usr/local/sges-v3/glassfish/modules/javax.transaction.jar:/usr/local/sges-v3/glassfish/modules/mail.jar:/usr/local/sges-v3/glassfish/modules/javax.persistence.jar:/usr/local/sges-v3/glassfish/modules/javax.enterprise.deploy.jar:/usr/local/sges-v3/glassfish/modules/bean-validator.jar:/usr/local/sges-v3/glassfish/modules/jsr311-api.jar:/usr/local/sges-v3/glassfish/modules/jsf-api.jar:/usr/local/sges-v3/glassfish/modules/weld-osgi-bundle.jar:/usr/local/sges-v3/glassfish/modules/jstl-impl.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jsp.jstl.jar:/usr/local/sges-v3/glassfish/modules/javax.management.j2ee.jar:/usr/local/sges-v3/glassfish/modules/javax.security.auth.message.jar:/usr/local/sges-v3/glassfish/modules/javax.ejb.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jsp.jar:/usr/local/sges-v3/glassfish/modules/javax.jms.jar:/usr/local/sges-v3/glassfish/modules/endorsed/javax.annotation.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jar:/usr/local/sges-v3/glassfish/modules/jsf-impl.jar
j2ee.server.instance=[/usr/local/sges-v3/glassfish]deployer:gfv3ee6:localhost:36570
j2ee.server.instance=[/usr/local/sges-v3/glassfish]deployer:gfv3ee6:localhost:28892
netbeans.user=/home/tuukka/.netbeans/6.8
wa.copy.client.jar.from=/home/tuukka/.netbeans/6.8/GlassFish_v3/generated/xml
deploy.ant.properties.file=/home/tuukka/.netbeans/6.8/gfv3-913352158.properties
deploy.ant.properties.file=/home/tuukka/.netbeans/6.8/gfv3307033442.properties
j2ee.platform.classpath=/usr/local/sges-v3/glassfish/modules/endorsed/jaxb-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/webservices-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/javax.security.jacc.jar:/usr/local/sges-v3/glassfish/modules/javax.resource.jar:/usr/local/sges-v3/glassfish/modules/javax.transaction.jar:/usr/local/sges-v3/glassfish/modules/mail.jar:/usr/local/sges-v3/glassfish/modules/javax.persistence.jar:/usr/local/sges-v3/glassfish/modules/javax.enterprise.deploy.jar:/usr/local/sges-v3/glassfish/modules/bean-validator.jar:/usr/local/sges-v3/glassfish/modules/jsr311-api.jar:/usr/local/sges-v3/glassfish/modules/jsf-api.jar:/usr/local/sges-v3/glassfish/modules/weld-osgi-bundle.jar:/usr/local/sges-v3/glassfish/modules/jstl-impl.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jsp.jstl.jar:/usr/local/sges-v3/glassfish/modules/javax.management.j2ee.jar:/usr/local/sges-v3/glassfish/modules/javax.security.auth.message.jar:/usr/local/sges-v3/glassfish/modules/javax.ejb.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jsp.jar:/usr/local/sges-v3/glassfish/modules/javax.jms.jar:/usr/local/sges-v3/glassfish/modules/endorsed/javax.annotation.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jar:/usr/local/sges-v3/glassfish/modules/jsf-impl.jar
j2ee.platform.embeddableejb.classpath=/usr/local/sges-v3/glassfish/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.wsgen.classpath=/usr/local/sges-v3/glassfish/modules/webservices-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/webservices-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/jaxb-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsimport.classpath=/usr/local/sges-v3/glassfish/modules/webservices-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/webservices-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/jaxb-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsit.classpath=
j2ee.server.instance=[/usr/local/sges-v3/glassfish]deployer:gfv3ee6:localhost:36570
j2ee.server.instance=[/usr/local/sges-v3/glassfish]deployer:gfv3ee6:localhost:28892
javac.debug=true
javadoc.preview=true
jaxbwiz.endorsed.dirs=/usr/local/netbeans-6.8/ide12/modules/ext/jaxb/api
......
<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<catalog xmlns="urn:oasis:names:tc:entity:xmlns:xml:catalog" prefer="system">
<nextCatalog catalog="nbproject/private/retriever/catalog.xml"/>
</catalog>
......@@ -3,7 +3,7 @@
<persistence-unit name="BortalDb" transaction-type="JTA">
<jta-data-source>jdbc/bortal</jta-data-source>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.ddl-generation" value="drop-and-create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
</properties>
</persistence-unit>
......
......@@ -11,7 +11,7 @@ import java.io.Serializable;
*
* @author tuukka
*/
public interface EventChildInterface extends ModelInterface<EventPk>, Serializable {
public interface EventChildInterface extends ModelInterface<EventPk> {
public EventPk getId();
public void setId(EventPk id);
......
......@@ -4,7 +4,11 @@
*/
package fi.insomnia.bortal.model;
import java.awt.image.BufferedImage;
import java.io.ByteArrayInputStream;
import java.io.IOException;
import java.util.List;
import javax.imageio.ImageIO;
import javax.persistence.CascadeType;
import javax.persistence.Column;
......@@ -167,4 +171,20 @@ public class EventMap implements EventChildInterface{
public void setReaders(List<Reader> readers) {
this.readers = readers;
}
public BufferedImage getMapWithPlaces() throws IOException {
BufferedImage image = ImageIO.read(new ByteArrayInputStream(getMapData()));
for(Place place : getPlaces()) {
place.drawPlace(image);
}
return image;
}
}
package fi.insomnia.bortal.model;
public interface ModelInterface<T> {
import java.io.Serializable;
public interface ModelInterface<T> extends Serializable {
public T getId();
public void setId(T id);
......
......@@ -4,6 +4,10 @@
*/
package fi.insomnia.bortal.model;
import java.awt.Color;
import java.awt.Graphics2D;
import java.awt.Rectangle;
import java.awt.image.BufferedImage;
import javax.persistence.Column;
import javax.persistence.EmbeddedId;
import javax.persistence.Entity;
......@@ -22,15 +26,15 @@ import javax.persistence.Version;
*/
@Entity
@Table(name = "places")
@NamedQueries( {
@NamedQueries({
@NamedQuery(name = "Place.findAll", query = "SELECT p FROM Place p"),
@NamedQuery(name = "Place.findByDescription", query = "SELECT p FROM Place p WHERE p.description = :description"),
@NamedQuery(name = "Place.findByName", query = "SELECT p FROM Place p WHERE p.name = :name"),
@NamedQuery(name = "Place.findByMapX", query = "SELECT p FROM Place p WHERE p.mapX = :mapX"),
@NamedQuery(name = "Place.findByMapY", query = "SELECT p FROM Place p WHERE p.mapY = :mapY"),
@NamedQuery(name = "Place.findByDetails", query = "SELECT p FROM Place p WHERE p.details = :details"),
@NamedQuery(name = "Place.findByCode", query = "SELECT p FROM Place p WHERE p.code = :code") })
public class Place implements EventChildInterface{
@NamedQuery(name = "Place.findByCode", query = "SELECT p FROM Place p WHERE p.code = :code")})
public class Place implements EventChildInterface {
private static final long serialVersionUID = 1L;
@EmbeddedId
......@@ -44,44 +48,41 @@ public class Place implements EventChildInterface{
private Integer mapX;
@Column(name = "map_y")
private Integer mapY;
@Column(name = "width")
private Integer width;
@Column(name = "height")
private Integer height;
@Column(name = "place_details")
@Lob
private String details;
@Column(name = "place_code")
private String code;
@OneToOne(mappedBy = "placeReservation")
private GroupMembership placeReserver;
/**
* Which group has bought the place
*/
@JoinColumns({
@JoinColumn(name = "groups_id", referencedColumnName = "entity_id", nullable = false, updatable = false, insertable = false),
@JoinColumn(name="groups_event_id",referencedColumnName = "events_pk_id", nullable = false, updatable = false, insertable = false)
@JoinColumn(name = "groups_event_id", referencedColumnName = "events_pk_id", nullable = false, updatable = false, insertable = false)
})
@ManyToOne
private PlaceGroup placeGroup;
@JoinColumns({
@JoinColumn(name = "maps_id", referencedColumnName = "entity_id", nullable = false, updatable = false, insertable = false),
@JoinColumn(name="maps_event_id",referencedColumnName = "events_pk_id", nullable = false, updatable = false, insertable = false)
@JoinColumn(name = "maps_event_id", referencedColumnName = "events_pk_id", nullable = false, updatable = false, insertable = false)
})
@ManyToOne(optional = false)
private EventMap map;
/**
* Which ticket type is this place sold as
*/
@JoinColumns({
@JoinColumn(name = "products_id", referencedColumnName = "entity_id", nullable = false, updatable = false, insertable = false),
@JoinColumn(name="products_event_id",referencedColumnName = "events_pk_id", nullable = false, updatable = false, insertable = false)
@JoinColumn(name = "products_event_id", referencedColumnName = "events_pk_id", nullable = false, updatable = false, insertable = false)
})
@ManyToOne(optional = false)
private Product product;
/**
* Who is the current currentUser (mapped with code printed on the place) of
* the place. Used in Vectorama currentUser tracking.
......@@ -89,7 +90,6 @@ public class Place implements EventChildInterface{
@JoinColumn(name = "users_id", referencedColumnName = "users_id")
@ManyToOne
private User currentUser;
@Version
@Column(nullable = false)
private int jpaVersionField;
......@@ -249,4 +249,73 @@ public class Place implements EventChildInterface{
public GroupMembership getPlaceReserver() {
return placeReserver;
}
/**
* @return the height
*/
public Integer getHeight() {
return height;
}
/**
* @param height the height to set
*/
public void setHeight(Integer height) {
this.height = height;
}
/**
* @return the width
*/
public Integer getWidth() {
return width;
}
/**
* @param width the width to set
*/
public void setWidth(Integer width) {
this.width = width;
}
public boolean isCoordinateInPlace(int x, int y) {
if (x > mapX
&& x < (mapX + width)
&& y > mapY
&& y < (mapY + height)) {
return true;
}
return false;
}
private static final Color NORMAL_COLOR = Color.BLUE;
private static final Color RESERVED_COLOR = Color.RED;
private static final Color SELECTED_COLOR = Color.GREEN;
private static final Color OWNED_COLOR = Color.GREEN;
public void drawPlace(BufferedImage targetImage) {
Graphics2D g = targetImage.createGraphics();
if (placeGroup != null) {
g.setColor(RESERVED_COLOR);
g.fill(new Rectangle(mapX, mapY, width, height));
} else {
g.setColor(NORMAL_COLOR);
g.draw(new Rectangle(mapX, mapY, width, height));
}
}
public void drawSelectedPlace(BufferedImage targetImage) {
Graphics2D g = targetImage.createGraphics();
g.setColor(SELECTED_COLOR);
g.fill(new Rectangle(mapX, mapY, width, height));
}
public void drawOwnedPlace(BufferedImage targetImage) {
Graphics2D g = targetImage.createGraphics();
g.setColor(OWNED_COLOR);
g.fill(new Rectangle(mapX, mapY, width, height));
}
}
......@@ -27,8 +27,8 @@ import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import fi.insomnia.bortal.utilities.PasswordFunctions;
import java.io.Serializable;
import sun.reflect.generics.reflectiveObjects.NotImplementedException;
/**
*
......
<?xml version="1.0" encoding="UTF-8"?>
<!-- You may freely edit this file. See commented blocks below for -->
<!-- some examples of how to customize the build. -->
<!-- (If you delete it and reopen the project it will be recreated.) -->
<!-- By default, only the Clean and Build commands use this build script. -->
<!-- Commands such as Run, Debug, and Test only use this build script if -->
<!-- the Compile on Save feature is turned off for the project. -->
<!-- You can turn off the Compile on Save (or Deploy on Save) setting -->
<!-- in the project's Project Properties dialog box.-->
<project name="LanBortalUtilities" default="default" basedir=".">
<description>Builds, tests, and runs the project LanBortalUtilities.</description>
<import file="nbproject/build-impl.xml"/>
<!--
There exist several targets which are by default empty and which can be
used for execution of your tasks. These targets are usually executed
before and after some main targets. They are:
-pre-init: called before initialization of project properties
-post-init: called after initialization of project properties
-pre-compile: called before javac compilation
-post-compile: called after javac compilation
-pre-compile-single: called before javac compilation of single file
-post-compile-single: called after javac compilation of single file
-pre-compile-test: called before javac compilation of JUnit tests
-post-compile-test: called after javac compilation of JUnit tests
-pre-compile-test-single: called before javac compilation of single JUnit test
-post-compile-test-single: called after javac compilation of single JUunit test
-pre-jar: called before JAR building
-post-jar: called after JAR building
-post-clean: called after cleaning build products
(Targets beginning with '-' are not intended to be called on their own.)
Example of inserting an obfuscator after compilation could look like this:
<target name="-post-compile">
<obfuscate>
<fileset dir="${build.classes.dir}"/>
</obfuscate>
</target>
For list of available properties check the imported
nbproject/build-impl.xml file.
Another way to customize the build is by overriding existing main targets.
The targets of interest are:
-init-macrodef-javac: defines macro for javac compilation
-init-macrodef-junit: defines macro for junit execution
-init-macrodef-debug: defines macro for class debugging
-init-macrodef-java: defines macro for class execution
-do-jar-with-manifest: JAR building (if you are using a manifest)
-do-jar-without-manifest: JAR building (if you are not using a manifest)
run: execution of project
-javadoc-build: Javadoc generation
test-report: JUnit report generation
An example of overriding the target for project execution could look like this:
<target name="run" depends="LanBortalUtilities-impl.jar">
<exec dir="bin" executable="launcher.exe">
<arg file="${dist.jar}"/>
</exec>
</target>
Notice that the overridden target depends on the jar target and not only on
the compile target as the regular run target does. Again, for a list of available
properties which you can use, check the target you are overriding in the
nbproject/build-impl.xml file.
-->
</project>
Manifest-Version: 1.0
X-COMMENT: Main-Class will be added automatically by build
......@@ -2,6 +2,7 @@
<persistence version="1.0" xmlns="http://java.sun.com/xml/ns/persistence" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/persistence http://java.sun.com/xml/ns/persistence/persistence_1_0.xsd">
<persistence-unit name="BortalDb" transaction-type="JTA">
<jta-data-source>jdbc/bortal</jta-data-source>
<exclude-unlisted-classes>false</exclude-unlisted-classes>
<properties>
<property name="eclipselink.ddl-generation" value="create-tables"/>
<property name="eclipselink.ddl-generation.output-mode" value="database"/>
......
<?xml version="1.0" encoding="UTF-8"?>
<web-app xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" id="WebApp_ID" version="2.5">
<web-app id="WebApp_ID" version="2.5" xmlns="http://java.sun.com/xml/ns/javaee" xmlns:web="http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://java.sun.com/xml/ns/javaee http://java.sun.com/xml/ns/javaee/web-app_2_5.xsd">
<display-name>LanBortalWeb</display-name>
<context-param>
<param-name>javax.faces.FACELETS_SKIP_COMMENTS</param-name>
<param-value>true</param-value>
</context-param>
<servlet-mapping>
<servlet-name>PlaceMap</servlet-name>
<url-pattern>/PlaceMap</url-pattern>
</servlet-mapping>
<welcome-file-list>
<welcome-file>index.html</welcome-file>
<welcome-file>index.jsf</welcome-file>
......@@ -16,11 +18,14 @@
<servlet-name>Faces Servlet</servlet-name>
<servlet-class>javax.faces.webapp.FacesServlet</servlet-class>
</servlet>
<servlet>
<servlet-name>PlaceMap</servlet-name>
<servlet-class>fi.insomnia.bortal.servlet.PlaceMap</servlet-class>
</servlet>
<servlet-mapping>
<servlet-name>Faces Servlet</servlet-name>
<url-pattern>*.jsf</url-pattern>
</servlet-mapping>
<filter>
<display-name>HostnameFilter</display-name>
<filter-name>HostnameFilter</filter-name>
......@@ -39,5 +44,4 @@
<description>asdasd</description>
</auth-constraint>
</security-constraint>
</web-app>
deploy.ant.properties.file=/home/tuukka/.netbeans/6.8/gfv3-913352158.properties
deploy.ant.properties.file=/home/tuukka/.netbeans/6.8/gfv3307033442.properties
j2ee.platform.classpath=/usr/local/sges-v3/glassfish/modules/endorsed/jaxb-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/webservices-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/javax.security.jacc.jar:/usr/local/sges-v3/glassfish/modules/javax.resource.jar:/usr/local/sges-v3/glassfish/modules/javax.transaction.jar:/usr/local/sges-v3/glassfish/modules/mail.jar:/usr/local/sges-v3/glassfish/modules/javax.persistence.jar:/usr/local/sges-v3/glassfish/modules/javax.enterprise.deploy.jar:/usr/local/sges-v3/glassfish/modules/bean-validator.jar:/usr/local/sges-v3/glassfish/modules/jsr311-api.jar:/usr/local/sges-v3/glassfish/modules/jsf-api.jar:/usr/local/sges-v3/glassfish/modules/weld-osgi-bundle.jar:/usr/local/sges-v3/glassfish/modules/jstl-impl.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jsp.jstl.jar:/usr/local/sges-v3/glassfish/modules/javax.management.j2ee.jar:/usr/local/sges-v3/glassfish/modules/javax.security.auth.message.jar:/usr/local/sges-v3/glassfish/modules/javax.ejb.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jsp.jar:/usr/local/sges-v3/glassfish/modules/javax.jms.jar:/usr/local/sges-v3/glassfish/modules/endorsed/javax.annotation.jar:/usr/local/sges-v3/glassfish/modules/javax.servlet.jar:/usr/local/sges-v3/glassfish/modules/jsf-impl.jar
j2ee.platform.embeddableejb.classpath=/usr/local/sges-v3/glassfish/lib/embedded/glassfish-embedded-static-shell.jar
j2ee.platform.is.jsr109=true
j2ee.platform.wsgen.classpath=/usr/local/sges-v3/glassfish/modules/webservices-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/webservices-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/jaxb-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsimport.classpath=/usr/local/sges-v3/glassfish/modules/webservices-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/webservices-api-osgi.jar:/usr/local/sges-v3/glassfish/modules/jaxb-osgi.jar:/usr/local/sges-v3/glassfish/modules/endorsed/jaxb-api-osgi.jar
j2ee.platform.wsit.classpath=
j2ee.server.instance=[/usr/local/sges-v3/glassfish]deployer:gfv3ee6:localhost:36570
j2ee.server.instance=[/usr/local/sges-v3/glassfish]deployer:gfv3ee6:localhost:28892
javac.debug=true
javadoc.preview=true
jaxbwiz.endorsed.dirs=/usr/local/netbeans-6.8/ide12/modules/ext/jaxb/api
......
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.servlet;
import fi.insomnia.bortal.facade.EventMapFacade;
import fi.insomnia.bortal.facade.PlaceFacade;
import fi.insomnia.bortal.facade.UserFacade;
import fi.insomnia.bortal.model.EventMap;
import fi.insomnia.bortal.model.Place;
import fi.insomnia.bortal.model.User;
import java.awt.image.BufferedImage;
import java.io.IOException;
import java.io.PrintWriter;
import javax.ejb.EJB;
import javax.imageio.ImageIO;
import javax.servlet.ServletException;
import javax.servlet.http.HttpServlet;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
/**
*
* @author tuukka
*/
public class PlaceMap extends HttpServlet {
public static final String PARAMETER_EVENT_MAP_ID = "mapid";
public static final String PARAMETER_SELECTED_PLACE_ID = "placeid";
public static final String PARAMETER_CURRENT_USER_ID = "userid";
@EJB
private PlaceFacade placeFacade;
@EJB
private EventMapFacade eventMapFacade;
@EJB
private UserFacade userFacade;
/**
* Processes requests for both HTTP <code>GET</code> and <code>POST</code> methods.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
protected void processRequest(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
response.setContentType("text/html;charset=UTF-8");
PrintWriter out = response.getWriter();
try {
Integer placeId = getIntegerParameter(request, PARAMETER_SELECTED_PLACE_ID);
Integer mapId = getIntegerParameter(request, PARAMETER_EVENT_MAP_ID);
Integer userId = getIntegerParameter(request, PARAMETER_CURRENT_USER_ID);
Place place = null;
EventMap map = null;
if (placeId != null) {
place = placeFacade.find(placeId);
}
if (place != null) {
map = place.getMap();
} else {
map = getEventMapFacade().find(mapId);
}
BufferedImage image = map.getMapWithPlaces();
if (userId != null) {
User user = userFacade.find(userId);
if(user != null) {
place.drawOwnedPlace(image);
}
}
if (place != null) {
place.drawSelectedPlace(image);
}
response.setContentType("image/png");
ImageIO.write(image, "png", response.getOutputStream());
/* TODO output your page here
out.println("<html>");
out.println("<head>");
out.println("<title>Servlet PlaceMap</title>");
out.println("</head>");
out.println("<body>");
out.println("<h1>Servlet PlaceMap at " + request.getContextPath () + "</h1>");
out.println("</body>");
out.println("</html>");
*/
} finally {
out.close();
}
}
public void addPlacesToMap() {
}
/***
* Convert request parameter into integer
* @param request
* @param parameter
* @return
*/
private static Integer getIntegerParameter(HttpServletRequest request, String parameter) {
try {
String valueString = request.getParameter(parameter);
Integer value = Integer.parseInt(valueString);
return value;
} catch (NumberFormatException nfe) {
}
return null;
}
// <editor-fold defaultstate="collapsed" desc="HttpServlet methods. Click on the + sign on the left to edit the code.">
/**
* Handles the HTTP <code>GET</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doGet(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Handles the HTTP <code>POST</code> method.
* @param request servlet request
* @param response servlet response
* @throws ServletException if a servlet-specific error occurs
* @throws IOException if an I/O error occurs
*/
@Override
protected void doPost(HttpServletRequest request, HttpServletResponse response)
throws ServletException, IOException {
processRequest(request, response);
}
/**
* Returns a short description of the servlet.
* @return a String containing servlet description
*/
@Override
public String getServletInfo() {
return "Short description";
}// </editor-fold>
/**
* @return the placeFacade
*/
public PlaceFacade getPlaceFacade() {
return placeFacade;
}
/**
* @param placeFacade the placeFacade to set
*/
public void setPlaceFacade(PlaceFacade placeFacade) {
this.placeFacade = placeFacade;
}
/**
* @return the eventMapFacade
*/
public EventMapFacade getEventMapFacade() {
return eventMapFacade;
}
/**
* @param eventMapFacade the eventMapFacade to set
*/
public void setEventMapFacade(EventMapFacade eventMapFacade) {
this.eventMapFacade = eventMapFacade;
}
/**
* @return the userFacade
*/
public UserFacade getUserFacade() {
return userFacade;
}
/**
* @param userFacade the userFacade to set
*/
public void setUserFacade(UserFacade userFacade) {
this.userFacade = userFacade;
}
}
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!