Compare commits
2 Commits
f7ab0b1c57
...
a4e70a0739
Author | SHA1 | Date | |
---|---|---|---|
a4e70a0739 | |||
77121f9a79 |
2
pom.xml
2
pom.xml
|
@ -7,7 +7,7 @@
|
||||||
|
|
||||||
<groupId>com.mousetech.gourmet</groupId>
|
<groupId>com.mousetech.gourmet</groupId>
|
||||||
<artifactId>gourmetj</artifactId>
|
<artifactId>gourmetj</artifactId>
|
||||||
<version>0.2.2</version>
|
<version>0.2.5</version>
|
||||||
<packaging>jar</packaging>
|
<packaging>jar</packaging>
|
||||||
|
|
||||||
<name>GourmetJ</name>
|
<name>GourmetJ</name>
|
||||||
|
|
|
@ -1,4 +1,4 @@
|
||||||
package com.mousetech.gourmetj;
|
package com.mousetech.gourmetj;
|
||||||
|
|
||||||
import java.io.InputStream;
|
import java.io.InputStream;
|
||||||
import java.io.UnsupportedEncodingException;
|
import java.io.UnsupportedEncodingException;
|
||||||
|
|
|
@ -20,7 +20,7 @@ import org.apache.commons.lang3.StringUtils;
|
||||||
import org.primefaces.event.FileUploadEvent;
|
import org.primefaces.event.FileUploadEvent;
|
||||||
import org.slf4j.Logger;
|
import org.slf4j.Logger;
|
||||||
import org.slf4j.LoggerFactory;
|
import org.slf4j.LoggerFactory;
|
||||||
|
import org.springframework.orm.jpa.JpaSystemException;
|
||||||
|
|
||||||
import com.mousetech.gourmetj.persistence.model.Category;
|
import com.mousetech.gourmetj.persistence.model.Category;
|
||||||
import com.mousetech.gourmetj.persistence.model.Ingredient;
|
import com.mousetech.gourmetj.persistence.model.Ingredient;
|
||||||
|
@ -649,15 +649,24 @@ public class RecipeDetailBean implements Serializable {
|
||||||
|
|
||||||
String ingkey = ing.getIngkey();
|
String ingkey = ing.getIngkey();
|
||||||
if (!StringUtils.isEmpty(ingkey)) {
|
if (!StringUtils.isEmpty(ingkey)) {
|
||||||
Shopcat scat = this.recipeService
|
try {
|
||||||
.findShopcatForIngredientKey(ingkey);
|
Shopcat scat = this.recipeService
|
||||||
ing.setShopCat(scat);
|
.findShopcatForIngredientKey(ingkey);
|
||||||
|
ing.setShopCat(scat);
|
||||||
|
} catch (JpaSystemException ex) {
|
||||||
|
String msg = String.format(
|
||||||
|
"Database Error: Unable to fetch info on \"%s\".",
|
||||||
|
ingkey);
|
||||||
|
log.error(msg);
|
||||||
|
JSFUtils.addErrorMessage(msg);
|
||||||
|
|
||||||
|
}
|
||||||
}
|
}
|
||||||
// get ing list size, set ing position, append
|
// get ing list size, set ing position, append
|
||||||
List<IngredientUI> ingredients = getWrappedIngredients();
|
List<IngredientUI> ingredients = getWrappedIngredients();
|
||||||
int lsize = ingredients.size();
|
int lsize = ingredients.size();
|
||||||
ing.setPosition(lsize + 1);
|
ing.setPosition(lsize + 1);
|
||||||
ingredients.add(new IngredientUI(ing));
|
ingredients.add(new IngredientUI(ing));
|
||||||
}
|
}
|
||||||
|
|
||||||
// ===
|
// ===
|
||||||
|
|
|
@ -20,9 +20,6 @@ import org.springframework.security.config.annotation.web.configuration.EnableWe
|
||||||
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
import org.springframework.security.config.annotation.web.configuration.WebSecurityCustomizer;
|
||||||
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
import org.springframework.security.config.annotation.web.configurers.AbstractHttpConfigurer;
|
||||||
import org.springframework.security.web.SecurityFilterChain;
|
import org.springframework.security.web.SecurityFilterChain;
|
||||||
import org.springframework.security.web.authentication.LoginUrlAuthenticationEntryPoint;
|
|
||||||
|
|
||||||
import jakarta.servlet.DispatcherType;
|
|
||||||
|
|
||||||
@Configuration
|
@Configuration
|
||||||
@EnableWebSecurity
|
@EnableWebSecurity
|
||||||
|
|
|
@ -7,7 +7,6 @@ import org.springframework.data.jpa.repository.JpaRepository;
|
||||||
import org.springframework.data.jpa.repository.Query;
|
import org.springframework.data.jpa.repository.Query;
|
||||||
import org.springframework.stereotype.Repository;
|
import org.springframework.stereotype.Repository;
|
||||||
|
|
||||||
import com.mousetech.gourmetj.persistence.model.Category;
|
|
||||||
import com.mousetech.gourmetj.persistence.model.Recipe;
|
import com.mousetech.gourmetj.persistence.model.Recipe;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -24,7 +23,7 @@ import com.mousetech.gourmetj.persistence.model.Recipe;
|
||||||
public interface RecipeRepository
|
public interface RecipeRepository
|
||||||
extends JpaRepository<Recipe, Long> {
|
extends JpaRepository<Recipe, Long> {
|
||||||
|
|
||||||
List<Recipe> findByTitleContaining(String searchText);
|
List<Recipe> findByTitleContainingIgnoreCase(String searchText);
|
||||||
|
|
||||||
@EntityGraph(value="Recipe.findWorkingSet")
|
@EntityGraph(value="Recipe.findWorkingSet")
|
||||||
public Recipe findDetailsById(Long recipeId);
|
public Recipe findDetailsById(Long recipeId);
|
||||||
|
@ -32,11 +31,11 @@ public interface RecipeRepository
|
||||||
@Query(name = "Recipe.findCusines", nativeQuery = true)
|
@Query(name = "Recipe.findCusines", nativeQuery = true)
|
||||||
List<String> FindCuisinesNative();
|
List<String> FindCuisinesNative();
|
||||||
|
|
||||||
List<Recipe> findByCategories_CategoryContains(String searchText);
|
List<Recipe> findByCategories_CategoryContainsIgnoreCase(String searchText);
|
||||||
|
|
||||||
List<Recipe> findByCuisineContains(String searchText);
|
List<Recipe> findByCuisineContainsIgnoreCase(String searchText);
|
||||||
|
|
||||||
List<Recipe> findDistinctByIngredientHash_ItemContains(
|
List<Recipe> findDistinctByIngredientHash_ItemContainsIgnoreCase(
|
||||||
String searchText);
|
String searchText);
|
||||||
|
|
||||||
}
|
}
|
||||||
|
|
|
@ -50,7 +50,7 @@ public class RecipeService implements Serializable {
|
||||||
|
|
||||||
public List<Recipe> findByTitle(String searchText) {
|
public List<Recipe> findByTitle(String searchText) {
|
||||||
return recipeRepository
|
return recipeRepository
|
||||||
.findByTitleContaining(searchText);
|
.findByTitleContainingIgnoreCase(searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Recipe findByPrimaryKey(Long recipeId) {
|
public Recipe findByPrimaryKey(Long recipeId) {
|
||||||
|
@ -120,14 +120,19 @@ public class RecipeService implements Serializable {
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Recipe> findByCategoryLike(String searchText) {
|
public List<Recipe> findByCategoryLike(String searchText) {
|
||||||
return recipeRepository.findByCategories_CategoryContains(searchText);
|
return recipeRepository
|
||||||
|
.findByCategories_CategoryContainsIgnoreCase(
|
||||||
|
searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Recipe> findByCuisineLike(String searchText) {
|
public List<Recipe> findByCuisineLike(String searchText) {
|
||||||
return recipeRepository.findByCuisineContains(searchText);
|
return recipeRepository
|
||||||
|
.findByCuisineContainsIgnoreCase(searchText);
|
||||||
}
|
}
|
||||||
|
|
||||||
public List<Recipe> findByIngredientLike(String searchText) {
|
public List<Recipe> findByIngredientLike(String searchText) {
|
||||||
return recipeRepository.findDistinctByIngredientHash_ItemContains(searchText);
|
return recipeRepository
|
||||||
|
.findDistinctByIngredientHash_ItemContainsIgnoreCase(
|
||||||
|
searchText);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -62,9 +62,9 @@
|
||||||
<p:outputLabel for="@next"
|
<p:outputLabel for="@next"
|
||||||
value="Title"
|
value="Title"
|
||||||
/>
|
/>
|
||||||
|
<p:focus/>
|
||||||
<p:inputText id="rtitle"
|
<p:inputText id="rtitle"
|
||||||
size="45" required="true"
|
size="45" required="true"
|
||||||
focus="true"
|
|
||||||
placeholder="A recipe title is required."
|
placeholder="A recipe title is required."
|
||||||
value="#{recipeDetailBean.recipe.title}"
|
value="#{recipeDetailBean.recipe.title}"
|
||||||
>
|
>
|
||||||
|
@ -362,8 +362,8 @@
|
||||||
id="ctlAddIng"
|
id="ctlAddIng"
|
||||||
value="+ Add"
|
value="+ Add"
|
||||||
onclick="ingButton(); return false;"
|
onclick="ingButton(); return false;"
|
||||||
>
|
update=":growl"
|
||||||
</p:commandButton>
|
/>
|
||||||
</h:panelGroup>
|
</h:panelGroup>
|
||||||
</p:panel>
|
</p:panel>
|
||||||
</p:tab>
|
</p:tab>
|
||||||
|
@ -372,6 +372,7 @@
|
||||||
>
|
>
|
||||||
<p:panel header="Instructions">
|
<p:panel header="Instructions">
|
||||||
<div id="insection">
|
<div id="insection">
|
||||||
|
<p:focus/>
|
||||||
<h:inputTextarea
|
<h:inputTextarea
|
||||||
id="ctlInstructions"
|
id="ctlInstructions"
|
||||||
rows="30" cols="120"
|
rows="30" cols="120"
|
||||||
|
@ -383,6 +384,7 @@
|
||||||
</p:tab>
|
</p:tab>
|
||||||
<p:tab id="notesTab" title="Notes">
|
<p:tab id="notesTab" title="Notes">
|
||||||
<p:panel header="Notes">
|
<p:panel header="Notes">
|
||||||
|
<p:focus/>
|
||||||
<h:inputTextarea id="ctlNotes"
|
<h:inputTextarea id="ctlNotes"
|
||||||
rows="30" cols="120"
|
rows="30" cols="120"
|
||||||
escape="false"
|
escape="false"
|
||||||
|
|
Loading…
Reference in New Issue
Block a user