BrightSide Workbench Full Report + Source Code
org.turro.marker.MarkerHelper Class Reference

Public Member Functions

 MarkerHelper (IConstructor constructor)
 
String getQRCodeFromCurrent ()
 
String getQRCodeFromUrl (String url)
 
String getImageFromUrl (String url)
 
String getContent (String values)
 
String getContent (KeyValueMap values)
 
String getEntryPoint (String entryPoint, String values)
 
String getEntryPoint (String entryPoint, KeyValueMap values)
 
Repository getRepository (String path)
 
String imageOrEmpty (String image)
 
String imageOrDefault (String image)
 
boolean imageExists (String image)
 
IDirectContent getCookies ()
 
IDirectContent getTracker ()
 
IDirectContent getPushNotification ()
 
IDirectContent getMessageQueue ()
 
boolean needCookies ()
 
String processMacrosForWeb (String text)
 
Set< IUserMenugetUserMenu ()
 
Set< IElephantUserContentgetUserContents ()
 
Set< String > getUserContentTags ()
 
IDirectContent getAnonymous ()
 
String getIdFrom (String value)
 
String getUniqueId ()
 
String getHelpLink (ElContext context)
 
String getEntityInfoURL (String entityPath)
 
String getUserActivityURL (IContact contact)
 
String webTags ()
 
String navigateToWebTag (String fromTag, String webTag)
 
String navigateAndSetWebTag (String fromTag, String path)
 
String obfuscateParameters (String parameters)
 
String obfuscateRightNowPars (String parameters)
 
String getObfuscatedParameter (String parameter)
 
String getTrick (int seconds)
 
String getSiteAddress ()
 
String truncate (String text, int max)
 
String truncateHTML (String html, int max)
 
String truncateHTMLtoPlain (String html, int max)
 
Colors.Color color (String color)
 
String downloadPath (Document document)
 

Static Public Member Functions

static String setObfuscatedParsPOST (String parameters)
 
static String setObfuscatedPars (String parameters)
 
static String setObfuscatedPars (KeyValueMap parameters)
 
static String setObfuscatedRightNowPars (String parameters)
 
static String setObfuscatedRightNowPars (KeyValueMap parameters)
 
static KeyValueMap getObfuscatedParameters ()
 
static KeyValueMap getObfuscatedParameters (HttpServletRequest request)
 
static KeyValueMap getObfuscatedFrom (String obfuscated)
 
static KeyValueMap getAllParameters ()
 
static KeyValueMap getAllParameters (Map< String, String[]> parameterMap)
 
static String obsfuscatedPOST (String context, String values)
 
static String createPOST (String id, String values)
 
static String createPOST (String id, String domId, String values)
 
static String createURL (String id, String values)
 
static String createDirectURL (IConstructor constructor, IContact contact, String directContentId, String values, int daysValid, boolean withDomain)
 

Static Public Attributes

static final String OBFUSCATED_PAR = "el_xpar"
 

Detailed Description

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

Definition at line 77 of file MarkerHelper.java.

Constructor & Destructor Documentation

◆ MarkerHelper()

org.turro.marker.MarkerHelper.MarkerHelper ( IConstructor  constructor)

Definition at line 83 of file MarkerHelper.java.

83  {
84  this.constructor = constructor;
85  }

Member Function Documentation

◆ color()

Colors.Color org.turro.marker.MarkerHelper.color ( String  color)

Definition at line 410 of file MarkerHelper.java.

410  {
411  return Optional.ofNullable(Colors.of(color)).map(c -> c.color()).orElse(null);
412  }
Colors.Color color(String color)

◆ createDirectURL()

static String org.turro.marker.MarkerHelper.createDirectURL ( IConstructor  constructor,
IContact  contact,
String  directContentId,
String  values,
int  daysValid,
boolean  withDomain 
)
static

Definition at line 377 of file MarkerHelper.java.

378  {
379  String exrino = null;
380  try {
381  KeyValueMap kvm = new KeyValueMap(values);
382  kvm.put(Actions.USER_PAR, contact.getConnector(IUser.CONNECTOR_EMAIL));
383  kvm.put(Actions.REDIR_PAR, (withDomain ? ElephantContext.getServerBase("http") : "") + constructor.getCurrentContext().getWebPath());
384  exrino = Actions.createAction(kvm, daysValid, false);
385  } catch (ParserException ex) {
386  Logger.getLogger(MarkerHelper.class.getName()).log(Level.SEVERE, null, ex);
387  }
388  return (withDomain ? ElephantContext.getServerBase("http") : "") +
389  ElephantContext.getRootWebPath() +
390  DirectContents.DIRECT_CONTENT_PATH + directContentId +
391  "?" + exrino;
392  }
MarkerHelper(IConstructor constructor)

