Showing
13 changed files
with
212 additions
and
77 deletions
... | @@ -4,9 +4,24 @@ import org.springframework.data.jpa.repository.JpaRepository; | ... | @@ -4,9 +4,24 @@ import org.springframework.data.jpa.repository.JpaRepository; |
4 | 4 | ||
5 | import java.util.List; | 5 | import java.util.List; |
6 | 6 | ||
7 | +/** | ||
8 | + * Interface d'accès aux PublisherAction. | ||
9 | + */ | ||
7 | public interface PublisherActionRepository extends JpaRepository<PublisherAction, Integer> { | 10 | public interface PublisherActionRepository extends JpaRepository<PublisherAction, Integer> { |
8 | 11 | ||
12 | + /** | ||
13 | + * Retourne la dernière action du type indiqué sur le Publisher indiqué. | ||
14 | + * | ||
15 | + * @param actionType | ||
16 | + * @param publisher | ||
17 | + * @return PublisherAction | ||
18 | + */ | ||
9 | PublisherAction findFirstByActionTypeAndPublisherOrderByPublisherActionDatetimeDesc(ActionType actionType, Publisher publisher); | 19 | PublisherAction findFirstByActionTypeAndPublisherOrderByPublisherActionDatetimeDesc(ActionType actionType, Publisher publisher); |
10 | 20 | ||
21 | + /** | ||
22 | + * Retourne l'ensemble des actions concernant la PublisherVersion indiquée | ||
23 | + * @param publisherVersion | ||
24 | + * @return List<PublisherAction> | ||
25 | + */ | ||
11 | List<PublisherAction> findByPublisherVersion(PublisherVersion publisherVersion); | 26 | List<PublisherAction> findByPublisherVersion(PublisherVersion publisherVersion); |
12 | } | 27 | } | ... | ... |
1 | package org.legrog.entities; | 1 | package org.legrog.entities; |
2 | 2 | ||
3 | +/** | ||
4 | + * Interface d'indexation/recherche des IndexedPublisher | ||
5 | + */ | ||
3 | public interface PublisherSearchRepository { | 6 | public interface PublisherSearchRepository { |
4 | - /* | 7 | + /** |
5 | - @param IndexedPublisher | 8 | + * Indexe la version simplifiée de Publisher, IndexedPublisher. |
6 | - @return IndexedPublisher | 9 | + * |
7 | - | 10 | + * @param indexedPublisher |
8 | - Indexe la version simplifiée de Publisher, IndexedPublisher. | 11 | + * @return IndexedPublisher |
9 | */ | 12 | */ |
10 | public IndexedPublisher save(IndexedPublisher indexedPublisher) throws IndexingException; | 13 | public IndexedPublisher save(IndexedPublisher indexedPublisher) throws IndexingException; |
11 | } | 14 | } | ... | ... |
... | @@ -9,8 +9,8 @@ import org.slf4j.LoggerFactory; | ... | @@ -9,8 +9,8 @@ import org.slf4j.LoggerFactory; |
9 | import javax.inject.Inject; | 9 | import javax.inject.Inject; |
10 | import java.io.IOException; | 10 | import java.io.IOException; |
11 | 11 | ||
12 | -/* | 12 | +/** |
13 | - Classe implémentant l'interface PublisherSearchRepository avec l'API SolrJ | 13 | + * Classe implémentant l'interface PublisherSearchRepository avec l'API SolrJ |
14 | */ | 14 | */ |
15 | public class PublisherSearchRepositorySolrj implements PublisherSearchRepository { | 15 | public class PublisherSearchRepositorySolrj implements PublisherSearchRepository { |
16 | Logger logger = LoggerFactory.getLogger(getClass()); | 16 | Logger logger = LoggerFactory.getLogger(getClass()); | ... | ... |
... | @@ -3,12 +3,12 @@ package org.legrog.entities; | ... | @@ -3,12 +3,12 @@ package org.legrog.entities; |
3 | import javax.persistence.*; | 3 | import javax.persistence.*; |
4 | import java.sql.Timestamp; | 4 | import java.sql.Timestamp; |
5 | 5 | ||
6 | -/* | 6 | +/** |
7 | - Entité persistente représentant une version d'un éditeur. | 7 | + * Entité persistente représentant une version d'un éditeur. |
8 | - Contient les données représentant un éditeur. | 8 | + * Contient les données représentant un éditeur. |
9 | - Adresse découpée en suivant http://schema.org/PostalAddress. | 9 | + * Adresse découpée en suivant http://schema.org/PostalAddress. |
10 | - Pointe vers l'éditeur auquel elle correspond. | 10 | + * Pointe vers l'éditeur auquel elle correspond. |
11 | - Pointe vers l'auteur de la version et contient la date et heure de celle-ci. | 11 | + * Pointe vers l'auteur de la version et contient la date et heure de celle-ci. |
12 | */ | 12 | */ |
13 | @Entity | 13 | @Entity |
14 | public class PublisherVersion { | 14 | public class PublisherVersion { | ... | ... |
... | @@ -11,10 +11,10 @@ import java.io.Serializable; | ... | @@ -11,10 +11,10 @@ import java.io.Serializable; |
11 | import java.util.List; | 11 | import java.util.List; |
12 | import java.util.stream.Collectors; | 12 | import java.util.stream.Collectors; |
13 | 13 | ||
14 | -/* | 14 | +/** |
15 | - Vue de listPublisherVersions.xhtml | 15 | + * Vue de listPublisherVersions.xhtml |
16 | - Permet de voir l'ensemble des actions des éditeurs. | 16 | + * Permet de voir l'ensemble des actions des éditeurs. |
17 | - Permet de voir l'ensemble des actions d'un éditeur. | 17 | + * Permet de voir l'ensemble des actions d'un éditeur. |
18 | */ | 18 | */ |
19 | @Named | 19 | @Named |
20 | @ViewScoped | 20 | @ViewScoped |
... | @@ -29,6 +29,11 @@ public class ListPublisherActionsView implements Serializable { | ... | @@ -29,6 +29,11 @@ public class ListPublisherActionsView implements Serializable { |
29 | private transient List<PublisherAction> publisherActions; | 29 | private transient List<PublisherAction> publisherActions; |
30 | 30 | ||
31 | @Inject | 31 | @Inject |
32 | + /** | ||
33 | + * S'appuie sur PublisherService pour récupérer les actions. | ||
34 | + * | ||
35 | + * @param publisherService | ||
36 | + */ | ||
32 | public ListPublisherActionsView(PublisherService publisherService) { | 37 | public ListPublisherActionsView(PublisherService publisherService) { |
33 | this.publisherService = publisherService; | 38 | this.publisherService = publisherService; |
34 | } | 39 | } | ... | ... |
... | @@ -13,10 +13,10 @@ import java.io.Serializable; | ... | @@ -13,10 +13,10 @@ import java.io.Serializable; |
13 | import java.util.List; | 13 | import java.util.List; |
14 | import java.util.stream.Collectors; | 14 | import java.util.stream.Collectors; |
15 | 15 | ||
16 | -/* | 16 | +/** |
17 | - Vue de listPublisherVersions.xhtml | 17 | + * Vue de listPublisherVersions.xhtml |
18 | - Permet de voir l'ensemble des versions des éditeurs. | 18 | + * Permet de voir l'ensemble des versions des éditeurs. |
19 | - Permet de voir l'ensemble des versions d'un éditeur et de valider l'une d'elles. | 19 | + * Permet de voir l'ensemble des versions d'un éditeur et de valider l'une d'elles. |
20 | */ | 20 | */ |
21 | @Named | 21 | @Named |
22 | @ViewScoped | 22 | @ViewScoped |
... | @@ -31,6 +31,11 @@ public class ListPublisherVersionsView implements Serializable { | ... | @@ -31,6 +31,11 @@ public class ListPublisherVersionsView implements Serializable { |
31 | private transient List<PublisherVersion> publisherVersions; | 31 | private transient List<PublisherVersion> publisherVersions; |
32 | 32 | ||
33 | @Inject | 33 | @Inject |
34 | + /** | ||
35 | + * S'appuie sur PublisherService pour son accès aux données | ||
36 | + * | ||
37 | + * @param publisherService | ||
38 | + */ | ||
34 | public ListPublisherVersionsView(PublisherService publisherService) { | 39 | public ListPublisherVersionsView(PublisherService publisherService) { |
35 | this.publisherService = publisherService; | 40 | this.publisherService = publisherService; |
36 | } | 41 | } |
... | @@ -39,6 +44,12 @@ public class ListPublisherVersionsView implements Serializable { | ... | @@ -39,6 +44,12 @@ public class ListPublisherVersionsView implements Serializable { |
39 | //no args constructor to make it proxyable | 44 | //no args constructor to make it proxyable |
40 | } | 45 | } |
41 | 46 | ||
47 | + /** | ||
48 | + * Retourne la dernière action de validation de l'éditeur. | ||
49 | + * | ||
50 | + * @param publisher | ||
51 | + * @return PublisherAction | ||
52 | + */ | ||
42 | public PublisherAction getLastValidate(Publisher publisher) { | 53 | public PublisherAction getLastValidate(Publisher publisher) { |
43 | return publisherService.getLastValidate(publisher); | 54 | return publisherService.getLastValidate(publisher); |
44 | } | 55 | } |
... | @@ -61,6 +72,11 @@ public class ListPublisherVersionsView implements Serializable { | ... | @@ -61,6 +72,11 @@ public class ListPublisherVersionsView implements Serializable { |
61 | 72 | ||
62 | } | 73 | } |
63 | 74 | ||
75 | + /** | ||
76 | + * Valide la PublisherVersion pour son Publisher | ||
77 | + * | ||
78 | + * @param publisherVersion | ||
79 | + */ | ||
64 | public void validate(PublisherVersion publisherVersion) { | 80 | public void validate(PublisherVersion publisherVersion) { |
65 | logger.trace("validate"); | 81 | logger.trace("validate"); |
66 | 82 | ||
... | @@ -69,7 +85,7 @@ public class ListPublisherVersionsView implements Serializable { | ... | @@ -69,7 +85,7 @@ public class ListPublisherVersionsView implements Serializable { |
69 | publisherVersions = publisherService.getAllPublisherVersions(); | 85 | publisherVersions = publisherService.getAllPublisherVersions(); |
70 | filterOnID(); | 86 | filterOnID(); |
71 | } | 87 | } |
72 | -// | 88 | + |
73 | 89 | ||
74 | public PublisherService getPublisherService() { | 90 | public PublisherService getPublisherService() { |
75 | return publisherService; | 91 | return publisherService; | ... | ... |
... | @@ -7,68 +7,69 @@ import org.legrog.entities.PublisherVersion; | ... | @@ -7,68 +7,69 @@ import org.legrog.entities.PublisherVersion; |
7 | import javax.validation.constraints.NotNull; | 7 | import javax.validation.constraints.NotNull; |
8 | import java.util.List; | 8 | import java.util.List; |
9 | 9 | ||
10 | -/* | 10 | +/** |
11 | - Interface correspondant à la gestion des éditeurs, de leurs versions et des actions correspondantes. | 11 | + * Interface correspondant à la gestion des éditeurs, de leurs versions et des actions correspondantes. |
12 | - Contient des signatures pour les méthodes d'ajout, de modification et de validation de version ainsi | 12 | + * Contient des signatures pour les méthodes d'ajout, de modification et de validation de version ainsi |
13 | - que de restitution. | 13 | + * que de restitution. |
14 | */ | 14 | */ |
15 | public interface PublisherService { | 15 | public interface PublisherService { |
16 | 16 | ||
17 | - /* | 17 | + /** |
18 | - @param PublisherVersion for creation of new Publisher ; has no publisher, author or date time | 18 | + * Creates Publisher, associates it with PublisherVersion and back. |
19 | - | 19 | + * PublisherVersion is completed with author and date time. |
20 | - Creates Publisher, associates it with PublisherVersion and back. | 20 | + * Both Publisher and PublisherVersion are persisted. |
21 | - PublisherVersion is completed with author and date time. | 21 | + * |
22 | - Both Publisher and PublisherVersion are persisted. | 22 | + * @param publisherVersion for creation of new Publisher ; has no publisher, author or date time |
23 | - | 23 | + * @return updated PublisherVersion |
24 | - @return updated PublisherVersion | ||
25 | */ | 24 | */ |
26 | PublisherVersion addNewPublisher(@NotNull PublisherVersion publisherVersion); | 25 | PublisherVersion addNewPublisher(@NotNull PublisherVersion publisherVersion); |
27 | 26 | ||
28 | - /* | 27 | + /** |
29 | - @param Publisher has at least one version | 28 | + * Updates Publisher's versions, adding PublisherVersion. Reverse association is also done. |
30 | - @param PublisherVersion has no publisher, author or date time | 29 | + * PublisherVersion is completed with author and date time. |
31 | - | 30 | + * Both Publisher and PublisherVersion are persisted. |
32 | - Updates Publisher's versions, adding PublisherVersion. Reverse association is also done. | 31 | + * |
33 | - PublisherVersion is completed with author and date time. | 32 | + * @param publisher has at least one version |
34 | - Both Publisher and PublisherVersion are persisted. | 33 | + * @param publisherVersion has no publisher, author or date time |
35 | - | 34 | + * @return updated PublisherVersion |
36 | - @return updated PublisherVersion | ||
37 | */ | 35 | */ |
38 | PublisherVersion addVersionToPublisher(@NotNull Publisher publisher, @NotNull PublisherVersion publisherVersion); | 36 | PublisherVersion addVersionToPublisher(@NotNull Publisher publisher, @NotNull PublisherVersion publisherVersion); |
39 | 37 | ||
40 | - /* | 38 | + /** |
41 | - @param PublisherVersion | 39 | + * Sets PublisherVersion as its Publisher validated version. |
42 | - | 40 | + * Creates the PublisherAction for the validation. |
43 | - Sets PublisherVersion as its Publisher validated version. | 41 | + * Both Publisher and PublisherAction are persisted. |
44 | - Creates the PublisherAction for the validation. | 42 | + * |
45 | - Both Publisher and PublisherAction are persisted. | 43 | + * @param publisherVersion |
46 | - | 44 | + * @return PublisherAction related to the validation |
47 | - @return PublisherAction related to the validation | ||
48 | */ | 45 | */ |
49 | PublisherAction validatePublisherVersion(@NotNull PublisherVersion publisherVersion); | 46 | PublisherAction validatePublisherVersion(@NotNull PublisherVersion publisherVersion); |
50 | 47 | ||
51 | - /* @return all persisted PublisherVersions */ | 48 | + /** |
49 | + * @return all persisted PublisherVersions* | ||
50 | + */ | ||
52 | List<PublisherVersion> getAllPublisherVersions(); | 51 | List<PublisherVersion> getAllPublisherVersions(); |
53 | 52 | ||
54 | - /* | 53 | + /** |
55 | - @param publisherVersionId | 54 | + * @param publisherVersionId |
56 | - @return PublisherVersion with id publisherVersionId | 55 | + * @return PublisherVersion with id publisherVersionId |
57 | - */ | 56 | + */ |
58 | PublisherVersion getPublisherVersion(@NotNull Integer publisherVersionId); | 57 | PublisherVersion getPublisherVersion(@NotNull Integer publisherVersionId); |
59 | 58 | ||
60 | - /* | 59 | + /** |
61 | - @param Publisher | 60 | + * @param publisher |
62 | - @return PublisherAction for Publisher's last validation | 61 | + * @return PublisherAction for Publisher's last validation |
63 | - */ | 62 | + */ |
64 | PublisherAction getLastValidate(@NotNull Publisher publisher); | 63 | PublisherAction getLastValidate(@NotNull Publisher publisher); |
65 | 64 | ||
66 | - /* @return all persisted PublisherAction */ | 65 | + /** |
66 | + * @return all persisted PublisherAction | ||
67 | + */ | ||
67 | List<PublisherAction> getAllPublisherActions(); | 68 | List<PublisherAction> getAllPublisherActions(); |
68 | 69 | ||
69 | - /* | 70 | + /** |
70 | - @param PublisherVersion | 71 | + * @param publisherVersion |
71 | - @return all PublisherAction on that PublisherVersion | 72 | + * @return all PublisherAction on that PublisherVersion |
72 | */ | 73 | */ |
73 | List<PublisherAction> getAllPublisherVersionActions(@NotNull PublisherVersion publisherVersion); | 74 | List<PublisherAction> getAllPublisherVersionActions(@NotNull PublisherVersion publisherVersion); |
74 | -} | 75 | +} |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -14,10 +14,9 @@ import java.util.HashSet; | ... | @@ -14,10 +14,9 @@ import java.util.HashSet; |
14 | import java.util.List; | 14 | import java.util.List; |
15 | import java.util.Set; | 15 | import java.util.Set; |
16 | 16 | ||
17 | -/* | 17 | +/** |
18 | - Implémentation de l'interface PublisherService | 18 | + * Implémentation de l'interface PublisherService |
19 | */ | 19 | */ |
20 | - | ||
21 | @Stateless | 20 | @Stateless |
22 | public class PublisherServiceDefault implements PublisherService { | 21 | public class PublisherServiceDefault implements PublisherService { |
23 | Logger logger = LoggerFactory.getLogger(getClass()); | 22 | Logger logger = LoggerFactory.getLogger(getClass()); |
... | @@ -28,6 +27,15 @@ public class PublisherServiceDefault implements PublisherService { | ... | @@ -28,6 +27,15 @@ public class PublisherServiceDefault implements PublisherService { |
28 | PublisherSearchRepository publisherSearchRepository; | 27 | PublisherSearchRepository publisherSearchRepository; |
29 | SharedService sharedService; | 28 | SharedService sharedService; |
30 | 29 | ||
30 | + /** | ||
31 | + * Le service s'appuie concrètement sur un ensemble de dépôts et sur le service auxiliaire SharedService. | ||
32 | + * | ||
33 | + * @param publisherRepository | ||
34 | + * @param publisherVersionRepository | ||
35 | + * @param publisherActionRepository | ||
36 | + * @param publisherSearchRepository | ||
37 | + * @param sharedService | ||
38 | + */ | ||
31 | @Inject | 39 | @Inject |
32 | public PublisherServiceDefault(PublisherRepository publisherRepository, | 40 | public PublisherServiceDefault(PublisherRepository publisherRepository, |
33 | PublisherVersionRepository publisherVersionRepository, | 41 | PublisherVersionRepository publisherVersionRepository, | ... | ... |
... | @@ -13,11 +13,11 @@ import java.io.Serializable; | ... | @@ -13,11 +13,11 @@ import java.io.Serializable; |
13 | import java.sql.Timestamp; | 13 | import java.sql.Timestamp; |
14 | import java.util.List; | 14 | import java.util.List; |
15 | 15 | ||
16 | -/* | 16 | +/** |
17 | - Vue de publisherVersion.xhtml | 17 | + * Vue de publisherVersion.xhtml |
18 | - Permet la création, l'affichage et la modification d'une version d'éditeur. | 18 | + * Permet la création, l'affichage et la modification d'une version d'éditeur. |
19 | - La création d'une version crée l'éditeur et sa version initiale. | 19 | + * La création d'une version crée l'éditeur et sa version initiale. |
20 | - Le modification crée une nouvelle version liée à l'éditeur. | 20 | + * Le modification crée une nouvelle version liée à l'éditeur. |
21 | */ | 21 | */ |
22 | @Named | 22 | @Named |
23 | @ViewScoped | 23 | @ViewScoped |
... | @@ -51,6 +51,11 @@ public class PublisherVersionView implements Serializable { | ... | @@ -51,6 +51,11 @@ public class PublisherVersionView implements Serializable { |
51 | 51 | ||
52 | private transient List<PublisherAction> publisherActions; | 52 | private transient List<PublisherAction> publisherActions; |
53 | 53 | ||
54 | + /** | ||
55 | + * S'appuie sur PublisherService et SharedService | ||
56 | + * @param publisherService | ||
57 | + * @param sharedService | ||
58 | + */ | ||
54 | @Inject | 59 | @Inject |
55 | public PublisherVersionView(PublisherService publisherService, SharedService sharedService) { | 60 | public PublisherVersionView(PublisherService publisherService, SharedService sharedService) { |
56 | this.publisherService = publisherService; | 61 | this.publisherService = publisherService; |
... | @@ -62,14 +67,23 @@ public class PublisherVersionView implements Serializable { | ... | @@ -62,14 +67,23 @@ public class PublisherVersionView implements Serializable { |
62 | } | 67 | } |
63 | 68 | ||
64 | @PostConstruct | 69 | @PostConstruct |
70 | + /** | ||
71 | + * Charge les pays. | ||
72 | + */ | ||
65 | public void init() { | 73 | public void init() { |
66 | availableCountries = sharedService.getAllCountries(); | 74 | availableCountries = sharedService.getAllCountries(); |
67 | } | 75 | } |
68 | 76 | ||
77 | + /** | ||
78 | + * Active le mode édition | ||
79 | + */ | ||
69 | public void edit() { | 80 | public void edit() { |
70 | editMode = true; | 81 | editMode = true; |
71 | } | 82 | } |
72 | 83 | ||
84 | + /** | ||
85 | + * Annule l'édition en cours. | ||
86 | + */ | ||
73 | public void cancel() { | 87 | public void cancel() { |
74 | if (!newPublisher) { | 88 | if (!newPublisher) { |
75 | loadData(); | 89 | loadData(); |
... | @@ -93,6 +107,9 @@ public class PublisherVersionView implements Serializable { | ... | @@ -93,6 +107,9 @@ public class PublisherVersionView implements Serializable { |
93 | } | 107 | } |
94 | } | 108 | } |
95 | 109 | ||
110 | + /** | ||
111 | + * Enregistre la version courante. | ||
112 | + */ | ||
96 | public void save() { | 113 | public void save() { |
97 | logger.debug("save()"); | 114 | logger.debug("save()"); |
98 | if (newPublisher) { | 115 | if (newPublisher) { |
... | @@ -131,7 +148,7 @@ public class PublisherVersionView implements Serializable { | ... | @@ -131,7 +148,7 @@ public class PublisherVersionView implements Serializable { |
131 | publisherVersionDatetime = publisherVersion.getPublisherVersionDatetime(); | 148 | publisherVersionDatetime = publisherVersion.getPublisherVersionDatetime(); |
132 | } | 149 | } |
133 | 150 | ||
134 | - public void add() { | 151 | + void add() { |
135 | PublisherVersion publisherVersion = getNewPublisherVersion(); | 152 | PublisherVersion publisherVersion = getNewPublisherVersion(); |
136 | 153 | ||
137 | publisherVersion = publisherService.addNewPublisher(publisherVersion); | 154 | publisherVersion = publisherService.addNewPublisher(publisherVersion); |
... | @@ -145,7 +162,7 @@ public class PublisherVersionView implements Serializable { | ... | @@ -145,7 +162,7 @@ public class PublisherVersionView implements Serializable { |
145 | editMode = false; | 162 | editMode = false; |
146 | } | 163 | } |
147 | 164 | ||
148 | - public void update() { | 165 | + void update() { |
149 | logger.trace("debut update, attributs locaux, publisherAddressCountry = {} publisherAddressLocality = {} publisherAddressRegion = {} publisherEmail = {} publisherHistory = {} publisherName = {} publisherPostalCode = {} publisherPostOfficeBoxNumber = {} publisherStreetAddress = {} publisherTelephone {} publisherURL {}", | 166 | logger.trace("debut update, attributs locaux, publisherAddressCountry = {} publisherAddressLocality = {} publisherAddressRegion = {} publisherEmail = {} publisherHistory = {} publisherName = {} publisherPostalCode = {} publisherPostOfficeBoxNumber = {} publisherStreetAddress = {} publisherTelephone {} publisherURL {}", |
150 | publisherAddressCountry, publisherAddressLocality, publisherAddressRegion, | 167 | publisherAddressCountry, publisherAddressLocality, publisherAddressRegion, |
151 | publisherEmail, publisherHistory, publisherName, publisherPostalCode, publisherPostOfficeBoxNumber, | 168 | publisherEmail, publisherHistory, publisherName, publisherPostalCode, publisherPostOfficeBoxNumber, | ... | ... |
... | @@ -11,6 +11,10 @@ import java.io.Serializable; | ... | @@ -11,6 +11,10 @@ import java.io.Serializable; |
11 | 11 | ||
12 | @Named | 12 | @Named |
13 | @RequestScoped | 13 | @RequestScoped |
14 | +/** | ||
15 | + * Vue de addCountry.xhtml | ||
16 | + * Permet d'ajouter de nouveaux pays. | ||
17 | + */ | ||
14 | public class AddCountryView implements Serializable { | 18 | public class AddCountryView implements Serializable { |
15 | transient Logger logger = LoggerFactory.getLogger(getClass()); | 19 | transient Logger logger = LoggerFactory.getLogger(getClass()); |
16 | 20 | ||
... | @@ -22,11 +26,19 @@ public class AddCountryView implements Serializable { | ... | @@ -22,11 +26,19 @@ public class AddCountryView implements Serializable { |
22 | //no args constructor to make it proxyable | 26 | //no args constructor to make it proxyable |
23 | } | 27 | } |
24 | 28 | ||
29 | + /** | ||
30 | + * S'appuie sur le service partagé. | ||
31 | + * | ||
32 | + * @param sharedService | ||
33 | + */ | ||
25 | @Inject | 34 | @Inject |
26 | public AddCountryView(SharedService sharedService) { | 35 | public AddCountryView(SharedService sharedService) { |
27 | this.sharedService = sharedService; | 36 | this.sharedService = sharedService; |
28 | } | 37 | } |
29 | 38 | ||
39 | + /** | ||
40 | + * Ajoute la pays du formulaire. | ||
41 | + */ | ||
30 | public void add() { | 42 | public void add() { |
31 | Country country = new Country(); | 43 | Country country = new Country(); |
32 | country.setCountryName(countryName); | 44 | country.setCountryName(countryName); | ... | ... |
... | @@ -11,6 +11,10 @@ import java.util.List; | ... | @@ -11,6 +11,10 @@ import java.util.List; |
11 | 11 | ||
12 | @Named | 12 | @Named |
13 | @RequestScoped | 13 | @RequestScoped |
14 | +/** | ||
15 | + * Vue de listCountries.xhtml | ||
16 | + * Alimente l'affichage de l'ensemble des pays. | ||
17 | + */ | ||
14 | public class ListCountriesView implements Serializable { | 18 | public class ListCountriesView implements Serializable { |
15 | 19 | ||
16 | private transient SharedService sharedService; | 20 | private transient SharedService sharedService; |
... | @@ -21,11 +25,19 @@ public class ListCountriesView implements Serializable { | ... | @@ -21,11 +25,19 @@ public class ListCountriesView implements Serializable { |
21 | //no args constructor to make it proxyable | 25 | //no args constructor to make it proxyable |
22 | } | 26 | } |
23 | 27 | ||
28 | + /** | ||
29 | + * Utilise le service partagé. | ||
30 | + * | ||
31 | + * @param sharedService | ||
32 | + */ | ||
24 | @Inject | 33 | @Inject |
25 | public ListCountriesView(SharedService sharedService) { | 34 | public ListCountriesView(SharedService sharedService) { |
26 | this.sharedService = sharedService; | 35 | this.sharedService = sharedService; |
27 | } | 36 | } |
28 | 37 | ||
38 | + /** | ||
39 | + * Charge la liste des pays. | ||
40 | + */ | ||
29 | @PostConstruct | 41 | @PostConstruct |
30 | public void init() { | 42 | public void init() { |
31 | countries = sharedService.getAllCountries(); | 43 | countries = sharedService.getAllCountries(); | ... | ... |
... | @@ -4,17 +4,52 @@ import org.legrog.entities.*; | ... | @@ -4,17 +4,52 @@ import org.legrog.entities.*; |
4 | 4 | ||
5 | import java.util.List; | 5 | import java.util.List; |
6 | 6 | ||
7 | +/** | ||
8 | + * Service partagé pour les données non associées à un package spécifique. | ||
9 | + */ | ||
7 | public interface SharedService { | 10 | public interface SharedService { |
8 | 11 | ||
12 | + /** | ||
13 | + * Ajoute un pays. | ||
14 | + * | ||
15 | + * @param country | ||
16 | + * @return Country ajouté | ||
17 | + */ | ||
9 | Country addCountry(Country country); | 18 | Country addCountry(Country country); |
10 | 19 | ||
20 | + /** | ||
21 | + * Fournit la liste des pays. | ||
22 | + * | ||
23 | + * @return List<Country> | ||
24 | + */ | ||
11 | List<Country> getAllCountries(); | 25 | List<Country> getAllCountries(); |
12 | 26 | ||
27 | + /** | ||
28 | + * Fournit la liste des DisplayNameMask | ||
29 | + * | ||
30 | + * @return List<DisplayNameMask> | ||
31 | + */ | ||
13 | List<DisplayNameMask> getAllDisplayNameMasks(); | 32 | List<DisplayNameMask> getAllDisplayNameMasks(); |
14 | 33 | ||
34 | + /** | ||
35 | + * Fournit la liste des AccountRole | ||
36 | + * | ||
37 | + * @return List<AccountRole> | ||
38 | + */ | ||
15 | List<AccountRole> getAvailableUserRoles(); | 39 | List<AccountRole> getAvailableUserRoles(); |
16 | 40 | ||
41 | + /** | ||
42 | + * Fournit la liste des AccountProperty | ||
43 | + * | ||
44 | + * @return List<AccountProperty> | ||
45 | + */ | ||
17 | List<AccountProperty> getAvailableUserProperties(); | 46 | List<AccountProperty> getAvailableUserProperties(); |
18 | 47 | ||
48 | + /** | ||
49 | + * Fournit le compte correspondant à l'utilisateur courant. | ||
50 | + * @return Account | ||
51 | + * | ||
52 | + * TODO : implémenter une méthode qui le fait vraiment | ||
53 | + */ | ||
19 | Account getCurrentUser(); | 54 | Account getCurrentUser(); |
20 | } | 55 | } |
... | \ No newline at end of file | ... | \ No newline at end of file | ... | ... |
... | @@ -10,6 +10,9 @@ import java.util.Random; | ... | @@ -10,6 +10,9 @@ import java.util.Random; |
10 | import java.util.Vector; | 10 | import java.util.Vector; |
11 | 11 | ||
12 | @Stateless | 12 | @Stateless |
13 | +/** | ||
14 | + * Implémentation du service partagé | ||
15 | + */ | ||
13 | public class SharedServiceDefault implements SharedService { | 16 | public class SharedServiceDefault implements SharedService { |
14 | 17 | ||
15 | CountryRepository countryRepository; | 18 | CountryRepository countryRepository; |
... | @@ -17,6 +20,16 @@ public class SharedServiceDefault implements SharedService { | ... | @@ -17,6 +20,16 @@ public class SharedServiceDefault implements SharedService { |
17 | AccountPropertyRepository accountPropertyRepository; | 20 | AccountPropertyRepository accountPropertyRepository; |
18 | UserService userService; | 21 | UserService userService; |
19 | 22 | ||
23 | + private List<DisplayNameMask> allDisplayNameMasks; | ||
24 | + | ||
25 | + /** | ||
26 | + * Utilise les dépôts partagés et le service correspondant aux comptes | ||
27 | + * | ||
28 | + * @param countryRepository | ||
29 | + * @param accountRoleRepository | ||
30 | + * @param accountPropertyRepository | ||
31 | + * @param userService | ||
32 | + */ | ||
20 | @Inject | 33 | @Inject |
21 | public SharedServiceDefault(CountryRepository countryRepository, AccountRoleRepository accountRoleRepository, | 34 | public SharedServiceDefault(CountryRepository countryRepository, AccountRoleRepository accountRoleRepository, |
22 | AccountPropertyRepository accountPropertyRepository, UserService userService) { | 35 | AccountPropertyRepository accountPropertyRepository, UserService userService) { |
... | @@ -26,8 +39,6 @@ public class SharedServiceDefault implements SharedService { | ... | @@ -26,8 +39,6 @@ public class SharedServiceDefault implements SharedService { |
26 | this.userService = userService; | 39 | this.userService = userService; |
27 | } | 40 | } |
28 | 41 | ||
29 | - private List<DisplayNameMask> allDisplayNameMasks; | ||
30 | - | ||
31 | @Override | 42 | @Override |
32 | public Country addCountry(Country country) { | 43 | public Country addCountry(Country country) { |
33 | countryRepository.save(country); | 44 | countryRepository.save(country); | ... | ... |
-
Please register or login to post a comment