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 8df2b0e6
authored
Nov 18, 2012
by
Juho Salli
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
Tuotteiden varastoarvon lisays
1 parent
cfb14754
Show whitespace changes
Inline
Side-by-side
Showing
4 changed files
with
146 additions
and
0 deletions
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/InventoryEventFacade.java
code/LanBortalWeb/WebContent/product/addInventory.xhtml
code/LanBortalWeb/WebContent/resources/cditools/products/addInventory.xhtml
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/AddInventoryView.java
code/LanBortalBeans/ejbModule/fi/insomnia/bortal/facade/InventoryEventFacade.java
0 → 100644
View file @
8df2b0e
package
fi
.
insomnia
.
bortal
.
facade
;
import
javax.ejb.LocalBean
;
import
javax.ejb.Stateless
;
import
fi.insomnia.bortal.model.InventoryEvent
;
@Stateless
@LocalBean
public
class
InventoryEventFacade
extends
IntegerPkGenericFacade
<
InventoryEvent
>
{
public
InventoryEventFacade
()
{
super
(
InventoryEvent
.
class
);
// TODO Auto-generated constructor stub
}
}
code/LanBortalWeb/WebContent/product/addInventory.xhtml
0 → 100644
View file @
8df2b0e
<!DOCTYPE html
PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN"
"http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">
<html
xmlns=
"http://www.w3.org/1999/xhtml"
xmlns:ui=
"http://java.sun.com/jsf/facelets"
xmlns:h=
"http://java.sun.com/jsf/html"
xmlns:products=
"http://java.sun.com/jsf/composite/cditools/products"
xmlns:f=
"http://java.sun.com/jsf/core"
>
<h:body>
<ui:composition
template=
"/layout/#{sessionHandler.layout}/template.xhtml"
>
<f:metadata>
<f:event
type=
"preRenderView"
listener=
"#{addInventoryView.initCreateInventory}"
/>
</f:metadata>
<ui:define
name=
"content"
>
<products:addInventory
/>
</ui:define>
</ui:composition>
</h:body>
</html>
\ No newline at end of file
code/LanBortalWeb/WebContent/resources/cditools/products/addInventory.xhtml
0 → 100644
View file @
8df2b0e
<?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"
>
<composite:interface>
</composite:interface>
<composite:implementation>
<h1>
${i18n['inventory.product.title']}
</h1>
<h:form
id=
"inventoryform"
>
<h:panelGrid
columns=
"2"
>
<h:outputText
value=
"${i18n['inventory.product.name']}"
/>
<p:selectOneMenu
required=
"true"
id=
"product"
value=
"#{addInventoryView.inventoryEvent.product}"
converter=
"#{productConverter}"
>
<f:selectItem
itemLabel=
"----"
/>
<f:selectItems
value=
"#{addInventoryView.products}"
var=
"product"
itemLabel=
"#{product.name}"
/>
</p:selectOneMenu>
<h:outputText
value=
"${i18n['inventory.product.quantity']}"
/>
<p:inputText
value=
"#{addInventoryView.inventoryEvent.quantity}"
required=
"true"
>
<f:convertNumber
minFractionDigits=
"0"
maxFractionDigits=
"2"
/>
</p:inputText>
<h:outputText
value=
"${i18n['inventory.product.info']}"
/>
<p:inputTextarea
value=
"#{addInventoryView.inventoryEvent.info}"
/>
</h:panelGrid>
<p:commandButton
ajax=
"false"
value=
"${i18n['inventory.product.submitButton']}"
action=
"#{addInventoryView.save}"
/>
</h:form>
</composite:implementation>
</html>
code/LanBortalWeb/src/fi/insomnia/bortal/web/cdiview/shop/AddInventoryView.java
0 → 100644
View file @
8df2b0e
package
fi
.
insomnia
.
bortal
.
web
.
cdiview
.
shop
;
import
java.math.BigDecimal
;
import
java.util.List
;
import
javax.ejb.EJB
;
import
javax.enterprise.context.ConversationScoped
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Named
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
fi.insomnia.bortal.beans.PermissionBeanLocal
;
import
fi.insomnia.bortal.beans.ProductBeanLocal
;
import
fi.insomnia.bortal.enums.apps.ShopPermission
;
import
fi.insomnia.bortal.model.InventoryEvent
;
import
fi.insomnia.bortal.model.Product
;
import
fi.insomnia.bortal.web.cdiview.GenericCDIView
;
@Named
@ConversationScoped
public
class
AddInventoryView
extends
GenericCDIView
{
private
static
final
long
serialVersionUID
=
1L
;
@EJB
private
ProductBeanLocal
pblocal
;
@EJB
private
PermissionBeanLocal
permBeanLocal
;
private
InventoryEvent
inventoryEvent
;
private
List
<
Product
>
products
;
private
static
final
Logger
logger
=
LoggerFactory
.
getLogger
(
AddInventoryView
.
class
);
public
void
initCreateInventory
()
{
if
(
super
.
requirePermissions
(
ShopPermission
.
MANAGE_PRODUCTS
)
&&
inventoryEvent
==
null
)
{
inventoryEvent
=
new
InventoryEvent
();
super
.
beginConversation
();
setProducts
(
pblocal
.
findProductsForEvent
());
logger
.
debug
(
"Initialized {} products for inventoryview"
,
products
.
size
());
}
}
public
String
save
()
{
pblocal
.
saveInventoryEvent
(
inventoryEvent
);
return
null
;
}
public
List
<
Product
>
getProducts
()
{
return
products
;
}
public
void
setProducts
(
List
<
Product
>
products
)
{
this
.
products
=
products
;
}
public
InventoryEvent
getInventoryEvent
()
{
return
inventoryEvent
;
}
public
void
setInventoryEvent
(
InventoryEvent
inventoryEvent
)
{
this
.
inventoryEvent
=
inventoryEvent
;
}
}
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