◆ createPOST() [1/2]

static String org.turro.marker.MarkerHelper.createPOST ( String  id,
String  domId,
String  values 
)
static

Definition at line 369 of file MarkerHelper.java.

369  {
370  return DirectContents.doCreatePOST(id, domId, values);
371  }

◆ createPOST() [2/2]

static String org.turro.marker.MarkerHelper.createPOST ( String  id,
String  values 
)
static

Definition at line 365 of file MarkerHelper.java.

365  {
366  return DirectContents.doCreatePOST(id, values);
367  }

◆ createURL()

static String org.turro.marker.MarkerHelper.createURL ( String  id,
String  values 
)
static

Definition at line 373 of file MarkerHelper.java.

373  {
374  return DirectContents.doCreateURL(id, values);
375  }

◆ downloadPath()

String org.turro.marker.MarkerHelper.downloadPath ( Document  document)

Definition at line 416 of file MarkerHelper.java.

416  {
417  return ElephantContext.getRootWebPath() + "/down_" +
418  ElephantContext.removeWebContext(
419  ElephantContext.getRelativePath(document.path().toString()));
420  }
Here is the call graph for this function:

◆ getAllParameters() [1/2]

static KeyValueMap org.turro.marker.MarkerHelper.getAllParameters ( )
static

Definition at line 330 of file MarkerHelper.java.

330  {
331  HttpServletRequest request = Application.getApplication().getHttpServletRequest();
332  if(request != null) {
333  return getAllParameters(request.getParameterMap());
334  }
335  return new KeyValueMap(new HashMap());
336  }
static KeyValueMap getAllParameters()
Here is the call graph for this function:

◆ getAllParameters() [2/2]

static KeyValueMap org.turro.marker.MarkerHelper.getAllParameters ( Map< String, String[]>  parameterMap)
static

Definition at line 338 of file MarkerHelper.java.

338  {
339  final Map map = new HashMap();
340  if(parameterMap != null) {
341  parameterMap.keySet().forEach((key) -> {
342  if(OBFUSCATED_PAR.equals(key)) {
343  KeyValueMap kvm = MarkerHelper.getObfuscatedFrom(parameterMap.get(key)[0]);
344  if(kvm != null) {
345  map.putAll(kvm);
346  }
347  } else {
348  map.put(key, parameterMap.get(key)[0]);
349  }
350  });
351  }
352  return new KeyValueMap(map);
353  }
static final String OBFUSCATED_PAR

◆ getAnonymous()

IDirectContent org.turro.marker.MarkerHelper.getAnonymous ( )

Definition at line 189 of file MarkerHelper.java.

189  {
190  return Plugins.loadImplementation(IDirectContent.class, "anonymous-ctrl");
191  }
Here is the call graph for this function:

◆ getContent() [1/2]

String org.turro.marker.MarkerHelper.getContent ( KeyValueMap  values)

Definition at line 109 of file MarkerHelper.java.

109  {
110  return ContentService.createURL(constructor, values);
111  }

◆ getContent() [2/2]

String org.turro.marker.MarkerHelper.getContent ( String  values)

Definition at line 105 of file MarkerHelper.java.

105  {
106  return ContentService.createURL(constructor, values);
107  }
Here is the caller graph for this function:

◆ getCookies()

IDirectContent org.turro.marker.MarkerHelper.getCookies ( )

Definition at line 139 of file MarkerHelper.java.

139  {
140  return DirectContents.getDirectContent("cookie-management");
141  }
Here is the call graph for this function:

◆ getEntityInfoURL()

String org.turro.marker.MarkerHelper.getEntityInfoURL ( String  entityPath)

Definition at line 211 of file MarkerHelper.java.

211  {
212  return EntityInfoContent.createURL(EntityInfoType.FULL, LinkType.WEB) + "&path=" + entityPath;
213  }
Here is the call graph for this function:

◆ getEntryPoint() [1/2]

String org.turro.marker.MarkerHelper.getEntryPoint ( String  entryPoint,
KeyValueMap  values 
)

Definition at line 117 of file MarkerHelper.java.

117  {
118  return ContentService.createEntryPoint(constructor, entryPoint, values);
119  }

