Skip to content
Projects
Groups
Snippets
Help
This project
Loading...
Sign in / Register
Toggle navigation
J
jh-boot
Project
Overview
Details
Activity
Cycle Analytics
Repository
Repository
Files
Commits
Branches
Tags
Contributors
Graph
Compare
Charts
Issues
0
Issues
0
List
Board
Labels
Milestones
Merge Requests
0
Merge Requests
0
CI / CD
CI / CD
Pipelines
Jobs
Schedules
Charts
Wiki
Wiki
Snippets
Snippets
Members
Members
Collapse sidebar
Close sidebar
Activity
Graph
Charts
Create a new issue
Jobs
Commits
Issue Boards
Open sidebar
Jan Hrabal
jh-boot
Commits
bafb0c49
Commit
bafb0c49
authored
Oct 10, 2019
by
Jan Hrabal
Browse files
Options
Browse Files
Download
Email Patches
Plain Diff
templates
parent
ca44afd2
Hide whitespace changes
Inline
Side-by-side
Showing
2 changed files
with
12 additions
and
6 deletions
+12
-6
HibernateLoaderTemplateService.java
.../com/jh/boot/template/HibernateLoaderTemplateService.java
+3
-1
HibernateTemplateLoader.java
...in/java/com/jh/boot/template/HibernateTemplateLoader.java
+9
-5
No files found.
src/main/java/com/jh/boot/template/HibernateLoaderTemplateService.java
View file @
bafb0c49
...
...
@@ -33,7 +33,9 @@ public class HibernateLoaderTemplateService implements TemplateService {
if
(
valuesConfig
!=
null
)
{
values
.
putAll
(
valuesConfig
.
getValues
());
}
values
.
putAll
(
data
);
if
(
data
!=
null
)
{
values
.
putAll
(
data
);
}
String
content
=
t
.
getTemplate
();
StringWriter
sw
=
new
StringWriter
();
...
...
src/main/java/com/jh/boot/template/HibernateTemplateLoader.java
View file @
bafb0c49
...
...
@@ -4,6 +4,7 @@ import java.util.Locale;
import
org.springframework.beans.factory.annotation.Autowired
;
import
org.springframework.transaction.annotation.Transactional
;
import
org.springframework.util.StringUtils
;
public
class
HibernateTemplateLoader
implements
TemplateLoader
{
...
...
@@ -14,11 +15,14 @@ public class HibernateTemplateLoader implements TemplateLoader {
@Override
@Transactional
public
Template
loadTemplate
(
String
code
,
Locale
locale
)
{
String
l
=
locale
==
null
?
null
:
(
locale
.
getLanguage
()
+
"-"
+
locale
.
getCountry
());
Template
t
=
repository
.
loadTemplate
(
code
,
l
);
//TODO refactor
if
(
t
==
null
)
{
t
=
repository
.
loadTemplate
(
code
,
locale
.
getLanguage
());
Template
t
=
null
;
if
(
locale
!=
null
)
{
if
(
StringUtils
.
hasText
(
locale
.
getCountry
()))
{
t
=
repository
.
loadTemplate
(
code
,
locale
.
getLanguage
()
+
"-"
+
locale
.
getCountry
());
}
if
(
t
==
null
)
{
t
=
repository
.
loadTemplate
(
code
,
locale
.
getLanguage
());
}
}
if
(
t
==
null
)
{
t
=
repository
.
loadTemplate
(
code
,
null
);
...
...
Write
Preview
Markdown
is supported
0%
Try again
or
attach a new file
Attach a file
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Cancel
Please
register
or
sign in
to comment