ListPublisherRevisionsView.java
2.13 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
package org.legrog.presentation;
import org.legrog.application.PublisherRevisionService;
import org.legrog.application.PublisherService;
import org.legrog.entities.Publisher;
import org.legrog.entities.PublisherRevision;
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.util.ArrayList;
import java.util.Iterator;
import java.util.List;
@Named
@RequestScoped
public class ListPublisherRevisionsView {
Logger logger = LoggerFactory.getLogger(getClass());
@Inject
PublisherRevisionService publisherRevisionService;
private Integer publisherId;
private boolean viewAll;
private List<PublisherRevision> publisherRevisions;
public List<PublisherRevision> getPublisherRevisions() {
return publisherRevisions;
}
/*
if (!viewAll) {
logger.info("!viewAll");
ArrayList<PublisherRevision> filteredPublisherRevisions= new ArrayList<PublisherRevision>();
Iterator<PublisherRevision> publisherRevisionIterator = filteredPublisherRevisions.iterator();
while (publisherRevisionIterator.hasNext()) {
PublisherRevision publisherRevision = publisherRevisionIterator.next();
if (publisherRevision.getPublisher().getPublisherId() == publisherId.intValue()) {
filteredPublisherRevisions.add(publisherRevision);
}
}
publisherRevisions = filteredPublisherRevisions;
}
*/
@PostConstruct
public void init() {
publisherRevisions = publisherRevisionService.getAllPublisherRevisions();
logger.info("init");
}
public void setView() {
logger.info("setView");
logger.info("publisherId = " + publisherId);
viewAll = false;
if (publisherId == null) {
viewAll = true;
}
}
public Integer getPublisherId() {
return publisherId;
}
public void setPublisherId(Integer publisherId) {
this.publisherId = publisherId;
}
public boolean isViewAll() {
return viewAll;
}
}