◆ getEntryPoint() [2/2]

String org.turro.marker.MarkerHelper.getEntryPoint ( String  entryPoint,
String  values 
)

Definition at line 113 of file MarkerHelper.java.

113  {
114  return ContentService.createEntryPoint(constructor, entryPoint, values);
115  }

◆ getHelpLink()

String org.turro.marker.MarkerHelper.getHelpLink ( ElContext  context)

Definition at line 205 of file MarkerHelper.java.

205  {
206  return context != null ? HelpContext.helpLink(context.getPath()) : null;
207  }
Here is the call graph for this function:

◆ getIdFrom()

String org.turro.marker.MarkerHelper.getIdFrom ( String  value)

Definition at line 195 of file MarkerHelper.java.

195  {
196  return Strings.identifier(value);
197  }

◆ getImageFromUrl()

String org.turro.marker.MarkerHelper.getImageFromUrl ( String  url)

Definition at line 98 of file MarkerHelper.java.

98  {
99  HashMap map = new HashMap();
100  map.put("type", "image");
101  map.put("data", url);
102  return getContent(new KeyValueMap(map));
103  }
String getContent(String values)
Here is the call graph for this function:

◆ getMessageQueue()

IDirectContent org.turro.marker.MarkerHelper.getMessageQueue ( )

Definition at line 151 of file MarkerHelper.java.

151  {
152  return DirectContents.getDirectContent("message-queue");
153  }
Here is the call graph for this function:

◆ getObfuscatedFrom()

static KeyValueMap org.turro.marker.MarkerHelper.getObfuscatedFrom ( String  obfuscated)
static

Definition at line 319 of file MarkerHelper.java.

