BrightSide Workbench Full Report + Source Code
org.turro.elephant.web.ElContextMap Class Reference
Inheritance diagram for org.turro.elephant.web.ElContextMap:
Collaboration diagram for org.turro.elephant.web.ElContextMap:

Static Public Member Functions

static ElContext getCurrent ()
 
static ElContext getContext (IConstructor constructor)
 
static ElContext getContext (IContext context)
 
static ElContext getContext (String path)
 
static ElContext getContextFromWebTag (String webTag)
 
static SortedSet< ElContextgetContexts (String from, int level)
 
static ElContext addContext (ElContext context)
 
static void init ()
 
static void reset ()
 
static ElContext getRoot ()
 
static ElContextMap getInstance ()
 
static String locateRealContext (IConstructor constructor)
 
static String extractPath (String path)
 

Detailed Description

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

Definition at line 35 of file ElContextMap.java.

Member Function Documentation

◆ addContext()

static ElContext org.turro.elephant.web.ElContextMap.addContext ( ElContext  context)
static

Definition at line 81 of file ElContextMap.java.

81  {
82  return getInstance().put(context.path, context);
83  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ extractPath()

static String org.turro.elephant.web.ElContextMap.extractPath ( String  path)
static

Definition at line 124 of file ElContextMap.java.

124  {
125  if(path == null) {
126  path = "/";
127  } else {
128  int p = path.indexOf("?");
129  if(p > -1) {
130  path = path.substring(0, p);
131  }
132  }
133  return path;
134  }
Here is the caller graph for this function:

◆ getContext() [1/3]

static ElContext org.turro.elephant.web.ElContextMap.getContext ( IConstructor  constructor)
static

Definition at line 49 of file ElContextMap.java.

49  {
50  return getContext(locateRealContext(constructor));
51  }
static ElContext getContext(IConstructor constructor)
static String locateRealContext(IConstructor constructor)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContext() [2/3]

static ElContext org.turro.elephant.web.ElContextMap.getContext ( IContext  context)
static

Definition at line 53 of file ElContextMap.java.

53  {
54  return context == null ? null : getInstance().getOrDefault(context.getPath(), null);
55  }
Here is the call graph for this function:

◆ getContext() [3/3]

static ElContext org.turro.elephant.web.ElContextMap.getContext ( String  path)
static

Definition at line 57 of file ElContextMap.java.

57  {
58  if(Strings.isBlank(path) || "/".equals(path)) path = "";
59  return getInstance().getOrDefault(path, null);
60  }
Here is the call graph for this function:

◆ getContextFromWebTag()

static ElContext org.turro.elephant.web.ElContextMap.getContextFromWebTag ( String  webTag)
static

Definition at line 62 of file ElContextMap.java.

62  {
63  return getInstance().values().stream()
64  .filter(context -> webTag.equals(context.getWebContext().getWebTag()))
65  .findFirst().orElse(null);
66  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getContexts()

static SortedSet<ElContext> org.turro.elephant.web.ElContextMap.getContexts ( String  from,
int  level 
)
static

Definition at line 68 of file ElContextMap.java.

68  {
69  String[] levels = from.split("\\/");
70  String tmp = "";
71  if(levels.length >= level) {
72  for(int i = 0; i < level; i++)
73  tmp += "/" + levels[i];
74  tmp = tmp.replaceAll("\\/\\/", "\\/");
75  ElContext ctx = getContext(tmp);
76  if(ctx != null) return ctx.getChildren();
77  }
78  return Collections.emptySortedSet();
79  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getCurrent()

static ElContext org.turro.elephant.web.ElContextMap.getCurrent ( )
static

Definition at line 37 of file ElContextMap.java.

37  {
38  ElContext elc = null;
39  Application app = Application.getApplication();
40  if(app instanceof ElephantApplication) {
41  IConstructor constructor = app.getConstructor();
42  if(constructor != null) {
43  elc = constructor.getRenderingContext();
44  }
45  }
46  return elc == null ? getContext("/") : elc;
47  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getInstance()

static ElContextMap org.turro.elephant.web.ElContextMap.getInstance ( )
static

Definition at line 101 of file ElContextMap.java.

101  {
102  return _map;
103  }
Here is the caller graph for this function:

◆ getRoot()

static ElContext org.turro.elephant.web.ElContextMap.getRoot ( )
static

Definition at line 97 of file ElContextMap.java.

97  {
98  return _root;
99  }
Here is the caller graph for this function:

◆ init()

static void org.turro.elephant.web.ElContextMap.init ( )
static

Definition at line 85 of file ElContextMap.java.

85  {
86  if(_map.isEmpty()) {
87  _root = new ElContext();
88  }
89  }
Here is the caller graph for this function:

◆ locateRealContext()

static String org.turro.elephant.web.ElContextMap.locateRealContext ( IConstructor  constructor)
static

Definition at line 112 of file ElContextMap.java.

112  {
113  String path = null;
114  if(constructor.getRequest() == null) {
115  path = "/";
116  } else {
117  path = extractPath(constructor.getRequest().getServletPath());
118  }
119  if(!Files.exists(path)) path = Files.toExisting(path);
120  if(path.endsWith("/")) path = path.substring(0, path.length() - 1);
121  return path;
122  }
static String extractPath(String path)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ reset()

static void org.turro.elephant.web.ElContextMap.reset ( )
static

Definition at line 91 of file ElContextMap.java.

91  {
92  _map.clear();
93  _root = new ElContext();
94  SocialImageMap.reset();
95  }
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: