BrightSide Workbench Full Report + Source Code
org.turro.elephant.web.context.WebResources Class Reference

Public Member Functions

 WebResources (Path folder)
 
List< String > globalResourceNames ()
 
List< String > resourceNamesForLang (String lang)
 
Set< String > getBaseNames ()
 
Set< String > getLangs ()
 
File getResource (String base, String lang)
 
Set< String > getVersions (String base, String lang)
 
File getEditable (String base, String lang, String version)
 
WebLocaleResource addWebLocaleResource (String base, WebLocaleResource resource)
 
void saveContent (Path folder, IContact contact, String base, String lang, String wiki, String html, boolean autoremove)
 

Detailed Description

Author
Lluis TurrĂ³ Cutiller lluis.nosp@m.@tur.nosp@m.ro.or.nosp@m.g

Definition at line 43 of file WebResources.java.

Constructor & Destructor Documentation

◆ WebResources()

org.turro.elephant.web.context.WebResources.WebResources ( Path  folder)

Definition at line 50 of file WebResources.java.

50  {
51  this.folder = folder;
52  populate();
53  }

Member Function Documentation

◆ addWebLocaleResource()

WebLocaleResource org.turro.elephant.web.context.WebResources.addWebLocaleResource ( String  base,
WebLocaleResource  resource 
)

Definition at line 96 of file WebResources.java.

96  {
97  resources.putIfAbsent(base, resource);
98  return resources.get(base);
99  }

◆ getBaseNames()

Set<String> org.turro.elephant.web.context.WebResources.getBaseNames ( )

Definition at line 68 of file WebResources.java.

68  {
69  return resources.keySet();
70  }

◆ getEditable()

File org.turro.elephant.web.context.WebResources.getEditable ( String  base,
String  lang,
String  version 
)

Definition at line 88 of file WebResources.java.

88  {
89  if(!Strings.isBlank(version)) {
90  WebResource wr = webResource(base, lang);
91  return wr != null ? wr.getEditables().get(version) : null;
92  }
93  return null;
94  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getLangs()

Set<String> org.turro.elephant.web.context.WebResources.getLangs ( )

Definition at line 72 of file WebResources.java.

72  {
73  Set<String> langs = new TreeSet<>();
74  resources.values().forEach(v -> langs.addAll(v.getLangs()));
75  return langs;
76  }

◆ getResource()

File org.turro.elephant.web.context.WebResources.getResource ( String  base,
String  lang 
)

Definition at line 78 of file WebResources.java.

78  {
79  WebResource wr = webResource(base, lang);
80  return wr != null ? wr.getResource() : null;
81  }
Here is the call graph for this function:

◆ getVersions()

Set<String> org.turro.elephant.web.context.WebResources.getVersions ( String  base,
String  lang 
)

Definition at line 83 of file WebResources.java.

83  {
84  WebResource wr = webResource(base, lang);
85  return wr != null ? new TreeSet(wr.getEditables().keySet()).descendingSet() : Collections.EMPTY_SET;
86  }
Here is the call graph for this function:

◆ globalResourceNames()

List<String> org.turro.elephant.web.context.WebResources.globalResourceNames ( )

Definition at line 55 of file WebResources.java.

55  {
56  return resourceNamesForLang("");
57  }
List< String > resourceNamesForLang(String lang)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ resourceNamesForLang()

List<String> org.turro.elephant.web.context.WebResources.resourceNamesForLang ( String  lang)

Definition at line 59 of file WebResources.java.

59  {
60  List<String> names = new ArrayList<>();
61  resources.values().forEach(wlr -> {
62  String name = wlr.resourceNameForLang(lang);
63  if(!Strings.isBlank(name)) names.add(name);
64  });
65  return names;
66  }
Here is the caller graph for this function:

◆ saveContent()

void org.turro.elephant.web.context.WebResources.saveContent ( Path  folder,
IContact  contact,
String  base,
String  lang,
String  wiki,
String  html,
boolean  autoremove 
)

Definition at line 101 of file WebResources.java.

101  {
102  try {
103  WebResourceParts wrp = WebResourceParts.editable(contact, base, lang);
104  File editable = wrp.getEditableFile(folder, contact);
105  File resource = wrp.getResourceFile(folder);
106  FileUtil.setContent(editable, wiki);
107  FileUtil.setContent(resource, html);
108  if(autoremove) {
109  WebResource wr = webResource(base, lang);
110  if(wr != null) wr.cleanEditables(wrp.getModified());
111  }
112  } catch (IOException ex) {
113  Logger.getLogger(WebResources.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
114  }
115  }
Here is the call graph for this function:
Here is the caller graph for this function:

The documentation for this class was generated from the following file: