Web implementation of the Gourmet Recipe Manager
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.
 
 
 
 

49 lines
1023 B

/**
* Copyright (C) 2021, Tim Holloway
*
* Date written: Dec 7, 2021
* Author: Tim Holloway <timh@mousetech.com>
*/
package com.mousetech.gourmetj;
import java.util.List;
import jakarta.enterprise.context.ApplicationScoped;
import jakarta.inject.Inject;
import jakarta.inject.Named;
import com.mousetech.gourmetj.persistence.service.RecipeService;
/**
* @author timh
* @since Dec 7, 2021
*/
@Named
@ApplicationScoped
public class CuisineBean {
@Inject
private RecipeService recipeService;
private List<String> cuisineList;
/**
* Return list of cuisines currently on file. Create it if
* needed.
*/
public List<String> getCuisineList() {
if (this.cuisineList == null ) {
this.cuisineList = loadCuisineList();
}
return this.cuisineList;
}
private synchronized List<String> loadCuisineList() {
List<String> list = this.recipeService.findCuisines();
return list;
}
public synchronized void registerCuisine(String cuisineString) {
// search in-memory list. Add if needed.
}
}