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-13 12:05:07 +0200
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
bfd0a489bace724670f6f9ec9e20305411e68efe
bfd0a489
1 parent
f6b2cf6b
Formulaire création éditeur OK (à 2 TODO près) en amont enregistrement dans la base
Show whitespace changes
Inline
Side-by-side
Showing
3 changed files
with
68 additions
and
0 deletions
src/main/java/org/legrog/entities/Publisher.java
src/main/java/org/legrog/entities/PublisherRevision.java
src/main/java/org/legrog/presentation/AddPublisherBean.java
src/main/java/org/legrog/entities/Publisher.java
View file @
bfd0a48
package
org
.
legrog
.
entities
;
import
javax.persistence.*
;
import
java.sql.Timestamp
;
import
java.util.Set
;
@Entity
...
...
@@ -19,6 +20,8 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
@OneToOne
private
User
activeValidator
;
private
Timestamp
validationDateTime
;
@OneToMany
(
mappedBy
=
"publisher"
)
private
Set
<
PublisherRevision
>
revisions
;
...
...
@@ -53,4 +56,17 @@ public class Publisher /* extends org.roliste.data.DbLinkableEntity */ {
public
void
setActiveValidator
(
User
activeValidator
)
{
this
.
activeValidator
=
activeValidator
;
}
public
Timestamp
getValidationDateTime
()
{
return
validationDateTime
;
}
public
void
setValidationDateTime
(
Timestamp
validationDateTime
)
{
this
.
validationDateTime
=
validationDateTime
;
}
@Override
public
String
toString
()
{
return
"PUBLISHER_ID = "
+
publisherId
+
", Active Revision = "
+
activeRevision
+
", Validator = "
+
activeValidator
+
", Validation DateTime = "
+
validationDateTime
;
}
}
...
...
src/main/java/org/legrog/entities/PublisherRevision.java
View file @
bfd0a48
...
...
@@ -147,4 +147,14 @@ public class PublisherRevision {
public
void
setPublisherRevisionAuthor
(
User
publisherRevisionAuthor
)
{
this
.
publisherRevisionAuthor
=
publisherRevisionAuthor
;
}
@Override
public
String
toString
()
{
return
"PUBLISHER_REVISION_ID = "
+
publisherRevisionId
+
", Name = "
+
publisherName
+
", St Address = "
+
publisherStreetAddress
+
", CP = "
+
publisherPostalCode
+
", BP = "
+
publisherPostOfficeBoxNumber
+
", Region = "
+
publisherAddressRegion
+
", Ville = "
+
publisherAddressLocality
+
", Pays = "
+
publisherAddressCountry
+
", Telephone = "
+
publisherTelephone
+
", email = "
+
publisherEmail
+
", URL = "
+
publisherURL
+
", actif = "
+
publisherActive
+
", History = "
+
publisherHistory
+
", Revision Author = "
+
publisherRevisionAuthor
+
", Revision DateTime = "
+
publisherRevisionDatetime
;
}
}
\ No newline at end of file
...
...
src/main/java/org/legrog/presentation/AddPublisherBean.java
View file @
bfd0a48
package
org
.
legrog
.
presentation
;
import
org.legrog.application.SharedService
;
import
org.legrog.application.UserService
;
import
org.legrog.entities.Country
;
import
org.legrog.entities.Publisher
;
import
org.legrog.entities.PublisherRevision
;
import
org.legrog.entities.User
;
import
org.slf4j.Logger
;
import
org.slf4j.LoggerFactory
;
import
javax.annotation.PostConstruct
;
import
javax.enterprise.context.RequestScoped
;
import
javax.inject.Inject
;
import
javax.inject.Named
;
import
java.sql.Timestamp
;
import
java.util.HashSet
;
import
java.util.List
;
import
java.util.Random
;
@Named
@RequestScoped
public
class
AddPublisherBean
{
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
@Inject
private
SharedService
sharedService
;
@Inject
private
UserService
userService
;
private
String
publisherName
;
private
String
publisherStreetAddress
;
...
...
@@ -35,6 +46,37 @@ public class AddPublisherBean {
private
List
<
Country
>
availableCountries
;
public
String
add
()
{
logger
.
info
(
"add"
);
Publisher
publisher
=
new
Publisher
();
PublisherRevision
publisherRevision
=
new
PublisherRevision
();
HashSet
<
PublisherRevision
>
publisherRevisions
=
new
HashSet
<
PublisherRevision
>();
publisherRevisions
.
add
(
publisherRevision
);
publisher
.
setRevisions
(
publisherRevisions
);
logger
.
info
(
publisher
.
toString
());
publisherRevision
.
setPublisherActive
(
publisherActive
);
publisherRevision
.
setPublisherAddressCountry
(
publisherAddressCountry
);
publisherRevision
.
setPublisherAddressLocality
(
publisherAddressLocality
);
publisherRevision
.
setPublisherAddressRegion
(
publisherAddressRegion
);
publisherRevision
.
setPublisherAddressLocality
(
publisherAddressLocality
);
publisherRevision
.
setPublisherEmail
(
publisherEmail
);
publisherRevision
.
setPublisherHistory
(
publisherHistory
);
publisherRevision
.
setPublisherName
(
publisherName
);
publisherRevision
.
setPublisherPostalCode
(
publisherPostalCode
);
publisherRevision
.
setPublisherPostOfficeBoxNumber
(
publisherPostOfficeBoxNumber
);
publisherRevision
.
setPublisherStreetAddress
(
publisherStreetAddress
);
publisherRevision
.
setPublisherTelephone
(
publisherTelephone
);
publisherRevision
.
setPublisherURL
(
publisherURL
);
// TODO Remplacer Timestamp de date horloge interne par celui de date locale
publisherRevision
.
setPublisherRevisionDatetime
(
new
Timestamp
(
System
.
currentTimeMillis
()));
// TODO Remplacer l'astuce par une vraie récupération de l'utilisateur
List
<
User
>
users
=
userService
.
getAllUsers
();
Random
random
=
new
Random
();
User
user
=
users
.
get
(
random
.
nextInt
(
users
.
size
()));
// End TODO
publisherRevision
.
setPublisherRevisionAuthor
(
user
);
logger
.
info
(
publisherRevision
.
toString
());
return
"success"
;
}
...
...
Please
register
or
login
to post a comment