Showing
1 changed file
with
18 additions
and
2 deletions
... | @@ -9,6 +9,7 @@ import org.legrog.web.publisher.PublisherService; | ... | @@ -9,6 +9,7 @@ import org.legrog.web.publisher.PublisherService; |
9 | import javax.enterprise.context.RequestScoped; | 9 | import javax.enterprise.context.RequestScoped; |
10 | import javax.inject.Inject; | 10 | import javax.inject.Inject; |
11 | import javax.inject.Named; | 11 | import javax.inject.Named; |
12 | +import java.io.Serializable; | ||
12 | import java.util.ArrayList; | 13 | import java.util.ArrayList; |
13 | import java.util.List; | 14 | import java.util.List; |
14 | 15 | ||
... | @@ -17,7 +18,7 @@ import java.util.List; | ... | @@ -17,7 +18,7 @@ import java.util.List; |
17 | */ | 18 | */ |
18 | @Named | 19 | @Named |
19 | @RequestScoped | 20 | @RequestScoped |
20 | -public class SearchView { | 21 | +public class SearchView implements Serializable { |
21 | List<PublisherVersion> publisherVersions = new ArrayList<>(); | 22 | List<PublisherVersion> publisherVersions = new ArrayList<>(); |
22 | List<Account> accounts = new ArrayList<>(); | 23 | List<Account> accounts = new ArrayList<>(); |
23 | String searchString = new String(); | 24 | String searchString = new String(); |
... | @@ -30,6 +31,7 @@ public class SearchView { | ... | @@ -30,6 +31,7 @@ public class SearchView { |
30 | * Uses PublisherService to access search repository | 31 | * Uses PublisherService to access search repository |
31 | * | 32 | * |
32 | * @param publisherService injected PublisherService | 33 | * @param publisherService injected PublisherService |
34 | + * @param accountService injected AccountService | ||
33 | */ | 35 | */ |
34 | @Inject | 36 | @Inject |
35 | public SearchView(PublisherService publisherService, AccountService accountService) { | 37 | public SearchView(PublisherService publisherService, AccountService accountService) { |
... | @@ -41,18 +43,32 @@ public class SearchView { | ... | @@ -41,18 +43,32 @@ public class SearchView { |
41 | //no args constructor to make it proxyable | 43 | //no args constructor to make it proxyable |
42 | } | 44 | } |
43 | 45 | ||
46 | + /** | ||
47 | + * | ||
48 | + * @return whether search with non-empty string has returned an empty result for publishers | ||
49 | + */ | ||
44 | public boolean publisherSearchEmpty() { | 50 | public boolean publisherSearchEmpty() { |
45 | return ((!searchString.isEmpty()) && publisherVersions.isEmpty()); | 51 | return ((!searchString.isEmpty()) && publisherVersions.isEmpty()); |
46 | } | 52 | } |
47 | 53 | ||
54 | + /** | ||
55 | + * | ||
56 | + * @return whether search with non-empty string has returned an empty result for accounts | ||
57 | + */ | ||
48 | public boolean accountSearchEmpty() { | 58 | public boolean accountSearchEmpty() { |
49 | - return ((!searchString.isEmpty()) && accounts.isEmpty()); | 59 | + return !searchString.isEmpty() && accounts.isEmpty(); |
50 | } | 60 | } |
51 | 61 | ||
62 | + /** | ||
63 | + * Searches for all types included gere containing searchString | ||
64 | + */ | ||
52 | public void search() throws SearchingException { | 65 | public void search() throws SearchingException { |
53 | this.publisherVersions = publisherService.search(this.searchString); | 66 | this.publisherVersions = publisherService.search(this.searchString); |
54 | this.accounts = accountService.search(this.searchString); | 67 | this.accounts = accountService.search(this.searchString); |
55 | } | 68 | } |
69 | + /** | ||
70 | + * Sets view up according to availability of Id in stringId | ||
71 | + */ | ||
56 | 72 | ||
57 | public String getSearchString() { | 73 | public String getSearchString() { |
58 | return searchString; | 74 | return searchString; | ... | ... |
-
Please register or login to post a comment