You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
42 lines
1017 B
42 lines
1017 B
package com.mousetech.gourmetj;
|
|
|
|
import java.io.Serializable;
|
|
import java.util.List;
|
|
import jakarta.annotation.PostConstruct;
|
|
import jakarta.faces.view.ViewScoped;
|
|
import jakarta.inject.Inject;
|
|
import jakarta.inject.Named;
|
|
|
|
import org.slf4j.Logger;
|
|
import org.slf4j.LoggerFactory;
|
|
|
|
import com.mousetech.gourmetj.persistence.model.Category;
|
|
import com.mousetech.gourmetj.persistence.service.CategoryService;
|
|
|
|
@Named
|
|
@ViewScoped
|
|
public class CategoryView implements Serializable {
|
|
|
|
private static final long serialVersionUID = 1L;
|
|
|
|
private static final Logger log = LoggerFactory.getLogger(CategoryView.class);
|
|
|
|
@Inject
|
|
private CategoryService categoryRepository;
|
|
|
|
private List<Category> categories;
|
|
|
|
@PostConstruct
|
|
public void init() {
|
|
categories = categoryRepository.findAll();
|
|
|
|
List<String> catNames = categoryRepository.findCategoryNames();
|
|
for (String name : catNames ) {
|
|
log.info("CAT="+name);
|
|
}
|
|
}
|
|
|
|
public List<Category> getCategories() {
|
|
return categories;
|
|
}
|
|
}
|
|
|