43 lines
1.0 KiB
Java
43 lines
1.0 KiB
Java
package ru.ulstu.paper.controller;
|
|
|
|
import ru.ulstu.paper.model.Paper;
|
|
import ru.ulstu.paper.service.PaperService;
|
|
|
|
import javax.annotation.PostConstruct;
|
|
import javax.faces.context.FacesContext;
|
|
import javax.faces.view.ViewScoped;
|
|
import javax.inject.Inject;
|
|
import javax.inject.Named;
|
|
import java.io.Serializable;
|
|
import java.util.Arrays;
|
|
import java.util.List;
|
|
import java.util.Map;
|
|
|
|
@Named
|
|
@ViewScoped
|
|
public class PaperView implements Serializable {
|
|
@Inject
|
|
private PaperService paperService;
|
|
|
|
private Paper paper;
|
|
|
|
@PostConstruct
|
|
public void init() {
|
|
Map<String, String> params = FacesContext.getCurrentInstance().
|
|
getExternalContext().getRequestParameterMap();
|
|
paper = paperService.findPaperById(Integer.valueOf(params.get("id")));
|
|
}
|
|
|
|
public Paper getPaper() {
|
|
return paper;
|
|
}
|
|
|
|
public void setPaper(Paper paper) {
|
|
this.paper = paper;
|
|
}
|
|
|
|
public List<Paper.PaperStatus> getPaperStatuses() {
|
|
return Arrays.asList(Paper.PaperStatus.values());
|
|
}
|
|
}
|