Class TemplateLocatorServiceImpl
- java.lang.Object
-
- co.mastermindcms.framework.services.TemplateLocatorServiceImpl
-
- All Implemented Interfaces:
TemplateLocatorService
,java.io.Serializable
@Service public class TemplateLocatorServiceImpl extends java.lang.Object implements TemplateLocatorService
- See Also:
- Serialized Form
-
-
Field Summary
Fields Modifier and Type Field Description private CommonProperties
commonProperties
private org.springframework.core.env.Environment
env
private RouterService
routerService
private UserPrincipalDetailsService
userDetailsService
-
Constructor Summary
Constructors Constructor Description TemplateLocatorServiceImpl()
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description private int
calculatePageIdx(java.nio.file.Path path)
java.lang.String
findTemplate(java.lang.String site, java.lang.String requestURI)
This method does return template page html-data.java.lang.String
findTemplateByPath(java.lang.String path)
This method does return template page html-data.private java.lang.String
getDynamicTemplate(java.lang.String path)
private java.lang.String
getExternalFragmentHtml(java.lang.String path)
private java.lang.String
getExternalPageHtml(java.lang.String path)
private java.lang.String
getExternalPagePath(java.lang.String path)
java.lang.String
getFragmentHtml(java.lang.String path)
This method does return template fragment html-data.java.lang.String
getFragmentPath(java.lang.String path)
This method does return template fragment path.private java.lang.String
getInternalHtml(java.lang.String path)
private java.lang.String
getInternalPath(java.lang.String path)
java.lang.String
getPageHtml(java.lang.String path)
This method does return template page html-data.java.lang.String
getPagePath(java.lang.String path)
This method does return template page path.java.lang.String
getSiteFromContext()
This method returns data as text from context.private java.lang.String
getTemplateFromFilesystemRoot(java.lang.String currentPath)
private java.lang.String
getTemplateFromFileuploadRoot(java.lang.String currentPath)
private boolean
isRouteToIgnore(org.json.JSONObject currentSPA, java.lang.String route)
private java.util.Map<java.lang.String,java.lang.String>
rebuildPath(java.lang.String currentPath)
-
-
-
Field Detail
-
env
@Autowired private org.springframework.core.env.Environment env
-
commonProperties
@Autowired private CommonProperties commonProperties
-
userDetailsService
@Qualifier("userPrincipalDetailsService") @Autowired private UserPrincipalDetailsService userDetailsService
-
routerService
@Autowired private RouterService routerService
-
-
Method Detail
-
getSiteFromContext
public java.lang.String getSiteFromContext()
Description copied from interface:TemplateLocatorService
This method returns data as text from context.- Specified by:
getSiteFromContext
in interfaceTemplateLocatorService
- Returns:
- data as text
-
findTemplate
public java.lang.String findTemplate(java.lang.String site, java.lang.String requestURI)
Description copied from interface:TemplateLocatorService
This method does return template page html-data.- Specified by:
findTemplate
in interfaceTemplateLocatorService
- Parameters:
site
- the root folder to be used for searchingrequestURI
- the rest part of the path- Returns:
- template content as html-string
-
findTemplateByPath
public java.lang.String findTemplateByPath(java.lang.String path)
Description copied from interface:TemplateLocatorService
This method does return template page html-data.- Specified by:
findTemplateByPath
in interfaceTemplateLocatorService
- Parameters:
path
- the path to be used for search- Returns:
- template content as html-string
-
getPagePath
public java.lang.String getPagePath(java.lang.String path)
Description copied from interface:TemplateLocatorService
This method does return template page path.- Specified by:
getPagePath
in interfaceTemplateLocatorService
- Parameters:
path
- path of page which will be returned- Returns:
- template content as html-string
-
getFragmentPath
public java.lang.String getFragmentPath(java.lang.String path)
Description copied from interface:TemplateLocatorService
This method does return template fragment path.- Specified by:
getFragmentPath
in interfaceTemplateLocatorService
- Parameters:
path
- path of fragment which will be returned- Returns:
- data as text
-
getPageHtml
public java.lang.String getPageHtml(java.lang.String path)
Description copied from interface:TemplateLocatorService
This method does return template page html-data.- Specified by:
getPageHtml
in interfaceTemplateLocatorService
- Parameters:
path
- html of page which will be returned- Returns:
- html-data as text
-
getFragmentHtml
public java.lang.String getFragmentHtml(java.lang.String path)
Description copied from interface:TemplateLocatorService
This method does return template fragment html-data.- Specified by:
getFragmentHtml
in interfaceTemplateLocatorService
- Parameters:
path
- html of fragment which will be returned- Returns:
- html-data as text
-
isRouteToIgnore
private boolean isRouteToIgnore(org.json.JSONObject currentSPA, java.lang.String route)
-
getTemplateFromFileuploadRoot
private java.lang.String getTemplateFromFileuploadRoot(java.lang.String currentPath)
-
getTemplateFromFilesystemRoot
private java.lang.String getTemplateFromFilesystemRoot(java.lang.String currentPath)
-
getExternalFragmentHtml
private java.lang.String getExternalFragmentHtml(java.lang.String path)
-
getExternalPageHtml
private java.lang.String getExternalPageHtml(java.lang.String path)
-
getInternalHtml
private java.lang.String getInternalHtml(java.lang.String path)
-
getExternalPagePath
private java.lang.String getExternalPagePath(java.lang.String path)
-
getInternalPath
private java.lang.String getInternalPath(java.lang.String path)
-
rebuildPath
private java.util.Map<java.lang.String,java.lang.String> rebuildPath(java.lang.String currentPath)
-
calculatePageIdx
private int calculatePageIdx(java.nio.file.Path path)
-
getDynamicTemplate
private java.lang.String getDynamicTemplate(java.lang.String path)
-
-