Toggle navigation
Toggle navigation
This project
Loading...
Sign in
grogv3
/
grog-cubi
Go to a project
Toggle navigation
Toggle navigation pinning
Projects
Groups
Snippets
Help
Project
Activity
Repository
Pipelines
Graphs
Issues
0
Merge Requests
0
Wiki
Network
Create a new issue
Builds
Commits
Authored by
Jean-Francois Leveque
2016-10-12 18:31:31 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
f6b2cf6b4068c683f6c9be6ad10637dd802a7667
f6b2cf6b
1 parent
d728e31b
Debut ajout Editeur
Hide whitespace changes
Inline
Side-by-side
Showing
8 changed files
with
248 additions
and
2 deletions
src/main/java/org/legrog/application/PublisherService.java
src/main/java/org/legrog/application/PublisherServiceSpring.java
src/main/java/org/legrog/entities/Country.java
src/main/java/org/legrog/entities/PublisherRepository.java
src/main/java/org/legrog/presentation/AddPublisherBean.java
src/main/webapp/WEB-INF/faces-config.xml
src/main/webapp/addPublisher.xhtml
src/main/webapp/index.xhtml
src/main/java/org/legrog/application/PublisherService.java
0 → 100644
View file @
f6b2cf6
package
org
.
legrog
.
application
;
import
org.legrog.entities.Publisher
;
import
java.util.List
;
public
interface
PublisherService
{
void
addPublisher
(
Publisher
publisher
);
List
<
Publisher
>
getAllPublishers
();
}
src/main/java/org/legrog/application/PublisherServiceSpring.java
0 → 100644
View file @
f6b2cf6
package
org
.
legrog
.
application
;
import
org.legrog.entities.Publisher
;
import
org.legrog.entities.PublisherRepository
;
import
javax.ejb.Stateless
;
import
javax.inject.Inject
;
import
java.util.List
;
@Stateless
public
class
PublisherServiceSpring
implements
PublisherService
{
@Inject
PublisherRepository
publisherRepository
;
public
void
addPublisher
(
Publisher
publisher
)
{
publisherRepository
.
save
(
publisher
);
}
public
List
<
Publisher
>
getAllPublishers
()
{
return
publisherRepository
.
findAll
();
}
}
src/main/java/org/legrog/entities/Country.java
View file @
f6b2cf6
...
...
@@ -3,9 +3,7 @@ package org.legrog.entities;
import
javax.persistence.*
;
@Entity
//@Table(name="pays")
public
class
Country
/* extends org.roliste.data.DbEntity */
{
// @Column(name = "ID_PAYS")
@Id
@GeneratedValue
(
strategy
=
GenerationType
.
IDENTITY
)
/* Permet la population */
@Column
(
name
=
"COUNTRY_ID"
)
...
...
src/main/java/org/legrog/entities/PublisherRepository.java
0 → 100644
View file @
f6b2cf6
package
org
.
legrog
.
entities
;
import
org.springframework.data.jpa.repository.JpaRepository
;
public
interface
PublisherRepository
extends
JpaRepository
<
Publisher
,
Integer
>
{
}
src/main/java/org/legrog/presentation/AddPublisherBean.java
0 → 100644
View file @
f6b2cf6
package
org
.
legrog
.
presentation
;
import
org.legrog.application.SharedService
;
import
org.legrog.entities.Country
;
import
org.legrog.entities.User
;
import
javax.annotation.PostConstruct
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
java.sql.Timestamp
;
import
java.util.List
;
@Named
@RequestScoped
public
class
AddPublisherBean
{
@Inject
private
SharedService
sharedService
;
private
String
publisherName
;
private
String
publisherStreetAddress
;
private
String
publisherPostalCode
;
private
String
publisherPostOfficeBoxNumber
;
private
String
publisherAddressRegion
;
private
String
publisherAddressLocality
;
private
Country
publisherAddressCountry
;
private
String
publisherTelephone
;
private
String
publisherEmail
;
private
String
publisherURL
;
private
boolean
publisherActive
;
private
String
publisherHistory
;
private
User
publisherRevisionAuthor
;
private
Timestamp
publisherRevisionDatetime
;
private
List
<
Country
>
availableCountries
;
public
String
add
()
{
return
"success"
;
}
@PostConstruct
public
void
init
()
{
availableCountries
=
sharedService
.
getAllCountries
();
}
public
String
getPublisherName
()
{
return
publisherName
;
}
public
void
setPublisherName
(
String
publisherName
)
{
this
.
publisherName
=
publisherName
;
}
public
String
getPublisherStreetAddress
()
{
return
publisherStreetAddress
;
}
public
void
setPublisherStreetAddress
(
String
publisherStreetAddress
)
{
this
.
publisherStreetAddress
=
publisherStreetAddress
;
}
public
String
getPublisherPostalCode
()
{
return
publisherPostalCode
;
}
public
void
setPublisherPostalCode
(
String
publisherPostalCode
)
{
this
.
publisherPostalCode
=
publisherPostalCode
;
}
public
String
getPublisherPostOfficeBoxNumber
()
{
return
publisherPostOfficeBoxNumber
;
}
public
void
setPublisherPostOfficeBoxNumber
(
String
publisherPostOfficeBoxNumber
)
{
this
.
publisherPostOfficeBoxNumber
=
publisherPostOfficeBoxNumber
;
}
public
String
getPublisherAddressRegion
()
{
return
publisherAddressRegion
;
}
public
void
setPublisherAddressRegion
(
String
publisherAddressRegion
)
{
this
.
publisherAddressRegion
=
publisherAddressRegion
;
}
public
String
getPublisherAddressLocality
()
{
return
publisherAddressLocality
;
}
public
void
setPublisherAddressLocality
(
String
publisherAddressLocality
)
{
this
.
publisherAddressLocality
=
publisherAddressLocality
;
}
public
Country
getPublisherAddressCountry
()
{
return
publisherAddressCountry
;
}
public
void
setPublisherAddressCountry
(
Country
publisherAddressCountry
)
{
this
.
publisherAddressCountry
=
publisherAddressCountry
;
}
public
String
getPublisherTelephone
()
{
return
publisherTelephone
;
}
public
void
setPublisherTelephone
(
String
publisherTelephone
)
{
this
.
publisherTelephone
=
publisherTelephone
;
}
public
String
getPublisherEmail
()
{
return
publisherEmail
;
}
public
void
setPublisherEmail
(
String
publisherEmail
)
{
this
.
publisherEmail
=
publisherEmail
;
}
public
String
getPublisherURL
()
{
return
publisherURL
;
}
public
void
setPublisherURL
(
String
publisherURL
)
{
this
.
publisherURL
=
publisherURL
;
}
public
boolean
isPublisherActive
()
{
return
publisherActive
;
}
public
void
setPublisherActive
(
boolean
publisherActive
)
{
this
.
publisherActive
=
publisherActive
;
}
public
String
getPublisherHistory
()
{
return
publisherHistory
;
}
public
void
setPublisherHistory
(
String
publisherHistory
)
{
this
.
publisherHistory
=
publisherHistory
;
}
public
List
<
Country
>
getAvailableCountries
()
{
return
availableCountries
;
}
public
void
setAvailableCountries
(
List
<
Country
>
availableCountries
)
{
this
.
availableCountries
=
availableCountries
;
}
}
\ No newline at end of file
src/main/webapp/WEB-INF/faces-config.xml
View file @
f6b2cf6
...
...
@@ -39,6 +39,10 @@
<from-outcome>
listUsers
</from-outcome>
<to-view-id>
/listUsers.xhtml
</to-view-id>
</navigation-case>
<navigation-case>
<from-outcome>
addPublisher
</from-outcome>
<to-view-id>
/addPublisher.xhtml
</to-view-id>
</navigation-case>
</navigation-rule>
<navigation-rule>
...
...
src/main/webapp/addPublisher.xhtml
0 → 100644
View file @
f6b2cf6
<?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://xmlns.jcp.org/jsf/html"
xmlns:ui=
"http://xmlns.jcp.org/jsf/facelets"
xmlns:f=
"http://xmlns.jcp.org/jsf/core"
>
<f:view>
<h:form>
<h:commandLink
action=
"home"
>
<h:outputText
value=
"Menu principal"
/>
</h:commandLink>
<h:panelGrid
columns=
"2"
>
<h:outputText
value=
'publisherName'
/>
<h:inputText
value=
'#{addPublisherBean.publisherName}'
/>
<h:outputText
value=
'publisherStreetAddress'
/>
<h:inputText
value=
'#{addPublisherBean.publisherStreetAddress}'
/>
<h:outputText
value=
'publisherPostalCode'
/>
<h:inputText
value=
'#{addPublisherBean.publisherPostalCode}'
/>
<h:outputText
value=
'publisherPostOfficeBoxNumber'
/>
<h:inputText
value=
'#{addPublisherBean.publisherPostOfficeBoxNumber}'
/>
<h:outputText
value=
'publisherAddressRegion'
/>
<h:inputText
value=
'#{addPublisherBean.publisherAddressRegion}'
/>
<h:outputText
value=
'publisherAddressLocality'
/>
<h:inputText
value=
'#{addPublisherBean.publisherAddressLocality}'
/>
<h:outputText
value=
'publisherAddressCountry'
/>
<h:selectOneMenu
value=
"#{addPublisherBean.publisherAddressCountry}"
converter=
"omnifaces.SelectItemsConverter"
>
<f:selectItems
value=
"#{addPublisherBean.availableCountries}"
var=
"country"
itemLabel=
"#{country.countryName}"
/>
</h:selectOneMenu>
<h:outputText
value=
'publisherTelephone'
/>
<h:inputText
value=
'#{addPublisherBean.publisherTelephone}'
/>
<h:outputText
value=
'publisherEmail'
/>
<h:inputText
value=
'#{addPublisherBean.publisherEmail}'
/>
<h:outputText
value=
'publisherURL'
/>
<h:inputText
value=
'#{addPublisherBean.publisherURL}'
/>
<h:outputText
value=
'publisherActive'
/>
<h:selectBooleanCheckbox
value=
"#{addPublisherBean.publisherActive}"
/>
<h:outputText
value=
'publisherHistory'
/>
<h:inputTextarea
value=
'#{addPublisherBean.publisherHistory}'
/>
<h:outputText
value=
'Add'
/>
<h:commandButton
action=
"#{addPublisherBean.add}"
value=
"Add"
/>
</h:panelGrid>
</h:form>
</f:view>
</html>
src/main/webapp/index.xhtml
View file @
f6b2cf6
...
...
@@ -38,6 +38,11 @@
<h:outputText
value=
"List users"
/>
</h:commandLink>
</li>
<li>
<h:commandLink
action=
"addPublisher"
>
<h:outputText
value=
"Add Publisher"
/>
</h:commandLink>
</li>
</ul>
</h:form>
</body>
...
...
Please
register
or
login
to post a comment