Commit 8e02a635 by Tuomas Riihimäki

Remove commons-io dependency from MoyaBeans

1 parent 247ed5cd
...@@ -2,7 +2,6 @@ package fi.codecrew.moya.beans; ...@@ -2,7 +2,6 @@ package fi.codecrew.moya.beans;
import java.io.IOException; import java.io.IOException;
import java.io.InputStream; import java.io.InputStream;
import java.io.StringWriter;
import java.math.BigDecimal; import java.math.BigDecimal;
import java.text.SimpleDateFormat; import java.text.SimpleDateFormat;
import java.util.ArrayList; import java.util.ArrayList;
...@@ -24,7 +23,6 @@ import javax.xml.parsers.DocumentBuilder; ...@@ -24,7 +23,6 @@ import javax.xml.parsers.DocumentBuilder;
import javax.xml.parsers.DocumentBuilderFactory; import javax.xml.parsers.DocumentBuilderFactory;
import javax.xml.parsers.ParserConfigurationException; import javax.xml.parsers.ParserConfigurationException;
import org.apache.commons.io.IOUtils;
import org.apache.http.HttpResponse; import org.apache.http.HttpResponse;
import org.apache.http.NameValuePair; import org.apache.http.NameValuePair;
import org.apache.http.client.entity.UrlEncodedFormEntity; import org.apache.http.client.entity.UrlEncodedFormEntity;
...@@ -192,15 +190,15 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -192,15 +190,15 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
final DefaultHttpClient client = new DefaultHttpClient(); final DefaultHttpClient client = new DefaultHttpClient();
HttpResponse response = client.execute(postRequest); HttpResponse response = client.execute(postRequest);
final StringWriter writer = new StringWriter(); // final StringWriter writer = new StringWriter();
//
// IOUtils.copy(, writer, "UTF8");
//
// final String xmlReturn = writer.toString();
// // logger.info("Got response from checkout.fi msg {}, {} ",
// // response.getStatusLine().getStatusCode(), xmlReturn);
IOUtils.copy(response.getEntity().getContent(), writer, "UTF8"); return parseTokenXml(response.getEntity().getContent());
final String xmlReturn = writer.toString();
// logger.info("Got response from checkout.fi msg {}, {} ",
// response.getStatusLine().getStatusCode(), xmlReturn);
return parseTokenXml(xmlReturn);
} catch (IOException e) { } catch (IOException e) {
logger.warn("Error sending checkout.fi request", e); logger.warn("Error sending checkout.fi request", e);
...@@ -236,7 +234,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -236,7 +234,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
// return ret; // return ret;
// } // }
private static List<CheckoutBank> parseTokenXml(String xmlReturn) { private static List<CheckoutBank> parseTokenXml(InputStream inputStream) {
try { try {
// DOMParser parser = new DOMParser(); // DOMParser parser = new DOMParser();
...@@ -244,9 +242,9 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -244,9 +242,9 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance(); DocumentBuilderFactory dbFactory = DocumentBuilderFactory.newInstance();
DocumentBuilder dBuilder = dbFactory.newDocumentBuilder(); DocumentBuilder dBuilder = dbFactory.newDocumentBuilder();
InputStream xmlstr = IOUtils.toInputStream(xmlReturn); // InputStream xmlstr = IOUtils.toInputStream(inputStream);
Document doc = dBuilder.parse(xmlstr); Document doc = dBuilder.parse(inputStream);
// Document doc = parser.getDocument(); // Document doc = parser.getDocument();
Element root = doc.getDocumentElement(); Element root = doc.getDocumentElement();
root.normalize(); root.normalize();
...@@ -275,7 +273,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal { ...@@ -275,7 +273,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
} }
return retbanks; return retbanks;
} catch (SAXException | IOException | ParserConfigurationException e) { } catch (SAXException | IOException | ParserConfigurationException e) {
logger.warn("Error parsing response from checkout response:" + xmlReturn, e); logger.warn("Error parsing response from checkout response:" + inputStream, e);
} }
return null; return null;
} }
......
...@@ -62,10 +62,5 @@ ...@@ -62,10 +62,5 @@
<artifactId>httpclient</artifactId> <artifactId>httpclient</artifactId>
<version>4.3-beta2</version> <version>4.3-beta2</version>
</dependency> </dependency>
<dependency>
<groupId>commons-io</groupId>
<artifactId>commons-io</artifactId>
<version>2.2</version>
</dependency>
</dependencies> </dependencies>
</project> </project>
\ No newline at end of file
...@@ -44,9 +44,6 @@ ...@@ -44,9 +44,6 @@
<dependent-module archiveName="commons-codec-1.6.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-codec/commons-codec/1.6/commons-codec-1.6.jar"> <dependent-module archiveName="commons-codec-1.6.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-codec/commons-codec/1.6/commons-codec-1.6.jar">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="commons-io-2.2.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-io/commons-io/2.2/commons-io-2.2.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="slf4j-jdk14-1.7.5.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/org/slf4j/slf4j-jdk14/1.7.5/slf4j-jdk14-1.7.5.jar"> <dependent-module archiveName="slf4j-jdk14-1.7.5.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/org/slf4j/slf4j-jdk14/1.7.5/slf4j-jdk14-1.7.5.jar">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
...@@ -56,6 +53,9 @@ ...@@ -56,6 +53,9 @@
<dependent-module archiveName="commons-fileupload-1.3.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar"> <dependent-module archiveName="commons-fileupload-1.3.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-fileupload/commons-fileupload/1.3/commons-fileupload-1.3.jar">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
<dependent-module archiveName="commons-io-2.2.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/commons-io/commons-io/2.2/commons-io-2.2.jar">
<dependency-type>uses</dependency-type>
</dependent-module>
<dependent-module archiveName="sshd-core-0.8.0.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/org/apache/sshd/sshd-core/0.8.0/sshd-core-0.8.0.jar"> <dependent-module archiveName="sshd-core-0.8.0.jar" deploy-path="/lib" handle="module:/classpath/var/M2_REPO/org/apache/sshd/sshd-core/0.8.0/sshd-core-0.8.0.jar">
<dependency-type>uses</dependency-type> <dependency-type>uses</dependency-type>
</dependent-module> </dependent-module>
......
...@@ -11,12 +11,10 @@ ...@@ -11,12 +11,10 @@
<h:outputText rendered="#{billListView.bills.rowCount le 0}" value="#{i18n['bills.noBills']}" /> <h:outputText rendered="#{billListView.bills.rowCount le 0}" value="#{i18n['bills.noBills']}" />
<ui:fragment rendered="#{billListView.canWriteBill}"> <h:form rendered="#{billListView.canWriteBill}">
<!-- koyhan miehen confirmaationappi: --> <p:commandButton ajax="false" action="#{billListView.showPayButtonsAction()}" value="#{i18n['bill.showPayButtons']}" />
<input type="button" class="ui-button ui-button ui-widget ui-state-default ui-corner-all ui-button-text-only" style="padding: 3px;" value="#{i18n['bill.markPaid.show']}" </h:form>
onclick="showMarkPaidButtons();" />
</ui:fragment>
<h:form rendered="#{billListView.bills.rowCount gt 0}"> <h:form rendered="#{billListView.bills.rowCount gt 0}">
...@@ -77,7 +75,7 @@ ...@@ -77,7 +75,7 @@
</h:link> </h:link>
</p:column> </p:column>
<p:column rendered="#{billListView.canWriteBill}"> <p:column rendered="#{billListView.canWriteBill}">
<h:commandButton rendered="#{bill.paidDate == null}" styleClass="markPaidButton" action="#{billListView.markPaid()}" value="#{i18n['bill.markPaid']}"> <h:commandButton rendered="#{bill.paidDate == null and billListView.showPayButtons}" action="#{billListView.markPaid()}" value="#{i18n['bill.markPaid']}">
<f:ajax render="@form" /> <f:ajax render="@form" />
</h:commandButton> </h:commandButton>
<h:outputText rendered="#{bill.paidDate != null}" value="#{i18n['bill.isPaid']}" /> <h:outputText rendered="#{bill.paidDate != null}" value="#{i18n['bill.isPaid']}" />
...@@ -87,13 +85,6 @@ ...@@ -87,13 +85,6 @@
</h:form> </h:form>
<script type="text/javascript">
function showMarkPaidButtons() {
$(".markPaidButton").removeAttr('disabled');
}
$(".markPaidButton").attr('disabled', 'disabled');
</script>
</composite:implementation> </composite:implementation>
</html> </html>
......
<?xml version='1.0' encoding='UTF-8' ?> <?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" <!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd"> "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite" xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:p="http://primefaces.org/ui"> <html xmlns="http://www.w3.org/1999/xhtml" xmlns:h="http://java.sun.com/jsf/html" xmlns:f="http://java.sun.com/jsf/core" xmlns:composite="http://java.sun.com/jsf/composite"
xmlns:ui="http://java.sun.com/jsf/facelets" xmlns:c="http://java.sun.com/jsp/jstl/core" xmlns:tools="http://java.sun.com/jsf/composite/tools" xmlns:p="http://primefaces.org/ui">
<composite:interface> <composite:interface>
...@@ -63,7 +64,7 @@ ...@@ -63,7 +64,7 @@
</p:column> </p:column>
<p:column> <p:column>
<h:outputText value="#{cart.getDiscount(disc.id)}"> <h:outputText value="#{cart.getDiscount(disc.id) * -1}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" /> <f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText> </h:outputText>
</p:column> </p:column>
...@@ -80,12 +81,18 @@ ...@@ -80,12 +81,18 @@
<p:columnGroup type="footer"> <p:columnGroup type="footer">
<p:row> <p:row>
<p:column style="text-align: right;" colspan="4" footerText="#{i18n['productshop.total']}" /> <p:column style="text-align: right;" colspan="4" footerText="#{i18n['productshop.total']}" />
<p:column footerText="#{productShopView.cartPrice}" /> <p:column>
<f:facet name="footer">
<h:outputText value="#{productShopView.cartPrice}">
<f:convertNumber maxFractionDigits="2" minFractionDigits="2" />
</h:outputText>
</f:facet>
</p:column>
</p:row> </p:row>
</p:columnGroup> </p:columnGroup>
</p:dataTable> </p:dataTable>
<br /> <br />
<h:panelGrid columns="3"> <h:panelGrid columns="3">
<h:outputText for="allowStats" value="#{i18n['bill.allowStatistics']}" /> <h:outputText for="allowStats" value="#{i18n['bill.allowStatistics']}" />
......
...@@ -24,13 +24,14 @@ adduser.update = Update profile picture ...@@ -24,13 +24,14 @@ adduser.update = Update profile picture
adduser.welcome = Welcome adduser.welcome = Welcome
adduser.welcometext = Here you can add new user or update your current user profile image. Please select desired action below. adduser.welcometext = Here you can add new user or update your current user profile image. Please select desired action below.
bill.billAmount = Amount bill.billAmount = Amount
bill.billNumber = Number bill.billNumber = Number
bill.cancel = Cancel bill bill.cancel = Cancel bill
bill.expires = Expires bill.expires = Expires
bill.isExpired = Bill is expired bill.isExpired = Bill is expired
bill.markPaid.show = Show Mark paid -buttons bill.markPaid.show = Show Mark paid -buttons
bill.save = Save bill.save = Save
bill.showPayButtons = Show pay buttons
bortalApplication.BILL = Creating, and managing bills bortalApplication.BILL = Creating, and managing bills
bortalApplication.COMPO = Managing compos bortalApplication.COMPO = Managing compos
......
...@@ -87,6 +87,7 @@ bill.referencenumber = Viitenumero ...@@ -87,6 +87,7 @@ bill.referencenumber = Viitenumero
bill.save = Tallenna bill.save = Tallenna
bill.sentDate = P\u00E4iv\u00E4ys bill.sentDate = P\u00E4iv\u00E4ys
bill.show = N\u00E4yt\u00E4 bill.show = N\u00E4yt\u00E4
bill.showPayButtons = N\u00E4yt\u00E4 maksunapit
bill.theirReference = Asiakkaan viite bill.theirReference = Asiakkaan viite
bill.totalPrice = Summa bill.totalPrice = Summa
bill.totalprice = Yhteens\u00E4 bill.totalprice = Yhteens\u00E4
......
...@@ -106,8 +106,8 @@ public class PrimeMenuView extends GenericCDIView { ...@@ -106,8 +106,8 @@ public class PrimeMenuView extends GenericCDIView {
ret = new DefaultSubMenu(); ret = new DefaultSubMenu();
if (selectedSet.contains(m)) { if (selectedSet.contains(m)) {
ret.setStyleClass("prime-menu-selected"); ret.setStyleClass("prime-menu-selected");
if (m.getItem() != null)
logger.info("Setting styleclass on menuitem {}, {}", m.getItem().getUrl(), m); logger.info("Setting styleclass on menuitem {}, {}", m.getItem().getUrl(), m);
} }
ret.setLabel(I18n.get(m.getKey())); ret.setLabel(I18n.get(m.getKey()));
......
...@@ -39,6 +39,17 @@ public class BillListView extends GenericCDIView { ...@@ -39,6 +39,17 @@ public class BillListView extends GenericCDIView {
private ArrayList<BillSummary> billsummary; private ArrayList<BillSummary> billsummary;
private boolean showPayButtons = false;
public String showPayButtonsAction()
{
if (super.hasPermission(BillPermission.WRITE_ALL))
{
showPayButtons = true;
}
return null;
}
public void initAllBills() { public void initAllBills() {
if (super.requirePermissions(BillPermission.READ_ALL)) { if (super.requirePermissions(BillPermission.READ_ALL)) {
beginConversation(); beginConversation();
...@@ -100,4 +111,12 @@ public class BillListView extends GenericCDIView { ...@@ -100,4 +111,12 @@ public class BillListView extends GenericCDIView {
this.billsummary = billsummary; this.billsummary = billsummary;
} }
public boolean isShowPayButtons() {
return showPayButtons;
}
public void setShowPayButtons(boolean showPayButtons) {
this.showPayButtons = showPayButtons;
}
} }
Markdown is supported
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!