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
2017-02-13 12:18:03 +0100
Browse Files
Options
Browse Files
Download
Email Patches
Plain Diff
Commit
23bc5daf3ed32503924ec736a28c24f018bce0ac
23bc5daf
1 parent
371b17d6
Javadoc et SonarQube
Hide whitespace changes
Inline
Side-by-side
Showing
13 changed files
with
212 additions
and
77 deletions
src/main/java/org/legrog/entities/PublisherActionRepository.java
src/main/java/org/legrog/entities/PublisherSearchRepository.java
src/main/java/org/legrog/entities/PublisherSearchRepositorySolrj.java
src/main/java/org/legrog/entities/PublisherVersion.java
src/main/java/org/legrog/web/publisher/ListPublisherActionsView.java
src/main/java/org/legrog/web/publisher/ListPublisherVersionsView.java
src/main/java/org/legrog/web/publisher/PublisherService.java
src/main/java/org/legrog/web/publisher/PublisherServiceDefault.java
src/main/java/org/legrog/web/publisher/PublisherVersionView.java
src/main/java/org/legrog/web/xyz/AddCountryView.java
src/main/java/org/legrog/web/xyz/ListCountriesView.java
src/main/java/org/legrog/web/xyz/SharedService.java
src/main/java/org/legrog/web/xyz/SharedServiceDefault.java
src/main/java/org/legrog/entities/PublisherActionRepository.java
View file @
23bc5da
...
...
@@ -4,9 +4,24 @@ import org.springframework.data.jpa.repository.JpaRepository;
import
java.util.List
;
/**
* Interface d'accès aux PublisherAction.
*/
public
interface
PublisherActionRepository
extends
JpaRepository
<
PublisherAction
,
Integer
>
{
/**
* Retourne la dernière action du type indiqué sur le Publisher indiqué.
*
* @param actionType
* @param publisher
* @return PublisherAction
*/
PublisherAction
findFirstByActionTypeAndPublisherOrderByPublisherActionDatetimeDesc
(
ActionType
actionType
,
Publisher
publisher
);
/**
* Retourne l'ensemble des actions concernant la PublisherVersion indiquée
* @param publisherVersion
* @return List<PublisherAction>
*/
List
<
PublisherAction
>
findByPublisherVersion
(
PublisherVersion
publisherVersion
);
}
...
...
src/main/java/org/legrog/entities/PublisherSearchRepository.java
View file @
23bc5da
package
org
.
legrog
.
entities
;
/**
* Interface d'indexation/recherche des IndexedPublisher
*/
public
interface
PublisherSearchRepository
{
/*
@param IndexedPublisher
@return IndexedPublisher
Indexe la version simplifiée de Publisher, IndexedPublisher.
/*
*
* Indexe la version simplifiée de Publisher, IndexedPublisher.
*
* @param indexedPublisher
* @return IndexedPublisher
*/
public
IndexedPublisher
save
(
IndexedPublisher
indexedPublisher
)
throws
IndexingException
;
}
...
...
src/main/java/org/legrog/entities/PublisherSearchRepositorySolrj.java
View file @
23bc5da
...
...
@@ -9,8 +9,8 @@ import org.slf4j.LoggerFactory;
import
javax.inject.Inject
;
import
java.io.IOException
;
/*
Classe implémentant l'interface PublisherSearchRepository avec l'API SolrJ
/*
*
*
Classe implémentant l'interface PublisherSearchRepository avec l'API SolrJ
*/
public
class
PublisherSearchRepositorySolrj
implements
PublisherSearchRepository
{
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
...
...
src/main/java/org/legrog/entities/PublisherVersion.java
View file @
23bc5da
...
...
@@ -3,12 +3,12 @@ package org.legrog.entities;
import
javax.persistence.*
;
import
java.sql.Timestamp
;
/*
Entité persistente représentant une version d'un éditeur.
Contient les données représentant un éditeur.
Adresse découpée en suivant http://schema.org/PostalAddress.
Pointe vers l'éditeur auquel elle correspond.
Pointe vers l'auteur de la version et contient la date et heure de celle-ci.
/*
*
*
Entité persistente représentant une version d'un éditeur.
*
Contient les données représentant un éditeur.
*
Adresse découpée en suivant http://schema.org/PostalAddress.
*
Pointe vers l'éditeur auquel elle correspond.
*
Pointe vers l'auteur de la version et contient la date et heure de celle-ci.
*/
@Entity
public
class
PublisherVersion
{
...
...
src/main/java/org/legrog/web/publisher/ListPublisherActionsView.java
View file @
23bc5da
...
...
@@ -11,10 +11,10 @@ import java.io.Serializable;
import
java.util.List
;
import
java.util.stream.Collectors
;
/*
Vue de listPublisherVersions.xhtml
Permet de voir l'ensemble des actions des éditeurs.
Permet de voir l'ensemble des actions d'un éditeur.
/*
*
*
Vue de listPublisherVersions.xhtml
*
Permet de voir l'ensemble des actions des éditeurs.
*
Permet de voir l'ensemble des actions d'un éditeur.
*/
@Named
@ViewScoped
...
...
@@ -29,6 +29,11 @@ public class ListPublisherActionsView implements Serializable {
private
transient
List
<
PublisherAction
>
publisherActions
;
@Inject
/**
* S'appuie sur PublisherService pour récupérer les actions.
*
* @param publisherService
*/
public
ListPublisherActionsView
(
PublisherService
publisherService
)
{
this
.
publisherService
=
publisherService
;
}
...
...
src/main/java/org/legrog/web/publisher/ListPublisherVersionsView.java
View file @
23bc5da
...
...
@@ -13,10 +13,10 @@ import java.io.Serializable;
import
java.util.List
;
import
java.util.stream.Collectors
;
/*
Vue de listPublisherVersions.xhtml
Permet de voir l'ensemble des versions des éditeurs.
Permet de voir l'ensemble des versions d'un éditeur et de valider l'une d'elles.
/*
*
*
Vue de listPublisherVersions.xhtml
*
Permet de voir l'ensemble des versions des éditeurs.
*
Permet de voir l'ensemble des versions d'un éditeur et de valider l'une d'elles.
*/
@Named
@ViewScoped
...
...
@@ -31,6 +31,11 @@ public class ListPublisherVersionsView implements Serializable {
private
transient
List
<
PublisherVersion
>
publisherVersions
;
@Inject
/**
* S'appuie sur PublisherService pour son accès aux données
*
* @param publisherService
*/
public
ListPublisherVersionsView
(
PublisherService
publisherService
)
{
this
.
publisherService
=
publisherService
;
}
...
...
@@ -39,6 +44,12 @@ public class ListPublisherVersionsView implements Serializable {
//no args constructor to make it proxyable
}
/**
* Retourne la dernière action de validation de l'éditeur.
*
* @param publisher
* @return PublisherAction
*/
public
PublisherAction
getLastValidate
(
Publisher
publisher
)
{
return
publisherService
.
getLastValidate
(
publisher
);
}
...
...
@@ -61,6 +72,11 @@ public class ListPublisherVersionsView implements Serializable {
}
/**
* Valide la PublisherVersion pour son Publisher
*
* @param publisherVersion
*/
public
void
validate
(
PublisherVersion
publisherVersion
)
{
logger
.
trace
(
"validate"
);
...
...
@@ -69,7 +85,7 @@ public class ListPublisherVersionsView implements Serializable {
publisherVersions
=
publisherService
.
getAllPublisherVersions
();
filterOnID
();
}
//
public
PublisherService
getPublisherService
()
{
return
publisherService
;
...
...
src/main/java/org/legrog/web/publisher/PublisherService.java
View file @
23bc5da
...
...
@@ -7,68 +7,69 @@ import org.legrog.entities.PublisherVersion;
import
javax.validation.constraints.NotNull
;
import
java.util.List
;
/*
Interface correspondant à la gestion des éditeurs, de leurs versions et des actions correspondantes.
Contient des signatures pour les méthodes d'ajout, de modification et de validation de version ainsi
que de restitution.
/*
*
*
Interface correspondant à la gestion des éditeurs, de leurs versions et des actions correspondantes.
*
Contient des signatures pour les méthodes d'ajout, de modification et de validation de version ainsi
*
que de restitution.
*/
public
interface
PublisherService
{
/*
@param PublisherVersion for creation of new Publisher ; has no publisher, author or date time
Creates Publisher, associates it with PublisherVersion and back.
PublisherVersion is completed with author and date time.
Both Publisher and PublisherVersion are persisted.
@return updated PublisherVersion
/**
* Creates Publisher, associates it with PublisherVersion and back.
* PublisherVersion is completed with author and date time.
* Both Publisher and PublisherVersion are persisted.
*
* @param publisherVersion for creation of new Publisher ; has no publisher, author or date time
* @return updated PublisherVersion
*/
PublisherVersion
addNewPublisher
(
@NotNull
PublisherVersion
publisherVersion
);
/*
@param Publisher has at least one version
@param PublisherVersion has no publisher, author or date time
Updates Publisher's versions, adding PublisherVersion. Reverse association is also done.
PublisherVersion is completed with author and date time.
Both Publisher and PublisherVersion are persisted.
@return updated PublisherVersion
/**
* Updates Publisher's versions, adding PublisherVersion. Reverse association is also done.
* PublisherVersion is completed with author and date time.
* Both Publisher and PublisherVersion are persisted.
*
* @param publisher has at least one version
* @param publisherVersion has no publisher, author or date time
* @return updated PublisherVersion
*/
PublisherVersion
addVersionToPublisher
(
@NotNull
Publisher
publisher
,
@NotNull
PublisherVersion
publisherVersion
);
/*
@param PublisherVersion
Sets PublisherVersion as its Publisher validated version.
Creates the PublisherAction for the validation.
Both Publisher and PublisherAction are persisted.
@return PublisherAction related to the validation
/**
* Sets PublisherVersion as its Publisher validated version.
* Creates the PublisherAction for the validation.
* Both Publisher and PublisherAction are persisted.
*
* @param publisherVersion
* @return PublisherAction related to the validation
*/
PublisherAction
validatePublisherVersion
(
@NotNull
PublisherVersion
publisherVersion
);
/* @return all persisted PublisherVersions */
/**
* @return all persisted PublisherVersions*
*/
List
<
PublisherVersion
>
getAllPublisherVersions
();
/*
@param publisherVersionId
@return PublisherVersion with id publisherVersionId
*/
/*
*
*
@param publisherVersionId
*
@return PublisherVersion with id publisherVersionId
*/
PublisherVersion
getPublisherVersion
(
@NotNull
Integer
publisherVersionId
);
/*
@param P
ublisher
@return PublisherAction for Publisher's last validation
*/
/*
*
* @param p
ublisher
*
@return PublisherAction for Publisher's last validation
*/
PublisherAction
getLastValidate
(
@NotNull
Publisher
publisher
);
/* @return all persisted PublisherAction */
/**
* @return all persisted PublisherAction
*/
List
<
PublisherAction
>
getAllPublisherActions
();
/*
@param P
ublisherVersion
@return all PublisherAction on that PublisherVersion
/*
*
* @param p
ublisherVersion
*
@return all PublisherAction on that PublisherVersion
*/
List
<
PublisherAction
>
getAllPublisherVersionActions
(
@NotNull
PublisherVersion
publisherVersion
);
}
}
\ No newline at end of file
...
...
src/main/java/org/legrog/web/publisher/PublisherServiceDefault.java
View file @
23bc5da
...
...
@@ -14,10 +14,9 @@ import java.util.HashSet;
import
java.util.List
;
import
java.util.Set
;
/*
Implémentation de l'interface PublisherService
/*
*
*
Implémentation de l'interface PublisherService
*/
@Stateless
public
class
PublisherServiceDefault
implements
PublisherService
{
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
...
...
@@ -28,6 +27,15 @@ public class PublisherServiceDefault implements PublisherService {
PublisherSearchRepository
publisherSearchRepository
;
SharedService
sharedService
;
/**
* Le service s'appuie concrètement sur un ensemble de dépôts et sur le service auxiliaire SharedService.
*
* @param publisherRepository
* @param publisherVersionRepository
* @param publisherActionRepository
* @param publisherSearchRepository
* @param sharedService
*/
@Inject
public
PublisherServiceDefault
(
PublisherRepository
publisherRepository
,
PublisherVersionRepository
publisherVersionRepository
,
...
...
src/main/java/org/legrog/web/publisher/PublisherVersionView.java
View file @
23bc5da
...
...
@@ -13,11 +13,11 @@ import java.io.Serializable;
import
java.sql.Timestamp
;
import
java.util.List
;
/*
Vue de publisherVersion.xhtml
Permet la création, l'affichage et la modification d'une version d'éditeur.
La création d'une version crée l'éditeur et sa version initiale.
Le modification crée une nouvelle version liée à l'éditeur.
/*
*
*
Vue de publisherVersion.xhtml
*
Permet la création, l'affichage et la modification d'une version d'éditeur.
*
La création d'une version crée l'éditeur et sa version initiale.
*
Le modification crée une nouvelle version liée à l'éditeur.
*/
@Named
@ViewScoped
...
...
@@ -51,6 +51,11 @@ public class PublisherVersionView implements Serializable {
private
transient
List
<
PublisherAction
>
publisherActions
;
/**
* S'appuie sur PublisherService et SharedService
* @param publisherService
* @param sharedService
*/
@Inject
public
PublisherVersionView
(
PublisherService
publisherService
,
SharedService
sharedService
)
{
this
.
publisherService
=
publisherService
;
...
...
@@ -62,14 +67,23 @@ public class PublisherVersionView implements Serializable {
}
@PostConstruct
/**
* Charge les pays.
*/
public
void
init
()
{
availableCountries
=
sharedService
.
getAllCountries
();
}
/**
* Active le mode édition
*/
public
void
edit
()
{
editMode
=
true
;
}
/**
* Annule l'édition en cours.
*/
public
void
cancel
()
{
if
(!
newPublisher
)
{
loadData
();
...
...
@@ -93,6 +107,9 @@ public class PublisherVersionView implements Serializable {
}
}
/**
* Enregistre la version courante.
*/
public
void
save
()
{
logger
.
debug
(
"save()"
);
if
(
newPublisher
)
{
...
...
@@ -131,7 +148,7 @@ public class PublisherVersionView implements Serializable {
publisherVersionDatetime
=
publisherVersion
.
getPublisherVersionDatetime
();
}
public
void
add
()
{
void
add
()
{
PublisherVersion
publisherVersion
=
getNewPublisherVersion
();
publisherVersion
=
publisherService
.
addNewPublisher
(
publisherVersion
);
...
...
@@ -145,7 +162,7 @@ public class PublisherVersionView implements Serializable {
editMode
=
false
;
}
public
void
update
()
{
void
update
()
{
logger
.
trace
(
"debut update, attributs locaux, publisherAddressCountry = {} publisherAddressLocality = {} publisherAddressRegion = {} publisherEmail = {} publisherHistory = {} publisherName = {} publisherPostalCode = {} publisherPostOfficeBoxNumber = {} publisherStreetAddress = {} publisherTelephone {} publisherURL {}"
,
publisherAddressCountry
,
publisherAddressLocality
,
publisherAddressRegion
,
publisherEmail
,
publisherHistory
,
publisherName
,
publisherPostalCode
,
publisherPostOfficeBoxNumber
,
...
...
src/main/java/org/legrog/web/xyz/AddCountryView.java
View file @
23bc5da
...
...
@@ -11,6 +11,10 @@ import java.io.Serializable;
@Named
@RequestScoped
/**
* Vue de addCountry.xhtml
* Permet d'ajouter de nouveaux pays.
*/
public
class
AddCountryView
implements
Serializable
{
transient
Logger
logger
=
LoggerFactory
.
getLogger
(
getClass
());
...
...
@@ -22,11 +26,19 @@ public class AddCountryView implements Serializable {
//no args constructor to make it proxyable
}
/**
* S'appuie sur le service partagé.
*
* @param sharedService
*/
@Inject
public
AddCountryView
(
SharedService
sharedService
)
{
this
.
sharedService
=
sharedService
;
}
/**
* Ajoute la pays du formulaire.
*/
public
void
add
()
{
Country
country
=
new
Country
();
country
.
setCountryName
(
countryName
);
...
...
src/main/java/org/legrog/web/xyz/ListCountriesView.java
View file @
23bc5da
...
...
@@ -11,6 +11,10 @@ import java.util.List;
@Named
@RequestScoped
/**
* Vue de listCountries.xhtml
* Alimente l'affichage de l'ensemble des pays.
*/
public
class
ListCountriesView
implements
Serializable
{
private
transient
SharedService
sharedService
;
...
...
@@ -21,11 +25,19 @@ public class ListCountriesView implements Serializable {
//no args constructor to make it proxyable
}
/**
* Utilise le service partagé.
*
* @param sharedService
*/
@Inject
public
ListCountriesView
(
SharedService
sharedService
)
{
this
.
sharedService
=
sharedService
;
}
/**
* Charge la liste des pays.
*/
@PostConstruct
public
void
init
()
{
countries
=
sharedService
.
getAllCountries
();
...
...
src/main/java/org/legrog/web/xyz/SharedService.java
View file @
23bc5da
...
...
@@ -4,17 +4,52 @@ import org.legrog.entities.*;
import
java.util.List
;
/**
* Service partagé pour les données non associées à un package spécifique.
*/
public
interface
SharedService
{
/**
* Ajoute un pays.
*
* @param country
* @return Country ajouté
*/
Country
addCountry
(
Country
country
);
/**
* Fournit la liste des pays.
*
* @return List<Country>
*/
List
<
Country
>
getAllCountries
();
/**
* Fournit la liste des DisplayNameMask
*
* @return List<DisplayNameMask>
*/
List
<
DisplayNameMask
>
getAllDisplayNameMasks
();
/**
* Fournit la liste des AccountRole
*
* @return List<AccountRole>
*/
List
<
AccountRole
>
getAvailableUserRoles
();
/**
* Fournit la liste des AccountProperty
*
* @return List<AccountProperty>
*/
List
<
AccountProperty
>
getAvailableUserProperties
();
/**
* Fournit le compte correspondant à l'utilisateur courant.
* @return Account
*
* TODO : implémenter une méthode qui le fait vraiment
*/
Account
getCurrentUser
();
}
\ No newline at end of file
...
...
src/main/java/org/legrog/web/xyz/SharedServiceDefault.java
View file @
23bc5da
...
...
@@ -10,6 +10,9 @@ import java.util.Random;
import
java.util.Vector
;
@Stateless
/**
* Implémentation du service partagé
*/
public
class
SharedServiceDefault
implements
SharedService
{
CountryRepository
countryRepository
;
...
...
@@ -17,6 +20,16 @@ public class SharedServiceDefault implements SharedService {
AccountPropertyRepository
accountPropertyRepository
;
UserService
userService
;
private
List
<
DisplayNameMask
>
allDisplayNameMasks
;
/**
* Utilise les dépôts partagés et le service correspondant aux comptes
*
* @param countryRepository
* @param accountRoleRepository
* @param accountPropertyRepository
* @param userService
*/
@Inject
public
SharedServiceDefault
(
CountryRepository
countryRepository
,
AccountRoleRepository
accountRoleRepository
,
AccountPropertyRepository
accountPropertyRepository
,
UserService
userService
)
{
...
...
@@ -26,8 +39,6 @@ public class SharedServiceDefault implements SharedService {
this
.
userService
=
userService
;
}
private
List
<
DisplayNameMask
>
allDisplayNameMasks
;
@Override
public
Country
addCountry
(
Country
country
)
{
countryRepository
.
save
(
country
);
...
...
Please
register
or
login
to post a comment