Commit 6cb01619 by Tuomas Riihimäki

Merge branch 'place_slot_remove_fix' into 'master'

Place slot remove fix

Muokataan placeslotista paikka tyhjäksi silloin kun siihen sidottu paikka vapautetaan. PlaceSlot jää kuitenkin "käytetyksi" -> näille vois tehdä joskus muokkaimen tai jotain.

See merge request !152
2 parents fe2fdcfd 94759686
...@@ -617,7 +617,13 @@ public class PlaceBean implements PlaceBeanLocal { ...@@ -617,7 +617,13 @@ public class PlaceBean implements PlaceBeanLocal {
place.setPlaceReserver(null); place.setPlaceReserver(null);
gmemfacade.remove(res); gmemfacade.remove(res);
}
// remove also slot from place
if(place.getReserverSlot() != null) {
PlaceSlot slot = placeSlotFacade.reload(place.getReserverSlot());
slot.setPlace(null);
place.setReserverSlot(null);
} }
return place; return place;
} }
......
...@@ -103,7 +103,8 @@ public class PlaceSlotFacade extends IntegerPkGenericFacade<PlaceSlot> { ...@@ -103,7 +103,8 @@ public class PlaceSlotFacade extends IntegerPkGenericFacade<PlaceSlot> {
cb.or(cb.isNull(billexp), cb.or(cb.isNull(billexp),
cb.greaterThan(billexp, Calendar.getInstance()) cb.greaterThan(billexp, Calendar.getInstance())
), ),
cb.isNull(root.get(PlaceSlot_.place)) cb.isNull(root.get(PlaceSlot_.place)),
cb.isNull(root.get(PlaceSlot_.used))
); );
Long count = super.getSingleNullableResult(getEm().createQuery(q)); Long count = super.getSingleNullableResult(getEm().createQuery(q));
......
...@@ -310,6 +310,14 @@ public class Place extends GenericEntity implements Comparable<Place> { ...@@ -310,6 +310,14 @@ public class Place extends GenericEntity implements Comparable<Place> {
return buyable; return buyable;
} }
public PlaceSlot getReserverSlot() {
return reserverSlot;
}
public void setReserverSlot(PlaceSlot reserverSlot) {
this.reserverSlot = reserverSlot;
}
public void setReleaseTime(Calendar releaseTime) { public void setReleaseTime(Calendar releaseTime) {
this.releaseTime = releaseTime; this.releaseTime = releaseTime;
} }
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!