Commit cd258e9b by Tuukka Kivilahti

ok, now it works, you can test it now. If it does not work, its your fault

1 parent d0093a9b
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.beans;
import fi.insomnia.bortal.facade.PlaceFacade;
import fi.insomnia.bortal.model.Place;
import javax.ejb.EJB;
import javax.ejb.Stateless;
/**
*
* @author tuukka
*/
@Stateless
public class PlaceBean implements PlaceBeanLocal {
@EJB
private PlaceFacade placeFacade;
public void mergeChanges(Place place) {
placeFacade.merge(place);
}
}
/*
* To change this template, choose Tools | Templates
* and open the template in the editor.
*/
package fi.insomnia.bortal.beans;
import fi.insomnia.bortal.model.Place;
import javax.ejb.Local;
/**
*
* @author tuukka
*/
@Local
public interface PlaceBeanLocal {
public void mergeChanges(Place place);
}
......@@ -334,7 +334,7 @@ public class Place implements EventChildInterface {
g.fill(new Rectangle(mapX, mapY, width, height));
}
private boolean isReserved() {
public boolean isReserved() {
......@@ -355,7 +355,7 @@ public class Place implements EventChildInterface {
}
public static final long RESERVE_TIME = 1000*60*20; // 20min.
private void setReserved(boolean reserved) {
public void setReserved(boolean reserved) {
if(reserved) {
releaseTime = Calendar.getInstance();
releaseTime.setTimeInMillis(System.currentTimeMillis()+RESERVE_TIME);
......
......@@ -4,6 +4,7 @@
*/
package fi.insomnia.bortal.view;
import fi.insomnia.bortal.beans.PlaceBeanLocal;
import fi.insomnia.bortal.beans.PlaceMapBeanLocal;
import fi.insomnia.bortal.handler.SessionHandler;
import fi.insomnia.bortal.model.EventMap;
......@@ -30,9 +31,12 @@ import org.slf4j.LoggerFactory;
public class MapView {
private Logger logger = LoggerFactory.getLogger(MapView.class);
@EJB
private PlaceMapBeanLocal placeMapBean;
@EJB
private PlaceBeanLocal placeBean;
@ManagedProperty("#{sessionHandler}")
......@@ -57,12 +61,14 @@ public class MapView {
if (place != null) {
if (selectedPlaces.contains(place)) {
selectedPlaces.remove(place);
place.setReserved(false);
placeBean.mergeChanges(place);
} else {
selectedPlaces.add(place);
place.setReserved(true);
placeBean.mergeChanges(place);
}
}
}
public String getSelectPlaceMapUrl() {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!