Commit 60f22e51 authored by trang.nguyen's avatar trang.nguyen

Initial commit

parent 73611dcc
......@@ -21,7 +21,8 @@
<groupId>org.hibernate.ogm</groupId>
<artifactId>hibernate-ogm-neo4j</artifactId>
<version>5.4.1.Final</version>
</dependency>
</dependency>
</dependencies>
<build>
......
......@@ -4,11 +4,12 @@ import java.io.Serializable;
import java.util.ResourceBundle;
import java.util.logging.Level;
import java.util.logging.Logger;
import javax.inject.Inject;
import javax.annotation.PostConstruct;
import javax.faces.application.FacesMessage;
import javax.faces.context.FacesContext;
import javax.faces.view.ViewScoped;
import javax.inject.Inject;
import javax.inject.Named;
import de.dpunkt.myaktion.model.Donation;
......@@ -85,4 +86,5 @@ public class DonateMoneyController implements Serializable {
return Pages.DONATE_MONEY;
}
}
\ No newline at end of file
package de.dpunkt.myaktion.controller;
import de.dpunkt.myaktion.data.CampaignProducer;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.List;
@SessionScoped
@Named
public class EditDonationFormController implements Serializable {
private static final long serialVersionUID = -4210085664588144340L;
private String textColor = "000000";
private String bgColor = "ffffff";
private static final long serialVersionUID = -4210085664588144340L;
private String textColor = "000000";
private String bgColor = "ffffff";
@Inject
private CampaignProducer campaignProducer;
@Inject
private CampaignProducer campaignProducer;
@Inject
EntityManager entityManager;
public String doOk() {
return Pages.LIST_CAMPAIGNS;
}
public String doOk() {
return Pages.LIST_CAMPAIGNS;
}
@Inject
private HttpServletRequest req;
private String getAppUrl() {
String scheme = req.getScheme();
String serverName = req.getServerName();
int serverPort = req.getServerPort();
String contextPath = req.getContextPath();
return scheme+"://"+serverName+":"+serverPort+contextPath;
}
public String getUrl() {
return getAppUrl() + "/" + Pages.DONATE_MONEY + ".jsf" + "?bgColor="
+ bgColor + "&textColor=" + textColor + "&campaignId="
+ campaignProducer.getSelectedCampaign().getId();
}
@Inject
private HttpServletRequest req;
private String getAppUrl() {
String scheme = req.getScheme();
String serverName = req.getServerName();
int serverPort = req.getServerPort();
String contextPath = req.getContextPath();
return scheme + "://" + serverName + ":" + serverPort + contextPath;
}
public String getUrl() {
return getAppUrl() + "/" + Pages.DONATE_MONEY + ".jsf" + "?bgColor=" + bgColor + "&textColor=" + textColor
+ "&campaignId=" + campaignProducer.getSelectedCampaign().getId();
}
public String getAnotherUrl() {
Long idOfThisCampaign = campaignProducer.getSelectedCampaign().getId();
TypedQuery <Long> query = entityManager.createQuery("SELECT c.id FROM Campaign c", Long.class);
List<Long> campaigns = query.getResultList();
for ( Long thisId : campaigns) {
if (thisId != idOfThisCampaign) {
campaignProducer.getAnotherSelectedCampaign().setId(thisId);
}
}
return getAppUrl() + "/" + Pages.DONATE_MONEY + ".jsf" + "?bgColor="
+ bgColor + "&textColor=" + textColor + "&campaignId="
+ campaignProducer.getAnotherSelectedCampaign().getId();
//campaigns.forEach(Campaign -> Campaign.setAmountDonatedSoFar(getAmountDonatedSoFar(Campaign)));
//return getAppUrl() + "/" + Pages.DONATE_MONEY + ".jsf" + "?bgColor="
//+ bgColor + "&textColor=" + textColor + "&campaignId=";
// + campaignService.findID(Campaign);
}
public String getTextColor() {
return textColor;
......
package de.dpunkt.myaktion.controller;
import de.dpunkt.myaktion.data.CampaignProducer;
import javax.enterprise.context.SessionScoped;
import javax.inject.Inject;
import javax.inject.Named;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import javax.servlet.http.HttpServletRequest;
import java.io.Serializable;
import java.util.List;
@SessionScoped
@Named
public class EditDonationMoreFormController implements Serializable {
private static final long serialVersionUID = -4210085664588144340L;
private String textColor = "000000";
private String bgColor = "ffffff";
@Inject
private CampaignProducer campaignProducer;
@Inject
EntityManager entityManager;
public String doOk() {
return Pages.LIST_CAMPAIGNS;
}
@Inject
private HttpServletRequest req;
private String getAppUrl() {
String scheme = req.getScheme();
String serverName = req.getServerName();
int serverPort = req.getServerPort();
String contextPath = req.getContextPath();
return scheme + "://" + serverName + ":" + serverPort + contextPath;
}
public String getUrl() {
Long idOfThisCampaign = campaignProducer.getSelectedCampaign().getId();
TypedQuery <Long> query = entityManager.createQuery("MATCH (n:Campaign) RETURN n.id", Long.class);
// TypedQuery <Long> query = entityManager.createQuery("SELECT c.id FROM Campaign c", Long.class);
List<Long> campaigns = query.getResultList();
for ( Long thisId : campaigns) {
if (thisId != idOfThisCampaign) {
campaignProducer.getAnotherSelectedCampaign().setId(thisId);
}
}
return getAppUrl() + "/" + Pages.DONATE_MONEY + ".jsf" + "?bgColor="
+ bgColor + "&textColor=" + textColor + "&campaignId="
+ campaignProducer.getAnotherSelectedCampaign().getId();
//campaigns.forEach(Campaign -> Campaign.setAmountDonatedSoFar(getAmountDonatedSoFar(Campaign)));
//return getAppUrl() + "/" + Pages.DONATE_MONEY + ".jsf" + "?bgColor="
//+ bgColor + "&textColor=" + textColor + "&campaignId=";
// + campaignService.findID(Campaign);
}
public String getTextColor() {
return textColor;
}
public void setTextColor(String textColor) {
this.textColor = textColor;
}
public String getBgColor() {
return bgColor;
}
public void setBgColor(String bgColor) {
this.bgColor = bgColor;
}
}
\ No newline at end of file
......@@ -23,11 +23,14 @@ public class CampaignProducer implements Serializable {
public Campaign getSelectedCampaign() {
return campaign;
}
public Campaign getAnotherSelectedCampaign() {
return campaign;
}
public void setSelectedCampaign(Campaign campaign) {
this.campaign = campaign;
}
@Produces
@Named
public boolean isAddMode() {
......@@ -43,4 +46,5 @@ public class CampaignProducer implements Serializable {
this.campaign = campaign;
this.mode = Mode.EDIT;
}
}
\ No newline at end of file
......@@ -2,6 +2,7 @@ package de.dpunkt.myaktion.model;
import java.math.BigDecimal;
import java.util.List;
import javax.persistence.AttributeOverride;
import javax.persistence.AttributeOverrides;
import javax.persistence.CascadeType;
......@@ -22,12 +23,14 @@ import javax.validation.constraints.Size;
@NamedQueries({
@NamedQuery(name = Campaign.findByOrganizer, query = "SELECT c FROM Campaign c WHERE c.organizer = :organizer ORDER BY c.name"),
@NamedQuery(name = Campaign.findAll, query = "SELECT c FROM Campaign c ORDER BY c.name"),
@NamedQuery(name = Campaign.getAmountDonatedSoFar, query = "SELECT SUM(d.amount) FROM Donation d WHERE d.campaign = :campaign") })
@NamedQuery(name = Campaign.getAmountDonatedSoFar, query = "SELECT SUM(d.amount) FROM Donation d WHERE d.campaign = :campaign"),
@NamedQuery(name= Campaign.findID, query = "SELECT c.id FROM Campaign c") })
@Entity
public class Campaign {
public static final String findByOrganizer = "Campaign.findByOrganizer";
public static final String findAll = "Campaign.findAll";
public static final String getAmountDonatedSoFar = "Campaign.getAmountDonatedSoFar";
public static final String findID = "Campaign.findID";
@Size(min = 4, max = 30, message = "Der Name einer Aktion muss min. 4 und darf max.30 Zeichen lang sein.")
private String name;
......@@ -122,4 +125,6 @@ public class Campaign {
public void setOrganizer(Organizer organizer) {
this.organizer = organizer;
}
}
\ No newline at end of file
......@@ -8,6 +8,9 @@ import javax.inject.Inject;
import javax.persistence.EntityManager;
import javax.persistence.TypedQuery;
import de.dpunkt.myaktion.data.CampaignProducer;
import de.dpunkt.myaktion.model.Campaign;
@Stateless
......@@ -15,6 +18,8 @@ public class CampaignServiceBean implements CampaignService {
@Inject
EntityManager entityManager;
private CampaignProducer campaignProducer;
@Override
public List<Campaign> getAllCampaigns() {
......@@ -45,4 +50,16 @@ public class CampaignServiceBean implements CampaignService {
result = BigDecimal.ZERO;
return result;
}
public Long getNewId() {
Long idOfThisCampaign = campaignProducer.getSelectedCampaign().getId();
TypedQuery <Long> query = entityManager.createQuery("SELECT c.id FROM Campaign c", Long.class);
List<Long> campaigns = query.getResultList();
for ( Long thisId : campaigns) {
if (thisId != idOfThisCampaign) {
campaignProducer.getAnotherSelectedCampaign().setId(thisId);
}
}
return idOfThisCampaign;
}
}
\ No newline at end of file
......@@ -25,7 +25,13 @@
<properties>
<property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" />
<property name="hibernate.ogm.neo4j.database_path" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-4d88945f-1e6a-41d1-87da-37aa83e85d55" />
<property name="hibernate.ogm.neo4j.database_path" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-bcc1a8bc-7be7-4132-b1d8-fdd9616db804" />
<property name="hibernate.ogm.neo4j.configuration_resource_name" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-bcc1a8bc-7be7-4132-b1d8-fdd9616db804\installation-4.1.0\conf" />
<property name="hibernate.ogm.datastore.host" value="localhost:7687" />
<property name="hibernate.ogm.datastore.username" value="neo4j" />
<property name="hibernate.ogm.datastore.password" value="trang" />
</properties>
</persistence-unit>
</persistence>
......@@ -62,5 +62,6 @@ donateMoney.donation_amount=Spendenbetrag
donateMoney.i_want_a_receipt=Ja, ich möchte eine Spendenquittung
donateMoney.donate=Spenden
donateMoney.thank_you=Vielen Dank für die Spende!
donateMoney.donateMore_money= Unsterstützung für andere Campaign!
donateMoney.donateMore=Spenden Sie auch für noch ein weiteres Campagin!
log.donateMoney.thank_you={0} hat {1} Euro gespendet.
\ No newline at end of file
......@@ -61,5 +61,6 @@ donateMoney.donation_amount=Donation amount
donateMoney.i_want_a_receipt=Yes, I would like a donation receipt
donateMoney.donate=Donate
donateMoney.thank_you=Thank you for your donation!
donateMoney.donateMore_money= Unsterstützung für andere Campaign!
donateMoney.donateMore=Donate for another Campaign (?)!
log.donateMoney.thank_you={0} has donated {1} Euro.
......@@ -2,11 +2,12 @@
<datasources xmlns="http://www.jboss.org/ironjacamar/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema
http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<datasource jndi-name="java:jboss/datasources/MyAktionDS" pool-name="myaktion" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:file:~/data/myaktion</connection-url>
<connection-url>jdbc:h2:tcp://localhost/~/data/myaktion</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
</datasources>
\ No newline at end of file
......@@ -32,41 +32,48 @@
<h:form>
<h:panelGrid columns="3">
<h:outputLabel value="#{msg['donateMoney.name']}:">
</h:outputLabel>
</h:outputLabel>
<p:inputText id="name"
value="#{donateMoneyController.donation.donorName}">
</p:inputText>
</p:inputText>
<h:message for="name" style="color: red;" />
<h:outputLabel value="#{msg['donateMoney.iban']}:">
</h:outputLabel>
</h:outputLabel>
<p:inputText id="iban"
value="#{donateMoneyController.donation.account.iban}">
</p:inputText>
</p:inputText>
<h:message for="iban" style="color: red;" />
<h:outputLabel value="#{msg['donateMoney.name_of_bank']}:">
</h:outputLabel>
</h:outputLabel>
<p:inputText id="name_bank"
value="#{donateMoneyController.donation.account.nameOfBank}">
</p:inputText>
</p:inputText>
<h:message for="name_bank" style="color: red;" />
<h:outputLabel value="#{msg['donateMoney.donation_amount']}:">
</h:outputLabel>
</h:outputLabel>
<h:panelGroup>
<p:inputText id="donationAmount"
value="#{donateMoneyController.donation.amount}">
<f:convertNumber maxFractionDigits="2"
minFractionDigits="2" />
</p:inputText> EUR
</p:inputText> EUR
</h:panelGroup>
</h:panelGrid>
<p:selectBooleanCheckbox
value="#{donateMoneyController.donation.receiptRequested}" />
#{msg['donateMoney.i_want_a_receipt']}<br />
<p:commandButton value="#{msg['donateMoney.donate']}" ajax="false"
action="#{donateMoneyController.doDonation}" />
<p:selectBooleanCheckbox
value="#{donateMoneyController.donation.receiptRequested}" />
#{msg['donateMoney.i_want_a_receipt']}<br />
<p:commandButton value="#{msg['donateMoney.donate']}" ajax="false"
action="#{donateMoneyController.doDonation}" />
<br />
<h2>#{msg['donateMoney.donateMore_money']}</h2>
<h:outputLabel value="#{msg['donateMoney.donateMore']}:"></h:outputLabel>
<br /> <br />
<h:outputLabel value="#{msg['editDonationForm.form_url']}:"></h:outputLabel>
<br /> <br />
<p:inputTextarea id="url" rows="6" cols="30" readonly="true"
value="#{editDonationMoreFormController.url}" />
</h:form>
</h:body>
</html>
\ No newline at end of file
......@@ -25,7 +25,13 @@
<properties>
<property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" />
<property name="hibernate.ogm.neo4j.database_path" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-4d88945f-1e6a-41d1-87da-37aa83e85d55" />
<property name="hibernate.ogm.neo4j.database_path" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-bcc1a8bc-7be7-4132-b1d8-fdd9616db804" />
<property name="hibernate.ogm.neo4j.configuration_resource_name" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-bcc1a8bc-7be7-4132-b1d8-fdd9616db804\installation-4.1.0\conf" />
<property name="hibernate.ogm.datastore.host" value="localhost:7687" />
<property name="hibernate.ogm.datastore.username" value="neo4j" />
<property name="hibernate.ogm.datastore.password" value="trang" />
</properties>
</persistence-unit>
</persistence>
......@@ -62,5 +62,6 @@ donateMoney.donation_amount=Spendenbetrag
donateMoney.i_want_a_receipt=Ja, ich möchte eine Spendenquittung
donateMoney.donate=Spenden
donateMoney.thank_you=Vielen Dank für die Spende!
donateMoney.donateMore_money= Unsterstützung für andere Campaign!
donateMoney.donateMore=Spenden Sie auch für noch ein weiteres Campagin!
log.donateMoney.thank_you={0} hat {1} Euro gespendet.
\ No newline at end of file
......@@ -61,5 +61,6 @@ donateMoney.donation_amount=Donation amount
donateMoney.i_want_a_receipt=Yes, I would like a donation receipt
donateMoney.donate=Donate
donateMoney.thank_you=Thank you for your donation!
donateMoney.donateMore_money= Unsterstützung für andere Campaign!
donateMoney.donateMore=Donate for another Campaign (?)!
log.donateMoney.thank_you={0} has donated {1} Euro.
#Generated by Maven
#Mon Jul 20 22:22:21 CEST 2020
#Fri Jul 24 11:58:37 CEST 2020
version=0.0.1
groupId=de.dpunkt
artifactId=my-aktion
......@@ -12,6 +12,7 @@ de\dpunkt\myaktion\controller\EditDonationFormController.class
de\dpunkt\myaktion\controller\Pages.class
de\dpunkt\myaktion\util\Events$Added.class
de\dpunkt\myaktion\util\Events$Update.class
de\dpunkt\myaktion\controller\EditDonationMoreFormController.class
de\dpunkt\myaktion\model\Organizer.class
de\dpunkt\myaktion\model\Account.class
de\dpunkt\myaktion\services\DonationServiceBean.class
......
......@@ -14,5 +14,6 @@ C:\Users\Huyen Trang\ESD\maven-projekt\test2\src\main\java\de\dpunkt\myaktion\mo
C:\Users\Huyen Trang\ESD\maven-projekt\test2\src\main\java\de\dpunkt\myaktion\model\Organizer.java
C:\Users\Huyen Trang\ESD\maven-projekt\test2\src\main\java\de\dpunkt\myaktion\services\CampaignServiceBean.java
C:\Users\Huyen Trang\ESD\maven-projekt\test2\src\main\java\de\dpunkt\myaktion\controller\ListCampaignsController.java
C:\Users\Huyen Trang\ESD\maven-projekt\test2\src\main\java\de\dpunkt\myaktion\controller\EditDonationMoreFormController.java
C:\Users\Huyen Trang\ESD\maven-projekt\test2\src\main\java\de\dpunkt\myaktion\controller\DonateMoneyController.java
C:\Users\Huyen Trang\ESD\maven-projekt\test2\src\main\java\de\dpunkt\myaktion\controller\EditCampaignController.java
No preview for this file type
......@@ -25,7 +25,13 @@
<properties>
<property name="hibernate.ogm.datastore.provider" value="neo4j_embedded" />
<property name="hibernate.ogm.neo4j.database_path" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-4d88945f-1e6a-41d1-87da-37aa83e85d55" />
<property name="hibernate.ogm.neo4j.database_path" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-bcc1a8bc-7be7-4132-b1d8-fdd9616db804" />
<property name="hibernate.ogm.neo4j.configuration_resource_name" value="C:\Users\Huyen Trang\.Neo4jDesktop\neo4jDatabases\database-bcc1a8bc-7be7-4132-b1d8-fdd9616db804\installation-4.1.0\conf" />
<property name="hibernate.ogm.datastore.host" value="localhost:7687" />
<property name="hibernate.ogm.datastore.username" value="neo4j" />
<property name="hibernate.ogm.datastore.password" value="trang" />
</properties>
</persistence-unit>
</persistence>
......@@ -62,5 +62,6 @@ donateMoney.donation_amount=Spendenbetrag
donateMoney.i_want_a_receipt=Ja, ich möchte eine Spendenquittung
donateMoney.donate=Spenden
donateMoney.thank_you=Vielen Dank für die Spende!
donateMoney.donateMore_money= Unsterstützung für andere Campaign!
donateMoney.donateMore=Spenden Sie auch für noch ein weiteres Campagin!
log.donateMoney.thank_you={0} hat {1} Euro gespendet.
\ No newline at end of file
......@@ -61,5 +61,6 @@ donateMoney.donation_amount=Donation amount
donateMoney.i_want_a_receipt=Yes, I would like a donation receipt
donateMoney.donate=Donate
donateMoney.thank_you=Thank you for your donation!
donateMoney.donateMore_money= Unsterstützung für andere Campaign!
donateMoney.donateMore=Donate for another Campaign (?)!
log.donateMoney.thank_you={0} has donated {1} Euro.
......@@ -2,11 +2,12 @@
<datasources xmlns="http://www.jboss.org/ironjacamar/schema" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:schemaLocation="http://www.jboss.org/ironjacamar/schema
http://docs.jboss.org/ironjacamar/schema/datasources_1_0.xsd">
<datasource jndi-name="java:jboss/datasources/MyAktionDS" pool-name="myaktion" enabled="true" use-java-context="true">
<connection-url>jdbc:h2:file:~/data/myaktion;DB_CLOSE_ON_EXIT=TRUE;FILE_LOCK=NO</connection-url>
<connection-url>jdbc:h2:tcp://localhost/~/data/myaktion</connection-url>
<driver>h2</driver>
<security>
<user-name>sa</user-name>
<password>sa</password>
</security>
</datasource>
</datasources>
\ No newline at end of file
......@@ -32,41 +32,48 @@
<h:form>
<h:panelGrid columns="3">
<h:outputLabel value="#{msg['donateMoney.name']}:">
</h:outputLabel>
</h:outputLabel>
<p:inputText id="name"
value="#{donateMoneyController.donation.donorName}">
</p:inputText>
</p:inputText>
<h:message for="name" style="color: red;" />
<h:outputLabel value="#{msg['donateMoney.iban']}:">
</h:outputLabel>
</h:outputLabel>
<p:inputText id="iban"
value="#{donateMoneyController.donation.account.iban}">
</p:inputText>
</p:inputText>
<h:message for="iban" style="color: red;" />
<h:outputLabel value="#{msg['donateMoney.name_of_bank']}:">
</h:outputLabel>
</h:outputLabel>
<p:inputText id="name_bank"
value="#{donateMoneyController.donation.account.nameOfBank}">
</p:inputText>
</p:inputText>
<h:message for="name_bank" style="color: red;" />
<h:outputLabel value="#{msg['donateMoney.donation_amount']}:">
</h:outputLabel>
</h:outputLabel>
<h:panelGroup>
<p:inputText id="donationAmount"
value="#{donateMoneyController.donation.amount}">
<f:convertNumber maxFractionDigits="2"
minFractionDigits="2" />
</p:inputText> EUR
</p:inputText> EUR
</h:panelGroup>
</h:panelGrid>
<p:selectBooleanCheckbox
value="#{donateMoneyController.donation.receiptRequested}" />
#{msg['donateMoney.i_want_a_receipt']}<br />
<p:commandButton value="#{msg['donateMoney.donate']}" ajax="false"
action="#{donateMoneyController.doDonation}" />
<p:selectBooleanCheckbox
value="#{donateMoneyController.donation.receiptRequested}" />
#{msg['donateMoney.i_want_a_receipt']}<br />
<p:commandButton value="#{msg['donateMoney.donate']}" ajax="false"
action="#{donateMoneyController.doDonation}" />
<br />
<h2>#{msg['donateMoney.donateMore_money']}</h2>
<h:outputLabel value="#{msg['donateMoney.donateMore']}:"></h:outputLabel>
<br /> <br />
<h:outputLabel value="#{msg['editDonationForm.form_url']}:"></h:outputLabel>
<br /> <br />
<p:inputTextarea id="url" rows="6" cols="30" readonly="true"
value="#{editDonationMoreFormController.url}" />
</h:form>
</h:body>
</html>
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment