Commit 2aa5c263 by Tuukka Kivilahti

Merge branch 'optimisations' into 'master'

Optimisations

Random minor fixes and optimisations. Notes in commit messages

See merge request !266
2 parents 469b7031 275ea778
...@@ -32,6 +32,9 @@ import javax.persistence.Temporal; ...@@ -32,6 +32,9 @@ import javax.persistence.Temporal;
import javax.persistence.TemporalType; import javax.persistence.TemporalType;
import javax.persistence.Transient; import javax.persistence.Transient;
import org.eclipse.persistence.annotations.BatchFetch;
import org.eclipse.persistence.annotations.BatchFetchType;
import fi.codecrew.moya.utilities.NumericStringComparator; import fi.codecrew.moya.utilities.NumericStringComparator;
/** /**
...@@ -69,6 +72,7 @@ public class Place extends GenericEntity implements Comparable<Place> { ...@@ -69,6 +72,7 @@ public class Place extends GenericEntity implements Comparable<Place> {
private String code = ""; private String code = "";
@OneToOne(mappedBy = "placeReservation") @OneToOne(mappedBy = "placeReservation")
@BatchFetch(BatchFetchType.EXISTS)
private GroupMembership placeReserver; private GroupMembership placeReserver;
@Column(name = "buyable", nullable = false) @Column(name = "buyable", nullable = false)
...@@ -104,6 +108,11 @@ public class Place extends GenericEntity implements Comparable<Place> { ...@@ -104,6 +108,11 @@ public class Place extends GenericEntity implements Comparable<Place> {
@ManyToOne @ManyToOne
private EventUser currentUser; private EventUser currentUser;
@OneToOne(mappedBy = "place")
@JoinColumn(nullable = true)
@BatchFetch(BatchFetchType.EXISTS)
private PlaceSlot reserverSlot;
public static enum PlaceState { public static enum PlaceState {
FREE, DISABLED, LOCKED, TEMP_RESERVED_FORME, FREE, DISABLED, LOCKED, TEMP_RESERVED_FORME,
MY_PLACE, RESERVED MY_PLACE, RESERVED
...@@ -138,10 +147,6 @@ public class Place extends GenericEntity implements Comparable<Place> { ...@@ -138,10 +147,6 @@ public class Place extends GenericEntity implements Comparable<Place> {
return ret; return ret;
} }
@OneToOne(mappedBy = "place")
@JoinColumn(nullable = true)
private PlaceSlot reserverSlot;
public Place() { public Place() {
super(); super();
} }
...@@ -311,6 +316,7 @@ public class Place extends GenericEntity implements Comparable<Place> { ...@@ -311,6 +316,7 @@ public class Place extends GenericEntity implements Comparable<Place> {
/** /**
* NOTE: you can newer be sure that this is up to date * NOTE: you can newer be sure that this is up to date
*
* @return * @return
*/ */
public PlaceSlot getReserverSlot() { public PlaceSlot getReserverSlot() {
...@@ -361,13 +367,13 @@ public class Place extends GenericEntity implements Comparable<Place> { ...@@ -361,13 +367,13 @@ public class Place extends GenericEntity implements Comparable<Place> {
if (this.getName() == null || o.getName() == null) { if (this.getName() == null || o.getName() == null) {
if (this.getName() == null) { if (this.getName() == null) {
return 1; return 1;
} }
if (o.getName() == null) { if (o.getName() == null) {
return -1; return -1;
} }
// both names are null. Compare IDs // both names are null. Compare IDs
return this.getNonNullId().compareTo(o.getNonNullId()); return this.getNonNullId().compareTo(o.getNonNullId());
} }
if (this.getName().equals(o.getName())) { if (this.getName().equals(o.getName())) {
return 0; return 0;
......
...@@ -41,7 +41,7 @@ ...@@ -41,7 +41,7 @@
<h:body> <h:body>
<!-- Javascript-lokalisaatiolippupuljausta --> <!-- Javascript-lokalisaatiolippupuljausta -->
<h:form id="conversationKeepaliver"> <h:form id="conversationKeepaliver">
<p:remoteCommand name="cdiKeepalive" update=":cdiloop" actionListener="#{conversationKeepaliveView.ping()}" /> <p:remoteCommand name="cdiKeepalive" onerror="location.reload();" update=":cdiloop" actionListener="#{conversationKeepaliveView.ping()}" />
</h:form> </h:form>
<h:outputText id="cdiloop" value="#{conversationKeepaliveView.value}" /> <h:outputText id="cdiloop" value="#{conversationKeepaliveView.value}" />
......
...@@ -44,9 +44,7 @@ public class BortalApplicationWrapper implements Serializable { ...@@ -44,9 +44,7 @@ public class BortalApplicationWrapper implements Serializable {
app = bApp; app = bApp;
permissions = new ArrayList<IAppPermission>(); permissions = new ArrayList<IAppPermission>();
for (IAppPermission ap : bApp.getPermissions()) { for (IAppPermission ap : bApp.getPermissions()) {
if (set != null) {
logger.info("App Match {}, {}", ap, set.contains(ap));
}
boolean has = set != null && set.contains(ap); boolean has = set != null && set.contains(ap);
if (has) if (has)
{ {
......
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!