Commit 004f57d0 by Tuukka Kivilahti

Merge remote-tracking branch 'origin/master' into barcodefix_for_incomingviews

Conflicts:
	code/moya-beans/ejbModule/fi/codecrew/moya/facade/GroupMembershipFacade.java
2 parents 37cc2361 b1c2c9b5
Showing with 473 additions and 254 deletions
......@@ -250,6 +250,12 @@ public class BootstrapBean implements BootstrapBeanLocal {
"ALTER TABLE group_memberships DROP COLUMN place_product",
});
dbUpdates.add(new String[] {
"DELETE FROM products_product_limitations where productlimits_id in (SELECT id FROM product_limitations WHERE TYPE = 'PLACE')",
"DELETE FROM product_limitations WHERE TYPE = 'PLACE'",
});
}
public BootstrapBean() {
......
......@@ -280,16 +280,6 @@ public class ProductBean implements ProductBeanLocal {
switch (limit.getType())
{
case PLACE: {
Long reserved = 0L;
Long available = 0L;
for (Product p : limit.getProducts()) {
reserved += gmfacade.findPlaceProductCount(p);
available += placeFacade.findCountForProduct(p);
}
ret = BigDecimal.valueOf(available - reserved).subtract(count);
break;
}
case GLOBAL_BILLED: {
BigDecimal globBillTot = BigDecimal.ZERO;
for (Product p : limit.getProducts()) {
......
......@@ -72,7 +72,7 @@ public class GroupMembershipFacade extends IntegerPkGenericFacade<GroupMembershi
}
public GroupMembership findByToken(String token) {
if(token == null || token.trim().isEmpty())
if (token == null || token.trim().isEmpty())
return null;
CriteriaBuilder cb = getEm().getCriteriaBuilder();
......@@ -160,84 +160,54 @@ public class GroupMembershipFacade extends IntegerPkGenericFacade<GroupMembershi
);
return getEm().createQuery(cq).getResultList();
}
public Long findPlaceProductCount(Product product) {
return null;
/* CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<GroupMembership> root = cq.from(GroupMembership.class);
cq.select(cb.count(root));
cq.where(cb.equal(root.get(GroupMembership_.placeProduct), product));
return super.getSingleNullableResult(getEm().createQuery(cq));
*/
}
public Long findGroupMembershipsCount() {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<GroupMembership> root = cq.from(GroupMembership.class);
Path<PlaceGroup> pg = root.get(GroupMembership_.placeGroup);
cq.select(cb.count(root));
cq.where(cb.equal(pg.get(PlaceGroup_.event), eventbean.getCurrentEvent()));
return super.getSingleNullableResult(getEm().createQuery(cq));
}
public Long findGroupMembershipsEnteredCount() {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<Long> cq = cb.createQuery(Long.class);
Root<GroupMembership> root = cq.from(GroupMembership.class);
Path<PlaceGroup> pg = root.get(GroupMembership_.placeGroup);
cq.select(cb.count(root));
cq.where(cb.not(cb.isNull(root.get(GroupMembership_.enteredEvent))),
cb.equal(pg.get(PlaceGroup_.event), eventbean.getCurrentEvent())
);
return super.getSingleNullableResult(getEm().createQuery(cq));
}
public List<GroupMembership> findAllEnteredBetween(long startTimestamp, long endTimestamp) {
CriteriaBuilder cb = getEm().getCriteriaBuilder();
CriteriaQuery<GroupMembership> cq = cb.createQuery(GroupMembership.class);
Root<GroupMembership> root = cq.from(GroupMembership.class);
Path<PlaceGroup> pg = root.get(GroupMembership_.placeGroup);
Calendar c1 = Calendar.getInstance();
Calendar c2 = Calendar.getInstance();
c1.setTimeInMillis(startTimestamp);
c2.setTimeInMillis(endTimestamp);
cq.where(cb.between(root.get(GroupMembership_.enteredEvent), c1, c2),
cb.equal(pg.get(PlaceGroup_.event), eventbean.getCurrentEvent()));
return getEm().createQuery(cq).getResultList();
}
}
......@@ -20,5 +20,10 @@ package fi.codecrew.moya.model;
public enum ProductLimitationType {
GLOBAL_BILLED, GLOBAL_BILL_PAID, GLOBAL_ACCOUNTEVENTS, USER_BILLED, USER_BILL_PAID, USER_ACCOUNTEVENTS, PLACE
GLOBAL_BILLED,
GLOBAL_BILL_PAID,
GLOBAL_ACCOUNTEVENTS,
USER_BILLED,
USER_BILL_PAID,
USER_ACCOUNTEVENTS
}
......@@ -131,6 +131,22 @@
<artifactId>jvm-breakglass</artifactId>
<version>0.0.7</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.11</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-servlet_2.11</artifactId>
<version>${swagger.version}</version>
</dependency>
</dependencies>
<parent>
......
......@@ -3,7 +3,7 @@
<modelVersion>4.0.0</modelVersion>
<artifactId>moya-restpojo</artifactId>
<groupId>fi.codecrew.moya</groupId>
<version>1.0.2</version>
<version>1.0.5</version>
<build>
<plugins>
<plugin>
......
......@@ -4,12 +4,16 @@ import javax.xml.bind.annotation.XmlElement;
public class UserReservationPlacePojo {
@XmlElement
@XmlElement(name = "placeid")
private Integer placeid;
@XmlElement
@XmlElement(name = "placename")
private String placename;
@XmlElement
@XmlElement(name = "placegiven")
private boolean placegiven;
@XmlElement(name = "productid")
private Integer productId;
@XmlElement(name = "productname")
private String productName;
public String getPlacename() {
return placename;
......@@ -35,4 +39,20 @@ public class UserReservationPlacePojo {
this.placeid = placeid;
}
public Integer getProductId() {
return productId;
}
public void setProductId(Integer productId) {
this.productId = productId;
}
public String getProductName() {
return productName;
}
public void setProductName(String productName) {
this.productName = productName;
}
}
......@@ -26,6 +26,7 @@ import javax.xml.bind.annotation.XmlRootElement;
@XmlRootElement()
public class UserReservationRoot {
private EventUserRestPojo user;
private List<UserReservationPlacePojo> reservations = new ArrayList<UserReservationPlacePojo>();
public UserReservationRoot() {
......@@ -40,6 +41,12 @@ public class UserReservationRoot {
this.reservations = reservations;
}
public EventUserRestPojo getUser() {
return user;
}
public void setUser(EventUserRestPojo user) {
this.user = user;
}
}
......@@ -16,11 +16,9 @@
listener="#{actionLogMessageView.initView}" />
</f:metadata>
<ui:define name="content">
<h:outputStylesheet library="style"
name="templates/insomnia2/css/actionlog.css" />
<h1>#{i18n['actionlog.messagelist.header']}</h1>
<p>#{i18n['actionlog.messagelist.description']}</p>
<h:form id="actionlog">
<h:form id="actionlog" styleClass="moya_datatable4">
<h2>#{i18n['actionlog.create.header']}</h2>
<p:messages />
<h:panelGrid columns="2">
......
......@@ -9,38 +9,40 @@
<f:event type="preRenderView" listener="#{billListView.initSummaryView}" />
</f:metadata>
<ui:define name="content">
<h:dataTable border="0" id="billSummary" value="#{billListView.billsummary}" var="sumline" styleClass="moya_datatable2">
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.name']}" />
</f:facet>
<h:outputText value="#{sumline.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.boughtTotal']}" />
</f:facet>
<h:outputText value="#{sumline.active}">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.paid']}" />
</f:facet>
<h:outputText value="#{sumline.paid}">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.expired']}" />
</f:facet>
<h:outputText value="#{sumline.expired}">
<f:convertNumber />
</h:outputText>
</h:column>
</h:dataTable>
<h:form id="billsummary" styleClass="moya_datatable2">
<h:dataTable border="0" id="billSummary" value="#{billListView.billsummary}" var="sumline" styleClass="moya_datatable2">
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.name']}" />
</f:facet>
<h:outputText value="#{sumline.name}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.boughtTotal']}" />
</f:facet>
<h:outputText value="#{sumline.active}">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.paid']}" />
</f:facet>
<h:outputText value="#{sumline.paid}">
<f:convertNumber />
</h:outputText>
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.expired']}" />
</f:facet>
<h:outputText value="#{sumline.expired}">
<f:convertNumber />
</h:outputText>
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
......
......@@ -24,7 +24,7 @@
</p:outputPanel>
</h:form>
<h:form id="orgform">
<h:form id="orgform" styleClass="moya_datatable1">
<p:fieldset legend="#{i18n['eventorg.basicDetails']}">
<p:panelGrid columns="3">
<p:outputLabel for="id" value="#{i18n['event.id']}:" />
......@@ -78,7 +78,7 @@
<br /><br /><br /><br /><br />
<h2>#{i18n['event.domains.title']}</h2>
<h:form id="newDomainForm">
<h:form id="newDomainForm" styleClass="moya_datatable2">
<h:inputText value="#{eventorgView.newdomain}" />
<h:commandButton action="#{eventorgView.addDomain()}" value="#{i18n['eventdomain.add']}" />
<h:dataTable var="domain" value="#{eventorgView.eventdomains}">
......@@ -95,7 +95,7 @@
</h:form>
<h2>#{i18n['event.properties.title']}</h2>
<h:form id="propertyListForm">
<h:form id="propertyListForm" styleClass="moya_datatable2">
<h:dataTable var="prop" id="propertyListTable" value="#{eventPropertyView.properties}">
<h:column>
<f:facet name="header">#{i18n['lanEventProperty.key']}</f:facet>
......@@ -123,7 +123,7 @@
</h:dataTable>
</h:form>
<h:form id="propertyCreateForm">
<h:form id="propertyCreateForm" styleClass="moya_datatable1">
<h:selectOneMenu id="propval" value="#{eventPropertyView.createKey}">
<f:selectItems value="#{eventPropertyView.availablePropertyKeys}" />
</h:selectOneMenu>
......@@ -131,7 +131,7 @@
<h:message for="propval" />
</h:form>
<h:form id="propertyEditForm" rendered="#{!empty eventPropertyView.property}" enctype="#{eventPropertyView.property.key.data?'multipart/form-data':''}">
<h:form id="propertyEditForm" rendered="#{!empty eventPropertyView.property}" enctype="#{eventPropertyView.property.key.data?'multipart/form-data':''}" styleClass="moya_datatable2">
<h:panelGrid columns="3">
<h:outputLabel for="key" value="#{i18n['lanEventProperty.key']}" />
<h:outputText value="#{eventPropertyView.property.key}" id="key" />
......@@ -168,10 +168,10 @@
<p:commandButton ajax="false" action="#{eventPropertyView.saveProperty}" value="#{i18n['lanEventProperty.save']}" update=":propertyEditForm,:propertyListForm" />
</h:form>
<h2>#{i18n['event.privateProperties.title']}</h2>
<ui:fragment id="privatePropertyEditor" rendered="#{eventPropertyView.privatePropertyPermission}">
<h2>#{i18n['event.privateProperties.title']}</h2>
<h:form id="privPropList">
<h:form id="privPropList" styleClass="moya_datatable2">
<h:dataTable var="prop" value="#{eventPropertyView.privateProperties}">
<h:column>
<f:facet name="header">#{i18n['lanEventPrivateProperty.key']}</f:facet>
......
......@@ -12,7 +12,7 @@
<h1>#{i18n['foodWave.list']}</h1>
</ui:define>
<ui:define name="content">
<h:form>
<h:form id="listFoodwaves" styleClass="moya_datatable2">
<p:dataTable styleClass="bordertable" value="#{foodWaveView.foodWaves}" sortBy="#{foodwave.time}" sortOrder="ascending" var="foodwave" editable="true" rowStyleClass="#{not foodwave.isOrderable() ? foodwave.isDelivered() ? 'hidden' : 'closed' : null}">
<p:ajax event="rowEdit" listener="#{foodWaveView.onEditFoodWave}" />
<f:facet name="header">
......@@ -101,7 +101,7 @@
<br />
<br />
<h:form>
<h:form id="listfoodwaves_delivered" styleClass="moya_datatable2">
<p:dataTable styleClass="bordertable" value="#{foodWaveView.foodWaves}" sortBy="#{foodwave.time}" sortOrder="ascending" var="foodwave" editable="true" rowStyleClass="#{not foodwave.isOrderable() ? foodwave.isDelivered() ? 'closed' : 'hidden' : 'hidden'}">
<!-- rowStyleClass="#{foodWave.closed ? 'old' : null} -->
<p:ajax event="rowEdit" listener="#{foodWaveView.onEditFoodWave}" />
......
......@@ -27,7 +27,7 @@
<ui:define name="content">
<infoview:userselector />
<br /><br /><br /><br /><br /><br />
<br /><br />
<reader:multireaderselect />
......
......@@ -13,7 +13,7 @@
<ui:define name="content">
<h:form id="viewlecturesform">
<h:form id="viewlecturesform" styleClass="moya_datatable2">
<p:fieldset rendered="#{lectureReportsView.lectureGroupsVisible}" id="lectureGroups" legend="#{i18n['lecture.selectgroup']}">
<p:dataTable value="#{lectureReportsView.lectureGroups}" var="lectureGroup">
......
......@@ -13,7 +13,7 @@
<ui:define name="content">
<h:form id="managelecturegroups">
<h:form id="managelecturegroups" styleClass="moya_datatable2">
<p:dataTable id="lecturegroups" var="lectureGroup" value="#{lectureGroupView.lectureGroups}">
<p:column headerText="#{i18n['lectureGroup.name']}">
......
......@@ -18,7 +18,7 @@
<p:commandButton value="#{i18n['no']}" type="button" styleClass="ui-confirmdialog-no" icon="ui-icon-close" />
</p:confirmDialog>
<p:fieldset legend="#{lectureReportsView.currentLecture.name}">
<p:fieldset legend="#{lectureReportsView.currentLecture.name}" styleClass="moya_datatable2">
<p:panelGrid columns="2">
<p:outputLabel value="#{i18n['lecture.description']}" />
<h:outputText value="#{lectureReportsView.currentLecture.description}" />
......@@ -37,10 +37,7 @@
</p:panelGrid>
</p:fieldset>
<br />
<br />
<br />
<br />
<h:form id="manageParticipants">
<h:form id="manageParticipants" styleClass="moya_datatable2">
<p:dataTable id="participants" value="#{lectureReportsView.currentLecture.participants}" var="user">
<p:column>
<h:outputText value="#{user.user.nick}" />
......@@ -69,9 +66,6 @@
</p:dataTable>
</h:form>
<br />
<br />
<br />
<br />
<h:form>
<p:fieldset styleClass="no_print" legend="#{i18n['manageparticipants.addUser']}">
......
......@@ -23,7 +23,7 @@
</p:outputPanel>
<p:fieldset rendered="#{lectureUserView.lectureGroupsVisible}" id="lectureGroups" legend="#{i18n['lecture.selectgroup']}">
<p:dataTable value="#{lectureUserView.lectureGroups}" var="lectureGroup">
<p:dataTable value="#{lectureUserView.lectureGroups}" var="lectureGroup" >
<p:column headerText="#{i18n['lectureGroup.name']}">
<h:outputText value="#{lectureGroup.name}" />
</p:column>
......
......@@ -12,7 +12,7 @@
<ui:define name="content">
<h:form id="licenseForm">
<h:form id="licenseForm" styleClass="moya_datatable2">
<p:dataTable border="1" id="games" value="#{licenseView.licenses}" var="license">
<p:column>
<f:facet name="header">
......@@ -51,7 +51,7 @@
<br /><br />
<h:form id="editgame" >
<h:form id="editgame" styleClass="moya_datatable6">
<p:panelGrid columns="2">
<f:facet name="header">
......
......@@ -11,7 +11,7 @@
<f:event type="preRenderView" listener="#{networkAssociationView.initView}" />
</f:metadata>
<ui:define name="content">
<h:form>
<h:form id="networkassociation" styleClass="moya_datatable2">
<p:commandButton style="width: 0px; height: 0px;" value="#{i18n['networkassociation.create_association']}" action="#{networkAssociationView.createAssociation}" update="@form"/>
<p:messages autoUpdate="true" redisplay="false"></p:messages>
<h1>#{i18n['networkassociation.current_associations']}</h1>
......@@ -50,7 +50,7 @@
<p:commandButton value="#{i18n['networkassociation.drop_association']}" action="#{networkAssociationView.dropAssociation(activeAssoc.id)}" update="@form" immediate="true"/>
</p:column>
</p:dataTable>
<br />
<h1>#{i18n['networkassociation.pending_associations']}</h1>
<p:dataTable var="activeAssoc" value="#{networkAssociationView.pendingAssociations}">
<p:column headerText="#{i18n['networkassociation.create_time']}">
......@@ -88,8 +88,10 @@
</p:column>
</p:dataTable>
<br />
<h:panelGrid columns="3">
<h:outputText value="#{i18n['networkassociation.ip_address']}" />
<h:panelGrid columns="3" id="ip_mac_address">
<h:outputText value="#{i18n['networkassociation.ip_address']}"/>
<h:outputText value="#{i18n['networkassociation.mac_address']}" />
<h:outputText value="" />
......
......@@ -10,37 +10,39 @@
</f:metadata>
<ui:define name="content">
<h:form id="pageslist" styleClass="moya_datatable2">
<h1>#{i18n['sitepagelist.header']}</h1>
<h:dataTable styleClass="bordertable" id="user" value="#{sitePageView.pages}" var="page">
<h:column>
<f:facet name="header">
#
</f:facet>
<h:outputText value="#{page.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['sitepage.name']}" />
</f:facet>
<h:outputText value="#{page.name}" />
</h:column>
<h:column >
<f:facet name="header">
<h:outputText value="#{i18n['sitepage.roles']}" />
</f:facet>
<ul>
<ui:repeat var="r" value="#{page.allowedRoles}">
<li><h:outputText value="#{r.name}" /></li>
</ui:repeat>
</ul>
</h:column>
<h:column>
<h:link outcome="/pages/edit" value="#{i18n['sitepage.edit']}">
<f:param name="id" value="#{page.id}" />
</h:link>
</h:column>
</h:dataTable>
<h:dataTable styleClass="bordertable" id="user" value="#{sitePageView.pages}" var="page">
<h:column>
<f:facet name="header">
#
</f:facet>
<h:outputText value="#{page.id}" />
</h:column>
<h:column>
<f:facet name="header">
<h:outputText value="#{i18n['sitepage.name']}" />
</f:facet>
<h:outputText value="#{page.name}" />
</h:column>
<h:column >
<f:facet name="header">
<h:outputText value="#{i18n['sitepage.roles']}" />
</f:facet>
<ul>
<ui:repeat var="r" value="#{page.allowedRoles}">
<li><h:outputText value="#{r.name}" /></li>
</ui:repeat>
</ul>
</h:column>
<h:column>
<h:link outcome="/pages/edit" value="#{i18n['sitepage.edit']}">
<f:param name="id" value="#{page.id}" />
</h:link>
</h:column>
</h:dataTable>
</h:form>
</ui:define>
</ui:composition>
</h:body>
......
......@@ -13,7 +13,7 @@
<composite:implementation>
<h:form>
<h:form id="maplist" styleClass="moya_datatable2">
<h:dataTable border="1" id="productListTable" value="#{mapManageView.maps}" var="map">
<h:column>
<f:facet name="header">
......
......@@ -15,7 +15,7 @@
<composite:implementation>
<h:form id="orgrolelist">
<h:form id="orgrolelist" styleClass="moya_datatable2">
<h:dataTable border="1" id="user" value="#{orgRoleDataView.orgRoles}"
var="orgRole">
<h:column>
......
......@@ -12,8 +12,8 @@
<composite:implementation>
<h:form>
<h:dataTable border="1" id="product" value="#{productListView.results}" var="product">
<h:form id="product_list" styleClass="moya_datatable2">
<h:dataTable border="1" id="product" value="#{productListView.results}" styleClass="moya_datatable2" var="product">
<h:column>
<f:facet name="header">
<h:outputText value="${i18n['product.name']}" />
......
......@@ -22,7 +22,7 @@ xmlns:reader="http://java.sun.com/jsf/composite/cditools/reader"
<composite:implementation>
<h:form id="autopoller">
<h:form id="autopoller" styleClass="moya_datatable2">
<h:panelGroup id="reader_autopoll">
<p:poll rendered="#{readerView.pollingMode}" interval="2" listener="#{cc.attrs.selectaction}" onerror="location.reload();" />
......
......@@ -10,9 +10,9 @@
<composite:implementation>
<h:form>
<h:form styleClass="moya_datatable2">
Valitut lukijat, valitse "vaihda lukija" poistaaksesi kaikki
<h3>Valitut lukijat, valitse "vaihda lukija" poistaaksesi kaikki </h3>
<p:dataTable border="1" value="#{readerListDataView.selectedReaders}" var="rr">
<p:column>
<f:facet name="header">
......@@ -22,8 +22,8 @@
</p:column>
</p:dataTable>
Valitse uusi / ensimmäinen lukija
<br />
<h3>Valitse uusi / ensimmäinen lukija</h3>
<p:dataTable border="1" id="reader" value="#{readerListDataView.readers}" var="rr">
<p:column>
<f:facet name="header">
......
......@@ -12,7 +12,7 @@
<composite:implementation>
<h:form id="rolelist" >
<h:form id="rolelist" styleClass="moya_datatable2">
<h:dataTable border="1" id="user" value="#{roleDataView.roles}" var="role">
<h:column>
<f:facet name="header">
......
......@@ -15,10 +15,10 @@
<composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<p:panelGrid columns="3" cellpadding="1" columnClasses="topalign,topalign,topalign" styleClass="noBorders">
<p:panelGrid columns="2" columnClasses="topalign,topalign,topalign" styleClass="noBorders user_profile_page">
<h:form id="userform" enctype="multipart/form-data">
<p:fieldset legend="#{i18n['user.image']}">
<p:panelGrid columns="1" cellpadding="1">
<p:panelGrid columns="1" styleClass="user_image">
<ui:fragment rendered="#{not empty userView.selectedUser.id}">
<p:dialog id="chartPanel" for="webcamButton" dynamic="true" widgetVar="webcamDialog">
......@@ -27,6 +27,7 @@
</p:dialog>
<h:outputText rendered="#{empty userView.selectedUser.currentImage}" value="#{i18n['user.noCurrentImage']}" />
<ui:fragment rendered="#{!empty userView.selectedUser.currentImage}">
<img style="width: 150px;" src="#{request.contextPath}/dydata/userimage/#{userView.selectedUser.currentImage.id}.img" alt="image" />
</ui:fragment>
......@@ -34,13 +35,10 @@
<p:commandButton onerror="location.reload(true);" rendered="#{!cc.attrs.camAlwaysOn}" id="webcamButton" value="#{i18n['userimage.webcam']}" onclick="PF('webcamDialog').show()" type="button" />
<br />
<br />
<ui:fragment rendered="#{cc.attrs.camAlwaysOn}">
<p:photoCam widgetVar="pc" listener="#{userView.oncapture}" update="#{cc.attrs.photocamupdate}" />
<p:commandButton type="button" value="Capture" onclick="PF('pc').capture()" onerror="location.reload(true);" update="#{cc.attrs.photocamupdate}" />
</ui:fragment>
&nbsp;
<p:fileUpload id="uploadfile" value="#{userView.image}" mode="simple" required="true" requiredMessage="Required!" invalidSizeMessage="#{i18n['user.imageTooBig']}" sizeLimit="1024" />
<p:message for="uploadfile" />
......@@ -55,24 +53,22 @@
</p:inplace>
<p:message for="login" />
<br />
</ui:fragment>
<br />
<h:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.password']}" for="password" />
<br />
<p:inplace rendered="#{cc.attrs.creating}" emptyLabel="#{i18n['user.insert']}">
<p:password validator="#{userValidator.password}" id="password" value="#{userView.password}" />
</p:inplace>
<p:message rendered="#{cc.attrs.creating}" for="password" />
<br />
<p:outputLabel rendered="#{cc.attrs.creating}" value="#{i18n['user.passwordcheck']}" for="passwordcheck" />
<br />
<p:inplace rendered="#{cc.attrs.creating}" emptyLabel="#{i18n['user.insert']}">
<p:password validator="#{userValidator.password}" id="passwordcheck" value="#{userView.passwordcheck}" />
</p:inplace>
<p:message rendered="#{cc.attrs.creating}" for="passwordcheck" />
<br />
</p:panelGrid>
</p:fieldset>
......@@ -80,7 +76,7 @@
<h:form>
<p:fieldset legend="#{i18n['user.edit']}">
<p:panelGrid columns="3" styleClass="noBorders">
<p:panelGrid columns="3" styleClass="noBorders user_edit">
<p:outputLabel value="#{i18n['user.login']}" />
<h:outputText size="25" value="#{userView.selectedUser.login}" id="login" />
<h:message for="login" />
......@@ -170,25 +166,28 @@
</p:fieldset>
</h:form>
</ui:fragment>
</p:panelGrid>
<p:panelGrid>
<h:form id="userSelectableRoles">
<p:fieldset legend="#{i18n['user.userSelectableRoles']}" rendered="#{userView.showUserSelectableRoles and cc.attrs.showRoles}">
<p:panelGrid columns="2" styleClass="noBorders">
<p:selectManyCheckbox converter="#{roleConverter}" layout="pageDirection" value="#{userView.userSelectableRoles}">
<f:selectItems value="#{roleDataView.userSelectableRoles}" var="roleitem" itemLabel="#{roleitem.name}" itemValue="#{roleitem}" />
</p:selectManyCheckbox>
<div>
<h:message rendered="#{roleView.canReadRoles}" for="roles" />
</div>
</p:panelGrid>
<p:commandButton action="#{userView.saveUserSelectableRoles}" value="#{i18n['user.saveUserSelectableRoles']}" />
</p:fieldset>
<p:panelGrid columns="2" styleClass="noBorders">
<p:selectManyCheckbox converter="#{roleConverter}" layout="pageDirection" value="#{userView.userSelectableRoles}">
<f:selectItems value="#{roleDataView.userSelectableRoles}" var="roleitem" itemLabel="#{roleitem.name}" itemValue="#{roleitem}" />
</p:selectManyCheckbox>
<div>
<h:message rendered="#{roleView.canReadRoles}" for="roles" />
</div>
</p:panelGrid>
<p:commandButton action="#{userView.saveUserSelectableRoles}" value="#{i18n['user.saveUserSelectableRoles']}" />
</p:fieldset>
</h:form>
</p:panelGrid>
</composite:implementation>
</html>
......@@ -10,7 +10,7 @@
<p:dataTable styleClass="bordertable" id="usertable" value="#{userSearchView.eventuserModel}" rows="100" paginator="true" lazy="true" var="user">
<p:dataTable styleClass="bordertable moya_datatable4" id="usertable" value="#{userSearchView.eventuserModel}" rows="100" paginator="true" lazy="true" var="user">
<p:column headerText="#{i18n['user.nick']}" sortBy="#{user.nick}">
<h:outputText styleClass="hoverable" value="#{(empty user.nick)?'----':user.nick}" />
......
......@@ -9,7 +9,7 @@
<composite:implementation>
<h:outputScript library="primefaces" name="jquery/jquery.js" target="head" />
<p:dataTable id="user" value="#{userSearchView.userModel}" rows="100" var="wra" paginator="true" lazy="true">
<p:dataTable id="user" value="#{userSearchView.userModel}" styleClass="moya_datatable4" rows="100" var="wra" paginator="true" lazy="true">
<p:column sortBy="#{wra.user.nick}" headerText="#{i18n['user.nick']}">
<h:outputText value="#{(empty wra.user.nick)?'----':wra.user.nick}" />
......
@media print {
header#top { display: none; }
#left-bar { display: none; }
}
\ No newline at end of file
......@@ -291,7 +291,8 @@ input, textarea, .ui-inputfield, select {
textarea {
border-radius: 5px;
}
input[type=text] {
input[type=text],
input[type=password]{
border-radius: 5px;
margin: 0 5px 0 0 !important;
min-height: 30px;
......@@ -393,6 +394,7 @@ HEADER
background: #70cbc3;
text-align: center;
height: 101px;
line-height: 101px;
}
#header_first a {
display: table;
......@@ -400,6 +402,9 @@ HEADER
height: 100%;
width: 100%;
}
#header_first a img {
vertica-align: middle;
}
#header_first a h1 {
text-decoration: none;
color: #FFF;
......@@ -614,6 +619,13 @@ USER MODE AND LOGIN
text-align: center;
line-height: 100px;
}
.user_profile_page table.user_edit td {
vertical-align: top;
min-height: 40px;
}
.user_profile_page table.user_edit td label {
text-transform: capitalize;
}
/*
......@@ -801,9 +813,6 @@ The Grid For Content
Table Styles
*/
#main table {
width: 100%;
}
#main table.ui-panelgrid {
background: none;
border-bottom: 0;
......@@ -846,7 +855,7 @@ Table Styles
width: 100%;
}
#main .ui-menu {
background: #70cbc3;
background: #263238;
}
#main .ui-menu ul.ui-menu-list li a {
color: #FFF;
......@@ -879,11 +888,43 @@ Table Styles
margin: 0 5px;
}
#advancedSearch {
padding: 25px;
background: #eeE;
margin: 10px 0;
}
/*
TABLE STYLES
*/
#main .useradmin_list table td a {
margin: 0 0 10px 0;
background: #70cbc3;
color: #FFF;
padding: 10px;
display: inline-block;
cursor: pointer;
}
.changePassword table td {
padding: 5px 0;
}
#main #networkassociation\:ip_mac_address tr:first-child td {
border: 0 !important;
font-weight: 800;
}
#main .moya_datatable1 table,
#main .moya_datatable2 table,
#main .moya_datatable3 table,
#main .moya_datatable4 table,
#main .moya_datatable5 table,
#main .moya_datatable6 table{
width: 100%;
}
#main .moya_datatable1 tr,
#main .moya_datatable1 table tr {
margin-bottom: 10px;
......@@ -994,4 +1035,121 @@ TABLE STYLES
#main .moya_datatable3 tfoot td:last-child {
font-weight: 800 !important;
color: #000 !important;
}
#main .moya_datatable4 table table td {
border: 0 !important;
}
#main .moya_datatable4 table thead th {
background: #70cbc3;
color: #FFF;
}
#main .moya_datatable4 table tr {
margin: 5px 0 !important;
padding: 5px 0 !important;
}
#main .moya_datatable4 table td {
padding: 10px !important;
border-bottom: 1px solid #eee !important;
border-right: 1px solid #ccc !important;
}
#main .moya_datatable4 table td:last-child {
border-right: 0 !important;
}
#main .moya_datatable4 table tr:nth-child(even) {
background: #f9f9f9;
}
#main .moya_datatable4 table input {
min-height: 20px !important;
border-radius:3px;
margin: 0 3px !important;
padding: 5px 10px !important;
}
#main .moya_datatable4 table thead th {
padding: 10px !important;
}
#main .moya_datatable4 tfoot td {
border: 0 !important;
color: #000;
font-weight: 300 !important;
padding: 10px !important;
}
#main .moya_datatable4 tfoot td:last-child {
font-weight: 800 !important;
color: #000 !important;
}
#main .moya_datatable4 .ui-paginator {
min-height: 30px;
}
#main .moya_datatable4 .ui-paginator span.ui-icon {
margin: 5px;
height: 16px;
width: 16px;
}
#main .moya_datatable4 .ui-paginator .ui-paginator-page {
margin: 0 5px;
}
#main .moya_datatable4 table td a,
#main .moya_datatable4 table td button {
background: #70cbc3;
color: #FFF;
border: 0;
cursor: pointer;
padding: 7px 10px;
transition: background 0.3s ease-in-out;
}
#main .moya_datatable4 table td a:hover,
#main .moya_datatable4 table td button:hover {
background: #555;
}
#main .moya_datatable6 table table td {
border: 0 !important;
}
#main .moya_datatable6 table thead th {
background: #70cbc3;
color: #FFF;
}
#main .moya_datatable6 table tr {
margin: 5px 0 !important;
padding: 5px 0 !important;
}
#main .moya_datatable6 table td {
padding: 10px !important;
border-bottom: 1px solid #eee !important;
border-right: 1px solid #ccc !important;
}
#main .moya_datatable6 table td:last-child {
border-right: 0 !important;
}
#main .moya_datatable6 table tr:nth-child(even) {
background: #f9f9f9;
}
#main .moya_datatable6 table input {
min-height: 20px !important;
border-radius:3px;
margin: 0 3px !important;
padding: 5px 10px !important;
}
#main .moya_datatable6 table thead th {
padding: 10px !important;
}
#main .moya_datatable6 tfoot td {
border: 0 !important;
color: #000;
font-weight: 300 !important;
padding: 10px !important;
}
#main .moya_datatable6 tfoot td:last-child {
font-weight: 800 !important;
color: #000 !important;
}
#main .moya_datatable6 .ui-widget-header {
color: #FFF;
text-shadow: 0 0 0;
}
#main .moya_datatable2 table td button span {
padding: 7px 10px !important;
font-size: 12px;
}
\ No newline at end of file
......@@ -7,11 +7,16 @@ $ = jQuery;
$(document).ready(function() {
$('#open-user-login').click(function() {
$('#not-logged').slideToggle(300);
$(this).toggleClass('active');
$('#not-logged').slideToggle(300);
$(this).toggleClass('active');
});
$('#toggle-navigation').click(function() {
$('#left-bar').slideToggle(300);
});
$('#show_advanced_search').click(function() {
$('#advancedSearch').slideToggle(300);
});
});
\ No newline at end of file
......@@ -48,7 +48,7 @@
<h:link outcome="/index">
<c:choose>
<c:when test="#{sessionHandler.isInDevelopmentMode()}">
<h1>Development</h1>
<img src="#{request.contextPath}/resources/templates/moyav2/img/dev_logo.png" alt="Development" />
</c:when>
<c:otherwise>
<p:graphicImage rendered="#{layoutView.headerIsImage}" value="#{layoutView.headerimage}" />
......
......@@ -12,7 +12,7 @@
<h1>#{i18n['tournaments.admin.title']}</h1>
<p>#{i18n['tournaments.admin.description']}</p>
<h2>#{i18n['tournaments.active_tournaments']}</h2>
<h:form>
<h:form id="tournamentsadmin" styleClass="moya_datatable2">
<p:dataTable value="#{tournamentAdminView.activeTournaments}" var="tournament">
<p:column>
<f:facet name="header">
......
......@@ -11,12 +11,12 @@
</f:metadata>
<ui:define name="content">
<h:form>
<h:form id="tournaments" styleClass="moya_datatable2">
<p:messages autoUpdate="true" redisplay="false"></p:messages>
<h1>#{i18n['tournaments.title']}</h1>
<p>#{i18n['tournaments.description']}</p>
<h2>#{i18n['tournaments.open_tournaments']}</h2>
<p:dataTable value="#{tournamentListView.setupPhaseTournaments}" var="tournament">
<p:dataTable value="#{tournamentListView.setupPhaseTournaments}" var="tournament" styleClass="moya_datatable2">
<p:column style="width:20px">
<p:rowToggler />
......@@ -95,8 +95,9 @@
</h:panelGrid>
</p:rowExpansion>
</p:dataTable>
<p></p>
<h2>#{i18n['tournaments.setup_closed_tournaments']}</h2>
<p:dataTable value="#{tournamentListView.setupClosedPhaseTournaments}" var="tournament">
<p:dataTable value="#{tournamentListView.setupClosedPhaseTournaments}" var="tournament" styleClass="moya_datatable2">>
<p:column style="width:20px">
<p:rowToggler />
</p:column>
......
......@@ -11,7 +11,7 @@
<ui:define name="content">
<h1>#{i18n['tournament.my_participations']}</h1>
<h:form>
<p:dataTable value="#{tournamentEditParticipationView.ownParticipations}" var="participation">
<p:dataTable value="#{tournamentEditParticipationView.ownParticipations}" var="participation" styleClass="moya_datatable2">>
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.name']}" />
......
......@@ -16,14 +16,14 @@
</ui:define>
<ui:define name="content">
<h:form id="userform">
<h:form id="user_change_password" styleClass="changePassword">
<h:panelGrid columns="2">
<h:outputLabel for="oldPwd" value="#{i18n['user.oldPassword']}:" />
<h:inputSecret id="oldPwd" value="#{passwordView.oldPassword}" />
<h:outputLabel value="#{i18n['user.password']}:" />
<h:inputSecret id="password" value="#{passwordView.password}" />
<h:outputLabel value="#{i18n['user.passwordcheck']}:" />
<h:inputSecret id="passwordcheck" value="#{passwordView.passwordcheck}" />
......
......@@ -16,7 +16,7 @@
<h:form>
<p:messages autoUpdate="true" redisplay="false"></p:messages>
<h2>#{i18n['user.game.current_gameids']}</h2>
<p:dataTable value="#{userGameIDView.eventUser.gameIDs}" var="gameid">
<p:dataTable value="#{userGameIDView.eventUser.gameIDs}" var="gameid" styleClass="moya_datatable2">
<p:column>
<f:facet name="header">
<h:outputText value="#{i18n['tournament.game']}" />
......
......@@ -19,25 +19,24 @@
<h1>#{i18n['userlist.header']}</h1>
<h:form id="pageform">
<h:form styleClass="useradmin_list">
<h:panelGrid columns="2">
<h:panelGroup>
<a onclick="$('#advancedSearch').show(); $(this).hide();"><h:outputText value="#{i18n['userlist.showAdvancedSearch']}" /></a>
<a id="show_advanced_search"><h:outputText value="#{i18n['userlist.showAdvancedSearch']}" /></a>
<div id="advancedSearch" style="display: none;">
<h:selectBooleanCheckbox id="placeassoc" value="#{userSearchView.searchQuery.placeAssoc}" />
<h:outputLabel for="placeassoc" value="#{i18n['userlist.placeassoc']}" />
<br />
<h:outputLabel for="saldofilter" value="#{i18n['userlist.saldofilter']}" />
<h:selectOneMenu value="#{userSearchView.searchQuery.accountSaldoCompare}">
<f:selectItems value="#{userSearchView.searchQuery.accountCompareValues}" />
</h:selectOneMenu>
<h:inputText value="#{userSearchView.searchQuery.accountSaldo}">
<f:convertNumber minFractionDigits="0" maxFractionDigits="2" />
</h:inputText>
</h:inputText>
<br /><br />
<!--
<br />
<h:outputLabel for="rolefilter" value="#{i18n['userlist.rolefilter']}" />
......@@ -45,9 +44,8 @@
value="#{userSearchView.searchQuery.filterRoles}" converter="#{roleConverter}">
</h:inputText>
-->
<br />
<h:outputLabel for="rolefilter" value="#{i18n['userlist.rolefilter']}" />
<strong><h:outputLabel for="rolefilter" value="#{i18n['userlist.rolefilter']}" /></strong><br />
<h:selectManyCheckbox layout="pageDirection" styleClass="nowrap" id="rolefilter" value="#{userSearchView.searchQuery.filterRoles}" converter="#{roleConverter}">
<f:selectItems value="#{roleDataView.roles}" var="r" itemLabel="#{r.name}" />
</h:selectManyCheckbox>
......@@ -72,7 +70,7 @@
<h:commandButton value="#{i18n['userlist.search']}" action="#{userSearchView.newSearch()}" />
</h:panelGroup>
<h:panelGroup>
<a onclick="$('#pageform\\:usercart').show(); $(this).hide();"><h:outputText value="#{i18n['usercart.showCart']}" /></a>
<a id="show_user_cart" onclick="$('#pageform\\:usercart').slideToggle(300);"><h:outputText value="#{i18n['usercart.showCart']}" /></a>
<p:panelGrid columns="1" id="usercart" styleClass="noborderTable" style="display:none;">
<h:commandButton actionListener="#{userSearchView.addToCart}" value="#{i18n['usercart.addSearchedUsers']}" />
......
......@@ -13,7 +13,7 @@
<f:event type="preRenderView" listener="#{cardView.initCardTemplatelist()}" />
</f:metadata>
<ui:define name="content">
<h:form id="cardTemplates">
<h:form id="cardTemplates" styleClass="moya_datatable2">
<h:dataTable value="#{cardView.cardTemplates}" var="card">
<h:column>
#{card.id}
......
......@@ -10,11 +10,11 @@
<f:event type="preRenderView" listener="#{compoView.initAdminListView()}" />
</f:metadata>
<ui:define name="content">
<h:outputStylesheet library="style" name="insomnia2/css/actionlog.css" />
<h:form id="admincompolist" styleClass="moya_datatable2">
<h1>#{i18n['voting.allcompos.header']}</h1>
<p>#{i18n['voting.allcompos.description']}</p>
<h:form>
<p:dataTable styleClass="bordertable" rowClasses="roweven,rowodd" id="compolisttable" value="#{compoView.compos}" var="compo">
<p:column headerText="#{i18n['voting.allcompos.name']}">
<h:outputText value="#{compo.name}" />
......
......@@ -12,7 +12,7 @@
<configuration>
<warSourceDirectory>WebContent</warSourceDirectory>
<failOnMissingWebXml>false</failOnMissingWebXml>
<packagingIncludes>WEB-INF/lib/swagger*,WEB-INF/lib/moya-restpojo*,WEB-INF/lib/javamelody-core*,WEB-INF/lib/primefaces*,WEB-INF/lib/*-1.0.8.jar,**/*.xml,**/*.xhtml,**/*.properties,**/*.class,**/*.png,**/*.css,**/*.js,resources/*</packagingIncludes>
<packagingIncludes>WEB-INF/lib/moya-restpojo*,WEB-INF/lib/javamelody-core*,WEB-INF/lib/primefaces*,WEB-INF/lib/*-1.0.8.jar,**/*.xml,**/*.xhtml,**/*.properties,**/*.class,**/*.png,**/*.css,**/*.js,resources/*</packagingIncludes>
</configuration>
</plugin>
</plugins>
......@@ -41,31 +41,20 @@
<version>1.0.8</version>
<type>pom</type>
</dependency>
<dependency>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-restpojo</artifactId>
<version>1.0.2</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-servlet_2.11</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-annotations</artifactId>
<version>${swagger.version}</version>
</dependency>
<dependency>
<groupId>com.wordnik</groupId>
<artifactId>swagger-jaxrs_2.11</artifactId>
<version>${swagger.version}</version>
<version>1.0.5</version>
</dependency>
</dependencies>
<parent>
<groupId>fi.codecrew.moya</groupId>
<artifactId>moya-parent</artifactId>
<version>1.0</version>
<relativePath>../moya-parent/pom.xml</relativePath>
</parent>
</project>
......@@ -19,9 +19,8 @@
package fi.codecrew.moya;
import java.io.IOException;
import java.io.PrintWriter;
import java.security.Principal;
import java.nio.charset.Charset;
import java.security.Principal;
import javax.ejb.EJB;
import javax.faces.application.ProjectStage;
......@@ -35,8 +34,8 @@ import javax.servlet.ServletResponse;
import javax.servlet.annotation.WebFilter;
import javax.servlet.http.HttpServletRequest;
import javax.servlet.http.HttpServletResponse;
import javax.servlet.http.HttpSession;
import org.apache.http.HttpRequest;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
import org.slf4j.MDC;
......@@ -53,6 +52,7 @@ import fi.codecrew.moya.rest.RestApplicationEntrypoint;
@WebFilter(filterName = "hostnameFilter", displayName = "hostname and authentication filter", urlPatterns = { "/*" })
public class HostnameFilter implements Filter {
private static final String SESSION_HOSTNAMESTORE = "moya-session-hostname";
private static final Logger logger = LoggerFactory.getLogger(HostnameFilter.class);
private static final String HTTP_HOSTNAME_ID = "moya_hostname_session_id";
private boolean developmentMode = false;
......@@ -137,7 +137,7 @@ public class HostnameFilter implements Filter {
*/
private static final String[] NOAUTH_RESTPATHS = new String[] {
"/reader/EventRole/","/user/auth"
"/reader/EventRole/", "/user/auth"
};
......@@ -147,6 +147,7 @@ public class HostnameFilter implements Filter {
// logger.info("HostnameFilter called!");
HttpServletRequest httpRequest = null;
AuthType authtype = AuthType.UNKNOWN;
if (request != null && request instanceof HttpServletRequest) {
httpRequest = ((HttpServletRequest) request);
parseHostname(httpRequest);
......@@ -208,7 +209,6 @@ public class HostnameFilter implements Filter {
private boolean restAuth(HttpServletRequest httpRequest, ServletResponse response) {
String sp = httpRequest.getPathInfo();
for (String s : NOAUTH_RESTPATHS) {
if (sp.startsWith(s)) {
......@@ -274,9 +274,16 @@ public class HostnameFilter implements Filter {
boolean ssl = proto.equals("https");
BortalLocalContextHolder.setSsl(ssl);
HttpSession session = httpRequest.getSession();
Object sessionHostname = session.getAttribute(SESSION_HOSTNAMESTORE);
if (sessionHostname == null) {
session.setAttribute(SESSION_HOSTNAMESTORE, hostname);
} else if (!hostname.equals(sessionHostname)) {
throw new RuntimeException("Hostname mismatch!");
}
BortalLocalContextHolder.setHostname(hostname);
BortalLocalContextHolder.setInDevelopmentMode(developmentMode);
}
}
......@@ -8,6 +8,7 @@ import javax.xml.bind.annotation.XmlElement;
import fi.codecrew.moya.model.EventMap;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.GroupMembership;
import fi.codecrew.moya.model.Place;
import fi.codecrew.moya.model.PrintedCard;
import fi.codecrew.moya.model.Product;
......@@ -27,6 +28,7 @@ import fi.codecrew.moya.rest.pojo.userinfo.v1.CardRoot;
import fi.codecrew.moya.rest.pojo.userinfo.v1.EventUserRestPojo;
import fi.codecrew.moya.rest.pojo.userinfo.v1.PrintedCardRestPojo;
import fi.codecrew.moya.rest.pojo.userinfo.v1.SimpleEventuserRoot;
import fi.codecrew.moya.rest.pojo.userinfo.v1.UserReservationPlacePojo;
public class PojoUtils {
public static EventUserRestPojo initEventUserRestPojo(EventUser user)
......@@ -275,4 +277,18 @@ public class PojoUtils {
ret.setHeight(map.getHeight());
return ret;
}
public static UserReservationPlacePojo initUserReservationPlace(GroupMembership g) {
UserReservationPlacePojo ur = new UserReservationPlacePojo();
ur.setPlacegiven(g.getEnteredEvent() != null);
Place place = g.getPlaceReservation();
if (place != null) {
ur.setPlaceid(place.getId());
ur.setPlacename(place.getName());
ur.setProductId(place.getProduct().getId());
ur.setProductName(place.getProduct().getName());
}
return ur;
}
}
......@@ -48,11 +48,15 @@ import com.wordnik.swagger.annotations.ApiOperation;
import com.wordnik.swagger.annotations.ApiParam;
import fi.codecrew.moya.beans.CardTemplateBeanLocal;
import fi.codecrew.moya.beans.EventBeanLocal;
import fi.codecrew.moya.beans.PermissionBeanLocal;
import fi.codecrew.moya.beans.PlaceGroupBeanLocal;
import fi.codecrew.moya.beans.ReaderBeanLocal;
import fi.codecrew.moya.beans.TicketBeanLocal;
import fi.codecrew.moya.beans.UserBeanLocal;
import fi.codecrew.moya.model.EventUser;
import fi.codecrew.moya.model.GroupMembership;
import fi.codecrew.moya.model.ReaderEvent;
import fi.codecrew.moya.rest.pojo.userinfo.v1.EventUserRestPojo;
import fi.codecrew.moya.rest.pojo.userinfo.v1.PrintedCardRestPojo;
import fi.codecrew.moya.rest.pojo.userinfo.v1.SimpleEventuserRoot;
......@@ -86,19 +90,47 @@ public class UserRestView {
@EJB
private PlaceGroupBeanLocal placegroupbean;
@EJB
private ReaderBeanLocal readerbean;
@EJB
private TicketBeanLocal ticketbean;
@GET
@Path("/reservationswithcode/{code}")
public Response getPlacesWithCode(@PathParam("code") String code) {
EventUser curruser = permbean.getCurrentUser();
ReaderEvent revent = readerbean.checkCode("restapi: " + curruser.getLogin(), code);
if (revent != null && revent.getUser() != null) {
EventUser eu = revent.getUser();
List<GroupMembership> gms = ticketbean.findMembershipPrintlistForUser(eu);
UserReservationRoot ret = new UserReservationRoot();
ret.setUser(PojoUtils.initEventUserRestPojo(eu));
for (GroupMembership g : gms) {
ret.getReservations().add(PojoUtils.initUserReservationPlace(g));
}
return Response.ok(ret).build();
}
return Response.status(Status.NOT_FOUND).build();
}
@GET
@Path("/{userid}/reservations")
public Response usersPlaces(@QueryParam("userid") Integer userid) {
public Response usersPlaces(@PathParam("userid") Integer userid) {
EventUser eu = userbean.findByUserId(userid, false);
if (eu != null) {
List<GroupMembership> gms = placegroupbean.getMemberships(eu);
List<GroupMembership> gms = ticketbean.findMembershipPrintlistForUser(eu);
UserReservationRoot ret = new UserReservationRoot();
ret.setUser(PojoUtils.initEventUserRestPojo(eu));
for (GroupMembership g : gms) {
UserReservationPlacePojo ur = new UserReservationPlacePojo();
ur.setPlaceid(g.getPlaceReservation().getId());
ur.setPlacegiven(g.getEnteredEvent() != null);
ur.setPlacename(g.getPlaceReservation().getName());
ret.getReservations().add(ur);
ret.getReservations().add(PojoUtils.initUserReservationPlace(g));
}
return Response.ok(ret).build();
}
......
No preview for this file type
This diff could not be displayed because it is too large.
This diff could not be displayed because it is too large.
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!