Skip to content
Toggle navigation
Projects
Groups
Snippets
Help
Linnea Samila
/
Moya
This project
Loading...
Sign in
Toggle navigation
Go to a project
Project
Repository
Issues
0
Merge Requests
0
Wiki
Settings
Activity
Graph
Charts
Create a new issue
Commits
Issue Boards
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Commit 8e02a635
authored
Sep 04, 2013
by
Tuomas Riihimäki
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Remove commons-io dependency from MoyaBeans
1 parent
247ed5cd
Hide whitespace changes
Inline
Side-by-side
Showing
9 changed files
with
61 additions
and
50 deletions
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CheckoutFiBean.java
code/MoyaBeans/pom.xml
code/MoyaEar/.settings/org.eclipse.wst.common.component
code/MoyaWeb/WebContent/resources/cditools/bills/list.xhtml
code/MoyaWeb/WebContent/resources/cditools/products/shop.xhtml
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/PrimeMenuView.java
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/BillListView.java
code/MoyaBeans/ejbModule/fi/codecrew/moya/beans/CheckoutFiBean.java
View file @
8e02a63
...
...
@@ -2,7 +2,6 @@ package fi.codecrew.moya.beans;
import
java.io.IOException
;
import
java.io.InputStream
;
import
java.io.StringWriter
;
import
java.math.BigDecimal
;
import
java.text.SimpleDateFormat
;
import
java.util.ArrayList
;
...
...
@@ -24,7 +23,6 @@ import javax.xml.parsers.DocumentBuilder;
import
javax.xml.parsers.DocumentBuilderFactory
;
import
javax.xml.parsers.ParserConfigurationException
;
import
org.apache.commons.io.IOUtils
;
import
org.apache.http.HttpResponse
;
import
org.apache.http.NameValuePair
;
import
org.apache.http.client.entity.UrlEncodedFormEntity
;
...
...
@@ -192,15 +190,15 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
final
DefaultHttpClient
client
=
new
DefaultHttpClient
();
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"
);
final
String
xmlReturn
=
writer
.
toString
();
// logger.info("Got response from checkout.fi msg {}, {} ",
// response.getStatusLine().getStatusCode(), xmlReturn);
return
parseTokenXml
(
xmlReturn
);
return
parseTokenXml
(
response
.
getEntity
().
getContent
());
}
catch
(
IOException
e
)
{
logger
.
warn
(
"Error sending checkout.fi request"
,
e
);
...
...
@@ -236,7 +234,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
// return ret;
// }
private
static
List
<
CheckoutBank
>
parseTokenXml
(
String
xmlReturn
)
{
private
static
List
<
CheckoutBank
>
parseTokenXml
(
InputStream
inputStream
)
{
try
{
// DOMParser parser = new DOMParser();
...
...
@@ -244,9 +242,9 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
DocumentBuilderFactory
dbFactory
=
DocumentBuilderFactory
.
newInstance
();
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();
Element
root
=
doc
.
getDocumentElement
();
root
.
normalize
();
...
...
@@ -275,7 +273,7 @@ public class CheckoutFiBean implements CheckoutFiBeanLocal {
}
return
retbanks
;
}
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
;
}
...
...
code/MoyaBeans/pom.xml
View file @
8e02a63
...
...
@@ -62,10 +62,5 @@
<artifactId>
httpclient
</artifactId>
<version>
4.3-beta2
</version>
</dependency>
<dependency>
<groupId>
commons-io
</groupId>
<artifactId>
commons-io
</artifactId>
<version>
2.2
</version>
</dependency>
</dependencies>
</project>
\ No newline at end of file
code/MoyaEar/.settings/org.eclipse.wst.common.component
View file @
8e02a63
...
...
@@ -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"
>
<dependency-type>
uses
</dependency-type>
</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"
>
<dependency-type>
uses
</dependency-type>
</dependent-module>
...
...
@@ -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"
>
<dependency-type>
uses
</dependency-type>
</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"
>
<dependency-type>
uses
</dependency-type>
</dependent-module>
...
...
code/MoyaWeb/WebContent/resources/cditools/bills/list.xhtml
View file @
8e02a63
...
...
@@ -11,12 +11,10 @@
<h:outputText
rendered=
"#{billListView.bills.rowCount le 0}"
value=
"#{i18n['bills.noBills']}"
/>
<ui:fragment
rendered=
"#{billListView.canWriteBill}"
>
<!-- koyhan miehen confirmaationappi: -->
<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']}"
onclick=
"showMarkPaidButtons();"
/>
</ui:fragment>
<h:form
rendered=
"#{billListView.canWriteBill}"
>
<p:commandButton
ajax=
"false"
action=
"#{billListView.showPayButtonsAction()}"
value=
"#{i18n['bill.showPayButtons']}"
/>
</h:form>
<h:form
rendered=
"#{billListView.bills.rowCount gt 0}"
>
...
...
@@ -77,7 +75,7 @@
</h:link>
</p:column>
<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"
/>
</h:commandButton>
<h:outputText
rendered=
"#{bill.paidDate != null}"
value=
"#{i18n['bill.isPaid']}"
/>
...
...
@@ -87,13 +85,6 @@
</h:form>
<script
type=
"text/javascript"
>
function
showMarkPaidButtons
()
{
$
(
".markPaidButton"
).
removeAttr
(
'disabled'
);
}
$
(
".markPaidButton"
).
attr
(
'disabled'
,
'disabled'
);
</script>
</composite:implementation>
</html>
...
...
code/MoyaWeb/WebContent/resources/cditools/products/shop.xhtml
View file @
8e02a63
<?xml version='1.0' encoding='UTF-8' ?>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN"
"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>
...
...
@@ -63,7 +64,7 @@
</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"
/>
</h:outputText>
</p:column>
...
...
@@ -80,12 +81,18 @@
<p:columnGroup
type=
"footer"
>
<p:row>
<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:columnGroup>
</p:dataTable>
<br
/>
<h:panelGrid
columns=
"3"
>
<h:outputText
for=
"allowStats"
value=
"#{i18n['bill.allowStatistics']}"
/>
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n.properties
View file @
8e02a63
...
...
@@ -24,13 +24,14 @@ adduser.update = Update profile picture
adduser.welcome
=
Welcome
adduser.welcometext
=
Here you can add new user or update your current user profile image. Please select desired action below.
bill.billAmount
=
Amount
bill.billNumber
=
Number
bill.cancel
=
Cancel bill
bill.expires
=
Expires
bill.isExpired
=
Bill is expired
bill.markPaid.show
=
Show Mark paid -buttons
bill.save
=
Save
bill.billAmount
=
Amount
bill.billNumber
=
Number
bill.cancel
=
Cancel bill
bill.expires
=
Expires
bill.isExpired
=
Bill is expired
bill.markPaid.show
=
Show Mark paid -buttons
bill.save
=
Save
bill.showPayButtons
=
Show pay buttons
bortalApplication.BILL
=
Creating, and managing bills
bortalApplication.COMPO
=
Managing compos
...
...
code/MoyaWeb/src/fi/codecrew/moya/resources/i18n_fi.properties
View file @
8e02a63
...
...
@@ -87,6 +87,7 @@ bill.referencenumber = Viitenumero
bill.save
=
Tallenna
bill.sentDate
=
P
\u
00E4iv
\u
00E4ys
bill.show
=
N
\u
00E4yt
\u
00E4
bill.showPayButtons
=
N
\u
00E4yt
\u
00E4 maksunapit
bill.theirReference
=
Asiakkaan viite
bill.totalPrice
=
Summa
bill.totalprice
=
Yhteens
\u
00E4
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/menu/PrimeMenuView.java
View file @
8e02a63
...
...
@@ -106,8 +106,8 @@ public class PrimeMenuView extends GenericCDIView {
ret
=
new
DefaultSubMenu
();
if
(
selectedSet
.
contains
(
m
))
{
ret
.
setStyleClass
(
"prime-menu-selected"
);
logger
.
info
(
"Setting styleclass on menuitem {}, {}"
,
m
.
getItem
().
getUrl
(),
m
);
if
(
m
.
getItem
()
!=
null
)
logger
.
info
(
"Setting styleclass on menuitem {}, {}"
,
m
.
getItem
().
getUrl
(),
m
);
}
ret
.
setLabel
(
I18n
.
get
(
m
.
getKey
()));
...
...
code/MoyaWeb/src/fi/codecrew/moya/web/cdiview/shop/BillListView.java
View file @
8e02a63
...
...
@@ -39,6 +39,17 @@ public class BillListView extends GenericCDIView {
private
ArrayList
<
BillSummary
>
billsummary
;
private
boolean
showPayButtons
=
false
;
public
String
showPayButtonsAction
()
{
if
(
super
.
hasPermission
(
BillPermission
.
WRITE_ALL
))
{
showPayButtons
=
true
;
}
return
null
;
}
public
void
initAllBills
()
{
if
(
super
.
requirePermissions
(
BillPermission
.
READ_ALL
))
{
beginConversation
();
...
...
@@ -100,4 +111,12 @@ public class BillListView extends GenericCDIView {
this
.
billsummary
=
billsummary
;
}
public
boolean
isShowPayButtons
()
{
return
showPayButtons
;
}
public
void
setShowPayButtons
(
boolean
showPayButtons
)
{
this
.
showPayButtons
=
showPayButtons
;
}
}
Write
Preview
Markdown
is supported
Attach a file
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to post a comment