319  {
320  if(!Strings.isBlank(obfuscated)) {
321  try {
322  return new KeyValueMap(ElephantContext.decrypt(URLDecoder.decode(obfuscated, charset)));
323  } catch (Exception ex) {
324  WebLoggers.info(MarkerHelper.class).exception(ex).log();
325  }
326  }
327  return null;
328  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObfuscatedParameter()

String org.turro.marker.MarkerHelper.getObfuscatedParameter ( String  parameter)

Definition at line 260 of file MarkerHelper.java.

260  {
261  try {
262  return getMapFromObfuscated().get(parameter);
263  } catch (Exception ex) {
264  Logger.getLogger(MarkerHelper.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
265  }
266  return null;
267  }
Here is the call graph for this function:

◆ getObfuscatedParameters() [1/2]

static KeyValueMap org.turro.marker.MarkerHelper.getObfuscatedParameters ( )
static

Definition at line 311 of file MarkerHelper.java.

311  {
312  return getObfuscatedFrom(Application.getApplication().getConstructor().getParameter(OBFUSCATED_PAR));
313  }
static KeyValueMap getObfuscatedFrom(String obfuscated)
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getObfuscatedParameters() [2/2]

static KeyValueMap org.turro.marker.MarkerHelper.getObfuscatedParameters ( HttpServletRequest  request)
static

Definition at line 315 of file MarkerHelper.java.

315  {
316  return getObfuscatedFrom(request.getParameter(OBFUSCATED_PAR));
317  }
Here is the call graph for this function:

◆ getPushNotification()

IDirectContent org.turro.marker.MarkerHelper.getPushNotification ( )

Definition at line 147 of file MarkerHelper.java.

147  {
148  return DirectContents.getDirectContent("push-notification");
149  }
Here is the call graph for this function:

◆ getQRCodeFromCurrent()

String org.turro.marker.MarkerHelper.getQRCodeFromCurrent ( )

Definition at line 87 of file MarkerHelper.java.

87  {
88  return getQRCodeFromUrl(constructor.getRequest().getRequestURL().toString());
89  }
String getQRCodeFromUrl(String url)
Here is the call graph for this function:

◆ getQRCodeFromUrl()

String org.turro.marker.MarkerHelper.getQRCodeFromUrl ( String  url)

Definition at line 91 of file MarkerHelper.java.

91  {
92  HashMap map = new HashMap();
93  map.put("type", "qrcode");
94  map.put("data", url);
95  return getContent(new KeyValueMap(map));
96  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ getRepository()

Repository org.turro.marker.MarkerHelper.getRepository ( String  path)

Definition at line 121 of file MarkerHelper.java.

121  {
122  return new Repository(constructor, path);
123  }

◆ getSiteAddress()

String org.turro.marker.MarkerHelper.getSiteAddress ( )

Definition at line 361 of file MarkerHelper.java.

361  {
362  return ElephantContext.getServerUrl("http");
363  }
Here is the call graph for this function:

◆ getTracker()

IDirectContent org.turro.marker.MarkerHelper.getTracker ( )

Definition at line 143 of file MarkerHelper.java.

143  {
144  return DirectContents.getDirectContent("img-tk");
145  }
Here is the call graph for this function:

◆ getTrick()

String org.turro.marker.MarkerHelper.getTrick ( int  seconds)

Definition at line 285 of file MarkerHelper.java.

285  {
286  return FormTrick.createTrick(seconds);
287  }
Here is the call graph for this function:

◆ getUniqueId()

String org.turro.marker.MarkerHelper.getUniqueId ( )

Definition at line 199 of file MarkerHelper.java.

199  {
200  return UUID.randomUUID().toString();
201  }

◆ getUserActivityURL()

String org.turro.marker.MarkerHelper.getUserActivityURL ( IContact  contact)

Definition at line 217 of file MarkerHelper.java.

217  {
218  return new UserActivityContent().createURL(contact, ActivityType.values());
219  }
Here is the call graph for this function:

◆ getUserContents()

Set<IElephantUserContent> org.turro.marker.MarkerHelper.getUserContents ( )

Definition at line 179 of file MarkerHelper.java.

179  {
180  return UserContents.getContents(constructor, (IContact) constructor.getUser());
181  }
Here is the call graph for this function:

◆ getUserContentTags()

Set<String> org.turro.marker.MarkerHelper.getUserContentTags ( )

Definition at line 183 of file MarkerHelper.java.

183  {
184  return UserContents.getTags(constructor, (IContact) constructor.getUser());
185  }
Here is the call graph for this function:

◆ getUserMenu()

Set<IUserMenu> org.turro.marker.MarkerHelper.getUserMenu ( )

Definition at line 173 of file MarkerHelper.java.

173  {
174  return UserMenus.getUserMenu(constructor);
175  }
Here is the call graph for this function:

◆ imageExists()

boolean org.turro.marker.MarkerHelper.imageExists ( String  image)

Definition at line 133 of file MarkerHelper.java.

133  {
134  if(Strings.isBlank(image)) return false;
135  image = image.contains("?") ? image.substring(0, image.indexOf("?")) : image;
136  return new File(ElephantContext.getRealPath(image)).exists();
137  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ imageOrDefault()

String org.turro.marker.MarkerHelper.imageOrDefault ( String  image)

Definition at line 129 of file MarkerHelper.java.

129  {
130  return imageExists(image) ? image : "/_zul/images/noimg/noimage.png";
131  }
boolean imageExists(String image)
Here is the call graph for this function:

◆ imageOrEmpty()

String org.turro.marker.MarkerHelper.imageOrEmpty ( String  image)

Definition at line 125 of file MarkerHelper.java.

125  {
126  return imageExists(image) ? image : "/_zul/images/no_img.png";
127  }
Here is the call graph for this function:

◆ navigateAndSetWebTag()

String org.turro.marker.MarkerHelper.navigateAndSetWebTag ( String  fromTag,
String  path 
)

Definition at line 243 of file MarkerHelper.java.

243  {
244  return TagsServlet.navigateAndSet(fromTag, path);
245  }
Here is the call graph for this function:

◆ navigateToWebTag()

String org.turro.marker.MarkerHelper.navigateToWebTag ( String  fromTag,
String  webTag 
)

Definition at line 239 of file MarkerHelper.java.

239  {
240  return TagsServlet.navigateFromTo(fromTag, webTag);
241  }
Here is the call graph for this function:

◆ needCookies()

boolean org.turro.marker.MarkerHelper.needCookies ( )

Definition at line 155 of file MarkerHelper.java.

155  {
156  HttpServletRequest request = constructor.getRequest();
157  return request != null;
158  }
Here is the call graph for this function:

◆ obfuscateParameters()

String org.turro.marker.MarkerHelper.obfuscateParameters ( String  parameters)

Definition at line 252 of file MarkerHelper.java.

252  {
253  return setObfuscatedPars(parameters);
254  }
static String setObfuscatedPars(String parameters)
Here is the call graph for this function:

◆ obfuscateRightNowPars()

String org.turro.marker.MarkerHelper.obfuscateRightNowPars ( String  parameters)

Definition at line 256 of file MarkerHelper.java.

256  {
257  return setObfuscatedRightNowPars(parameters);
258  }
static String setObfuscatedRightNowPars(String parameters)
Here is the call graph for this function:

◆ obsfuscatedPOST()

static String org.turro.marker.MarkerHelper.obsfuscatedPOST ( String  context,
String  values 
)
static

Definition at line 355 of file MarkerHelper.java.

355  {
356  return "$.post(\"" + context + "\", { " + setObfuscatedParsPOST(values) + " })";
357  }
static String setObfuscatedParsPOST(String parameters)

◆ processMacrosForWeb()

String org.turro.marker.MarkerHelper.processMacrosForWeb ( String  text)

Definition at line 160 of file MarkerHelper.java.

160  {
161  if(text.contains("{@")) {
162  StringWriter swriter = new StringWriter();
163  try(PrintWriter writer = new PrintWriter(swriter)) {
164  Parser.processMacros(constructor, writer, text);
165  text = swriter.toString();
166  } catch (IOException | ServletException ex) {
167  Logger.getLogger(MarkerHelper.class.getName()).log(Level.SEVERE, ElephantContext.logMsg(null), ex);
168  }
169  }
170  return MailSenders.processMacros((IContact) constructor.getUser(), text, true);
171  }
Here is the call graph for this function:

◆ setObfuscatedPars() [1/2]

static String org.turro.marker.MarkerHelper.setObfuscatedPars ( KeyValueMap  parameters)
static

Definition at line 299 of file MarkerHelper.java.

299  {
300  return OBFUSCATED_PAR + "=" + URLEncoder.encode(Actions.createPars(parameters, 30), charset);
301  }
Here is the call graph for this function:

◆ setObfuscatedPars() [2/2]

static String org.turro.marker.MarkerHelper.setObfuscatedPars ( String  parameters)
static

Definition at line 295 of file MarkerHelper.java.

295  {
296  return OBFUSCATED_PAR + "=" + URLEncoder.encode(Actions.createPars(parameters, 30), charset);
297  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ setObfuscatedParsPOST()

static String org.turro.marker.MarkerHelper.setObfuscatedParsPOST ( String  parameters)
static

Definition at line 291 of file MarkerHelper.java.

291  {
292  return OBFUSCATED_PAR + ":\"" + URLEncoder.encode(Actions.createPars(parameters, 30), charset) + "\"";
293  }
Here is the call graph for this function:

◆ setObfuscatedRightNowPars() [1/2]

static String org.turro.marker.MarkerHelper.setObfuscatedRightNowPars ( KeyValueMap  parameters)
static

Definition at line 307 of file MarkerHelper.java.

307  {
308  return OBFUSCATED_PAR + "=" + URLEncoder.encode(Actions.createRightNowParameter(parameters), charset);
309  }
Here is the call graph for this function:

◆ setObfuscatedRightNowPars() [2/2]

static String org.turro.marker.MarkerHelper.setObfuscatedRightNowPars ( String  parameters)
static

Definition at line 303 of file MarkerHelper.java.

303  {
304  return OBFUSCATED_PAR + "=" + URLEncoder.encode(Actions.createRightNowParameter(parameters), charset);
305  }
Here is the call graph for this function:
Here is the caller graph for this function:

◆ truncate()

String org.turro.marker.MarkerHelper.truncate ( String  text,
int  max 
)

Definition at line 396 of file MarkerHelper.java.

396  {
397  return Strings.truncate(text, max);
398  }

◆ truncateHTML()

String org.turro.marker.MarkerHelper.truncateHTML ( String  html,
int  max 
)

Definition at line 400 of file MarkerHelper.java.

400  {
401  return HtmlContent.truncate(html, max);
402  }

◆ truncateHTMLtoPlain()

String org.turro.marker.MarkerHelper.truncateHTMLtoPlain ( String  html,
int  max 
)

Definition at line 404 of file MarkerHelper.java.

404  {
405  return HtmlContent.plain(html, max);
406  }

◆ webTags()

String org.turro.marker.MarkerHelper.webTags ( )

Definition at line 235 of file MarkerHelper.java.

235  {
236  return SessionTags.get(constructor).path();
237  }
Here is the call graph for this function:

Member Data Documentation

◆ OBFUSCATED_PAR

final String org.turro.marker.MarkerHelper.OBFUSCATED_PAR = "el_xpar"
static

Definition at line 249 of file MarkerHelper.java.


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